tablestore-ruby-sdk 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,43 +1,37 @@
1
- package com.aliyun.tablestore.protocol;
2
-
3
- syntax = "proto3";
4
-
5
1
  message Error {
6
- string code = 1;
7
- string message = 2;
2
+ required string code = 1;
3
+ optional string message = 2;
8
4
  }
9
5
 
10
6
  enum PrimaryKeyType {
11
- NULL = 0;
12
7
  INTEGER = 1;
13
8
  STRING = 2;
14
9
  BINARY = 3;
15
10
  }
16
11
 
17
12
  enum PrimaryKeyOption {
18
- DEFAULT = 0;
19
13
  AUTO_INCREMENT = 1;
20
14
  }
21
15
 
22
16
  message PrimaryKeySchema {
23
- string name = 1;
24
- PrimaryKeyType type = 2;
25
- PrimaryKeyOption option = 3;
17
+ required string name = 1;
18
+ required PrimaryKeyType type = 2;
19
+ optional PrimaryKeyOption option = 3;
26
20
  }
27
21
 
28
22
  message PartitionRange {
29
- bytes begin = 1; // encoded as SQLVariant
30
- bytes end = 2; // encoded as SQLVariant
23
+ required bytes begin = 1; // encoded as SQLVariant
24
+ required bytes end = 2; // encoded as SQLVariant
31
25
  }
32
26
 
33
27
  message TableOptions {
34
- int32 time_to_live = 1; // 可以动态更改
35
- int32 max_versions = 2; // 可以动态更改
36
- int64 deviation_cell_version_in_sec = 5; // 可以动态修改
28
+ optional int32 time_to_live = 1; // 可以动态更改
29
+ optional int32 max_versions = 2; // 可以动态更改
30
+ optional int64 deviation_cell_version_in_sec = 5; // 可以动态修改
37
31
  }
38
32
 
39
33
  message TableMeta {
40
- string table_name = 1;
34
+ required string table_name = 1;
41
35
  repeated PrimaryKeySchema primary_key = 2;
42
36
  }
43
37
 
@@ -48,27 +42,27 @@ enum RowExistenceExpectation {
48
42
  }
49
43
 
50
44
  message Condition {
51
- RowExistenceExpectation row_existence = 1;
52
- bytes column_condition = 2;
45
+ required RowExistenceExpectation row_existence = 1;
46
+ optional bytes column_condition = 2;
53
47
  }
54
48
 
55
49
  message CapacityUnit {
56
- int32 read = 1;
57
- int32 write = 2;
50
+ optional int32 read = 1;
51
+ optional int32 write = 2;
58
52
  }
59
53
 
60
54
  message ReservedThroughputDetails {
61
- CapacityUnit capacity_unit = 1; // 表当前的预留吞吐量的值。
62
- int64 last_increase_time = 2; // 最后一次上调预留吞吐量的时间。
63
- int64 last_decrease_time = 3; // 最后一次下调预留吞吐量的时间。
55
+ required CapacityUnit capacity_unit = 1; // 表当前的预留吞吐量的值。
56
+ required int64 last_increase_time = 2; // 最后一次上调预留吞吐量的时间。
57
+ optional int64 last_decrease_time = 3; // 最后一次下调预留吞吐量的时间。
64
58
  }
65
59
 
66
60
  message ReservedThroughput {
67
- CapacityUnit capacity_unit = 1;
61
+ required CapacityUnit capacity_unit = 1;
68
62
  }
69
63
 
70
64
  message ConsumedCapacity {
71
- CapacityUnit capacity_unit = 1;
65
+ required CapacityUnit capacity_unit = 1;
72
66
  }
73
67
 
74
68
  /* ############################################# CreateTable ############################################# */
@@ -76,17 +70,17 @@ message ConsumedCapacity {
76
70
  * table_meta用于存储表中不可更改的schema属性,可以更改的ReservedThroughput和TableOptions独立出来,作为UpdateTable的参数。
77
71
  * 加入GlobalIndex和LocalIndex之后,结构会变为:
78
72
  * message CreateTableRequest {
79
- * TableMeta table_meta = 1;
80
- * ReservedThroughput reserved_throughput = 2;
81
- * TableOptions table_options = 3;
73
+ * required TableMeta table_meta = 1;
74
+ * required ReservedThroughput reserved_throughput = 2;
75
+ * required TableOptions table_options = 3;
82
76
  * repeated LocalIndex local_indexes = 4; // LocalIndex不再单独包含ReservedThroughput和TableOptions,其与主表共享配置。
83
77
  * repeated GlobalIndex global_indexes = 5; // GlobalIndex内单独包含ReservedThroughput和TableOptions
84
78
  * }
85
79
  */
86
80
  message CreateTableRequest {
87
- TableMeta table_meta = 1;
88
- ReservedThroughput reserved_throughput = 2; // 未放在TableOptions内,原因是UpdateTableResponse中会返回ReservedThroughputDetails,而TableOptions没有类似的返回结构。
89
- TableOptions table_options = 3;
81
+ required TableMeta table_meta = 1;
82
+ required ReservedThroughput reserved_throughput = 2; // 未放在TableOptions内,原因是UpdateTableResponse中会返回ReservedThroughputDetails,而TableOptions没有类似的返回结构。
83
+ optional TableOptions table_options = 3;
90
84
  repeated PartitionRange partitions = 4;
91
85
  }
92
86
 
@@ -98,26 +92,26 @@ message CreateTableResponse {
98
92
 
99
93
  /* ############################################# UpdateTable ############################################# */
100
94
  message UpdateTableRequest {
101
- string table_name = 1;
102
- ReservedThroughput reserved_throughput = 2;
103
- TableOptions table_options = 3;
95
+ required string table_name = 1;
96
+ optional ReservedThroughput reserved_throughput = 2;
97
+ optional TableOptions table_options = 3;
104
98
  }
105
99
 
106
100
  message UpdateTableResponse {
107
- ReservedThroughputDetails reserved_throughput_details = 1;
108
- TableOptions table_options = 2;
101
+ required ReservedThroughputDetails reserved_throughput_details = 1;
102
+ required TableOptions table_options = 2;
109
103
  }
110
104
  /* ######################################################################################################### */
111
105
 
112
106
  /* ############################################# DescribeTable ############################################# */
113
107
  message DescribeTableRequest {
114
- string table_name = 1;
108
+ required string table_name = 1;
115
109
  }
116
110
 
117
111
  message DescribeTableResponse {
118
- TableMeta table_meta = 1;
119
- ReservedThroughputDetails reserved_throughput_details = 2;
120
- TableOptions table_options = 3;
112
+ required TableMeta table_meta = 1;
113
+ required ReservedThroughputDetails reserved_throughput_details = 2;
114
+ required TableOptions table_options = 3;
121
115
  repeated bytes shard_splits = 6;
122
116
  }
123
117
  /* ########################################################################################################### */
@@ -137,7 +131,7 @@ message ListTableResponse {
137
131
 
138
132
  /* ############################################# DeleteTable ############################################# */
139
133
  message DeleteTableRequest {
140
- string table_name = 1;
134
+ required string table_name = 1;
141
135
  }
142
136
 
143
137
  message DeleteTableResponse {
@@ -146,7 +140,7 @@ message DeleteTableResponse {
146
140
 
147
141
  /* ############################################# LoadTable ############################################# */
148
142
  message LoadTableRequest {
149
- string table_name = 1;
143
+ required string table_name = 1;
150
144
  }
151
145
 
152
146
  message LoadTableResponse {
@@ -155,7 +149,7 @@ message LoadTableResponse {
155
149
 
156
150
  /* ############################################# UnloadTable ############################################# */
157
151
  message UnloadTableRequest {
158
- string table_name = 1;
152
+ required string table_name = 1;
159
153
  }
160
154
 
161
155
  message UnloadTableResponse {
@@ -169,9 +163,9 @@ message UnloadTableResponse {
169
163
  * 2. 若要查询一个特定时间戳,则指定specific_time
170
164
  */
171
165
  message TimeRange {
172
- int64 start_time = 1;
173
- int64 end_time = 2;
174
- int64 specific_time = 3;
166
+ optional int64 start_time = 1;
167
+ optional int64 end_time = 2;
168
+ optional int64 specific_time = 3;
175
169
  }
176
170
 
177
171
  /* ############################################# GetRow ############################################# */
@@ -182,7 +176,7 @@ enum ReturnType {
182
176
  }
183
177
 
184
178
  message ReturnContent {
185
- ReturnType return_type = 1;
179
+ optional ReturnType return_type = 1;
186
180
  }
187
181
 
188
182
  /**
@@ -190,35 +184,35 @@ message ReturnContent {
190
184
  * 2. 目前暂不支持行内的断点
191
185
  */
192
186
  message GetRowRequest {
193
- string table_name = 1;
194
- bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
187
+ required string table_name = 1;
188
+ required bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
195
189
  repeated string columns_to_get = 3; // 不指定则读出所有的列
196
- TimeRange time_range = 4;
197
- int32 max_versions = 5;
198
- bytes filter = 7;
199
- string start_column = 8;
200
- string end_column = 9;
201
- bytes token = 10;
190
+ optional TimeRange time_range = 4;
191
+ optional int32 max_versions = 5;
192
+ optional bytes filter = 7;
193
+ optional string start_column = 8;
194
+ optional string end_column = 9;
195
+ optional bytes token = 10;
202
196
  }
203
197
 
204
198
  message GetRowResponse {
205
- ConsumedCapacity consumed = 1;
206
- bytes row = 2; // encoded as InplaceRowChangeSet
207
- bytes next_token = 3;
199
+ required ConsumedCapacity consumed = 1;
200
+ required bytes row = 2; // encoded as InplaceRowChangeSet
201
+ optional bytes next_token = 3;
208
202
  }
209
203
  /* #################################################################################################### */
210
204
 
211
205
  /* ############################################# UpdateRow ############################################# */
212
206
  message UpdateRowRequest {
213
- string table_name = 1;
214
- bytes row_change = 2;
215
- Condition condition = 3;
216
- ReturnContent return_content = 4;
207
+ required string table_name = 1;
208
+ required bytes row_change = 2;
209
+ required Condition condition = 3;
210
+ optional ReturnContent return_content = 4;
217
211
  }
218
212
 
219
213
  message UpdateRowResponse {
220
- ConsumedCapacity consumed = 1;
221
- bytes row = 2;
214
+ required ConsumedCapacity consumed = 1;
215
+ optional bytes row = 2;
222
216
  }
223
217
  /* ####################################################################################################### */
224
218
 
@@ -230,15 +224,15 @@ message UpdateRowResponse {
230
224
  * 原因是列都是用统一的结构,该结构本身是带timestamp的,其次强制统一timestamp增强了规范性但是丧失了灵活性,且该规范性没有明显的好处,反而带来了结构的复杂。
231
225
  */
232
226
  message PutRowRequest {
233
- string table_name = 1;
234
- bytes row = 2; // encoded as InplaceRowChangeSet
235
- Condition condition = 3;
236
- ReturnContent return_content = 4;
227
+ required string table_name = 1;
228
+ required bytes row = 2; // encoded as InplaceRowChangeSet
229
+ required Condition condition = 3;
230
+ optional ReturnContent return_content = 4;
237
231
  }
238
232
 
239
233
  message PutRowResponse {
240
- ConsumedCapacity consumed = 1;
241
- bytes row = 2; // encoded as InplaceRowChangeSet
234
+ required ConsumedCapacity consumed = 1;
235
+ optional bytes row = 2; // encoded as InplaceRowChangeSet
242
236
  }
243
237
  /* #################################################################################################### */
244
238
 
@@ -248,29 +242,29 @@ message PutRowResponse {
248
242
  * 1. 删除所有列的所有小于等于某个版本的所有版本
249
243
  */
250
244
  message DeleteRowRequest {
251
- string table_name = 1;
252
- bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
253
- Condition condition = 3;
254
- ReturnContent return_content = 4;
245
+ required string table_name = 1;
246
+ required bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
247
+ required Condition condition = 3;
248
+ optional ReturnContent return_content = 4;
255
249
  }
256
250
 
257
251
  message DeleteRowResponse {
258
- ConsumedCapacity consumed = 1;
259
- bytes row = 2;
252
+ required ConsumedCapacity consumed = 1;
253
+ optional bytes row = 2;
260
254
  }
261
255
  /* ####################################################################################################### */
262
256
 
263
257
  /* ############################################# BatchGetRow ############################################# */
264
258
  message TableInBatchGetRowRequest {
265
- string table_name = 1;
259
+ required string table_name = 1;
266
260
  repeated bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
267
261
  repeated bytes token = 3;
268
262
  repeated string columns_to_get = 4; // 不指定则读出所有的列
269
- TimeRange time_range = 5;
270
- int32 max_versions = 6;
271
- bytes filter = 8;
272
- string start_column = 9;
273
- string end_column = 10;
263
+ optional TimeRange time_range = 5;
264
+ optional int32 max_versions = 6;
265
+ optional bytes filter = 8;
266
+ optional string start_column = 9;
267
+ optional string end_column = 10;
274
268
  }
275
269
 
276
270
  message BatchGetRowRequest {
@@ -278,15 +272,15 @@ message BatchGetRowRequest {
278
272
  }
279
273
 
280
274
  message RowInBatchGetRowResponse {
281
- bool is_ok = 1;
282
- Error error = 2;
283
- ConsumedCapacity consumed = 3;
284
- bytes row = 4; // encoded as InplaceRowChangeSet
285
- bytes next_token = 5;
275
+ required bool is_ok = 1;
276
+ optional Error error = 2;
277
+ optional ConsumedCapacity consumed = 3;
278
+ optional bytes row = 4; // encoded as InplaceRowChangeSet
279
+ optional bytes next_token = 5;
286
280
  }
287
281
 
288
282
  message TableInBatchGetRowResponse {
289
- string table_name = 1;
283
+ required string table_name = 1;
290
284
  repeated RowInBatchGetRowResponse rows = 2;
291
285
  }
292
286
 
@@ -298,21 +292,20 @@ message BatchGetRowResponse {
298
292
  /* ############################################# BatchWriteRow ############################################# */
299
293
 
300
294
  enum OperationType {
301
- POST = 0;
302
295
  PUT = 1;
303
296
  UPDATE = 2;
304
297
  DELETE = 3;
305
298
  }
306
299
 
307
300
  message RowInBatchWriteRowRequest {
308
- OperationType type = 1;
309
- bytes row_change = 2; // encoded as InplaceRowChangeSet
310
- Condition condition = 3;
311
- ReturnContent return_content = 4;
301
+ required OperationType type = 1;
302
+ required bytes row_change = 2; // encoded as InplaceRowChangeSet
303
+ required Condition condition = 3;
304
+ optional ReturnContent return_content = 4;
312
305
  }
313
306
 
314
307
  message TableInBatchWriteRowRequest {
315
- string table_name = 1;
308
+ required string table_name = 1;
316
309
  repeated RowInBatchWriteRowRequest rows = 2;
317
310
  }
318
311
 
@@ -321,14 +314,14 @@ message BatchWriteRowRequest {
321
314
  }
322
315
 
323
316
  message RowInBatchWriteRowResponse {
324
- bool is_ok = 1;
325
- Error error = 2;
326
- ConsumedCapacity consumed = 3;
327
- bytes row = 4; // encoded as InplaceRowChangeSet
317
+ required bool is_ok = 1;
318
+ optional Error error = 2;
319
+ optional ConsumedCapacity consumed = 3;
320
+ optional bytes row = 4; // encoded as InplaceRowChangeSet
328
321
  }
329
322
 
330
323
  message TableInBatchWriteRowResponse {
331
- string table_name = 1;
324
+ required string table_name = 1;
332
325
  repeated RowInBatchWriteRowResponse rows = 2;
333
326
  }
334
327
 
@@ -350,25 +343,25 @@ enum Direction {
350
343
  * 我们只支持给同版本的选择条件。
351
344
  */
352
345
  message GetRangeRequest {
353
- string table_name = 1;
354
- Direction direction = 2;
346
+ required string table_name = 1;
347
+ required Direction direction = 2;
355
348
  repeated string columns_to_get = 3; // 不指定则读出所有的列
356
- TimeRange time_range = 4;
357
- int32 max_versions = 5;
358
- int32 limit = 6;
359
- bytes inclusive_start_primary_key = 7; // encoded as InplaceRowChangeSet, but only has primary key
360
- bytes exclusive_end_primary_key = 8; // encoded as InplaceRowChangeSet, but only has primary key
361
- bytes filter = 10;
362
- string start_column = 11;
363
- string end_column = 12;
364
- bytes token = 13;
349
+ optional TimeRange time_range = 4;
350
+ optional int32 max_versions = 5;
351
+ optional int32 limit = 6;
352
+ required bytes inclusive_start_primary_key = 7; // encoded as InplaceRowChangeSet, but only has primary key
353
+ required bytes exclusive_end_primary_key = 8; // encoded as InplaceRowChangeSet, but only has primary key
354
+ optional bytes filter = 10;
355
+ optional string start_column = 11;
356
+ optional string end_column = 12;
357
+ optional bytes token = 13;
365
358
  }
366
359
 
367
360
  message GetRangeResponse {
368
- ConsumedCapacity consumed = 1;
369
- bytes rows = 2; // encoded as InplaceRowChangeSet
370
- bytes next_start_primary_key = 3; // 若为空,则代表数据全部读取完毕. encoded as InplaceRowChangeSet, but only has primary key
371
- bytes next_token = 4;
361
+ required ConsumedCapacity consumed = 1;
362
+ required bytes rows = 2; // encoded as InplaceRowChangeSet
363
+ optional bytes next_start_primary_key = 3; // 若为空,则代表数据全部读取完毕. encoded as InplaceRowChangeSet, but only has primary key
364
+ optional bytes next_token = 4;
372
365
  }
373
366
  /* ###################################################################################################### */
374
367
 
@@ -0,0 +1,96 @@
1
+ ### Generated by rprotoc. DO NOT EDIT!
2
+ ### <proto file: table_store_filiter.proto>
3
+ #
4
+ # enum FilterType {
5
+ # FT_SINGLE_COLUMN_VALUE = 1;
6
+ # FT_COMPOSITE_COLUMN_VALUE = 2;
7
+ # FT_COLUMN_PAGINATION = 3;
8
+ # }
9
+ #
10
+ # enum ComparatorType {
11
+ # CT_EQUAL = 1;
12
+ # CT_NOT_EQUAL = 2;
13
+ # CT_GREATER_THAN = 3;
14
+ # CT_GREATER_EQUAL = 4;
15
+ # CT_LESS_THAN = 5;
16
+ # CT_LESS_EQUAL = 6;
17
+ # }
18
+ #
19
+ # message SingleColumnValueFilter {
20
+ # required ComparatorType comparator = 1;
21
+ # required string column_name = 2;
22
+ # required bytes column_value = 3; // Serialized SQLVariant
23
+ # required bool filter_if_missing = 4;
24
+ # required bool latest_version_only = 5;
25
+ # }
26
+ #
27
+ # enum LogicalOperator {
28
+ # LO_NOT = 1;
29
+ # LO_AND = 2;
30
+ # LO_OR = 3;
31
+ # }
32
+ #
33
+ # message CompositeColumnValueFilter {
34
+ # required LogicalOperator combinator = 1;
35
+ # repeated Filter sub_filters = 2;
36
+ # }
37
+ #
38
+ # message ColumnPaginationFilter {
39
+ # required int32 offset = 1;
40
+ # required int32 limit = 2;
41
+ # }
42
+ #
43
+ # message Filter {
44
+ # required FilterType type = 1;
45
+ # required bytes filter = 2; // Serialized string of filter of the type
46
+ # }
47
+
48
+ require 'protobuf/message/message'
49
+ require 'protobuf/message/enum'
50
+ require 'protobuf/message/service'
51
+ require 'protobuf/message/extend'
52
+
53
+ class FilterType < ::Protobuf::Enum
54
+ defined_in __FILE__
55
+ FT_SINGLE_COLUMN_VALUE = value(:FT_SINGLE_COLUMN_VALUE, 1)
56
+ FT_COMPOSITE_COLUMN_VALUE = value(:FT_COMPOSITE_COLUMN_VALUE, 2)
57
+ FT_COLUMN_PAGINATION = value(:FT_COLUMN_PAGINATION, 3)
58
+ end
59
+ class ComparatorType < ::Protobuf::Enum
60
+ defined_in __FILE__
61
+ CT_EQUAL = value(:CT_EQUAL, 1)
62
+ CT_NOT_EQUAL = value(:CT_NOT_EQUAL, 2)
63
+ CT_GREATER_THAN = value(:CT_GREATER_THAN, 3)
64
+ CT_GREATER_EQUAL = value(:CT_GREATER_EQUAL, 4)
65
+ CT_LESS_THAN = value(:CT_LESS_THAN, 5)
66
+ CT_LESS_EQUAL = value(:CT_LESS_EQUAL, 6)
67
+ end
68
+ class SingleColumnValueFilter < ::Protobuf::Message
69
+ defined_in __FILE__
70
+ required :ComparatorType, :comparator, 1
71
+ required :string, :column_name, 2
72
+ required :bytes, :column_value, 3
73
+ required :bool, :filter_if_missing, 4
74
+ required :bool, :latest_version_only, 5
75
+ end
76
+ class LogicalOperator < ::Protobuf::Enum
77
+ defined_in __FILE__
78
+ LO_NOT = value(:LO_NOT, 1)
79
+ LO_AND = value(:LO_AND, 2)
80
+ LO_OR = value(:LO_OR, 3)
81
+ end
82
+ class CompositeColumnValueFilter < ::Protobuf::Message
83
+ defined_in __FILE__
84
+ required :LogicalOperator, :combinator, 1
85
+ repeated :Filter, :sub_filters, 2
86
+ end
87
+ class ColumnPaginationFilter < ::Protobuf::Message
88
+ defined_in __FILE__
89
+ required :int32, :offset, 1
90
+ required :int32, :limit, 2
91
+ end
92
+ class Filter < ::Protobuf::Message
93
+ defined_in __FILE__
94
+ required :FilterType, :type, 1
95
+ required :bytes, :filter, 2
96
+ end