全部产品
存储与CDN 数据库 安全 应用服务 数加·人工智能 数加·大数据基础服务 互联网中间件 视频服务 开发者工具 解决方案 物联网
表格存储

表格存储 ProtocolBuffer 消息定义

更新时间:2017-06-07 13:26:11

下面是table_store.proto和table_store_filter.proto的详细定义。

table_store.proto

  1. package com.alicloud.openservices.tablestore.core.protocol;
  2. message Error {
  3. required string code = 1;
  4. optional string message = 2;
  5. }
  6. enum PrimaryKeyType {
  7. INTEGER = 1;
  8. STRING = 2;
  9. BINARY = 3;
  10. }
  11. enum PrimaryKeyOption {
  12. AUTO_INCREMENT = 1;
  13. }
  14. message PrimaryKeySchema {
  15. required string name = 1;
  16. required PrimaryKeyType type = 2;
  17. optional PrimaryKeyOption option = 3;
  18. }
  19. message TableOptions {
  20. optional int32 time_to_live = 1; // 可以动态更改
  21. optional int32 max_versions = 2; // 可以动态更改
  22. optional int64 deviation_cell_version_in_sec = 5; // 可以动态修改
  23. }
  24. message TableMeta {
  25. required string table_name = 1;
  26. repeated PrimaryKeySchema primary_key = 2;
  27. }
  28. enum RowExistenceExpectation {
  29. IGNORE = 0;
  30. EXPECT_EXIST = 1;
  31. EXPECT_NOT_EXIST = 2;
  32. }
  33. message Condition {
  34. required RowExistenceExpectation row_existence = 1;
  35. optional bytes column_condition = 2;
  36. }
  37. message CapacityUnit {
  38. optional int32 read = 1;
  39. optional int32 write = 2;
  40. }
  41. message ReservedThroughputDetails {
  42. required CapacityUnit capacity_unit = 1; // 表当前的预留吞吐量的值。
  43. required int64 last_increase_time = 2; // 最后一次上调预留吞吐量的时间。
  44. optional int64 last_decrease_time = 3; // 最后一次下调预留吞吐量的时间。
  45. }
  46. message ReservedThroughput {
  47. required CapacityUnit capacity_unit = 1;
  48. }
  49. message ConsumedCapacity {
  50. required CapacityUnit capacity_unit = 1;
  51. }
  52. /* ############################################# CreateTable ############################################# */
  53. /**
  54. * table_meta用于存储表中不可更改的schema属性,可以更改的ReservedThroughput和TableOptions独立出来,作为UpdateTable的参数。
  55. * message CreateTableRequest {
  56. * required TableMeta table_meta = 1;
  57. * required ReservedThroughput reserved_throughput = 2;
  58. * required TableOptions table_options = 3;
  59. * }
  60. */
  61. message CreateTableRequest {
  62. required TableMeta table_meta = 1;
  63. required ReservedThroughput reserved_throughput = 2;
  64. optional TableOptions table_options = 3;
  65. }
  66. message CreateTableResponse {
  67. }
  68. /* ######################################################################################################### */
  69. /* ############################################# UpdateTable ############################################# */
  70. message UpdateTableRequest {
  71. required string table_name = 1;
  72. optional ReservedThroughput reserved_throughput = 2;
  73. optional TableOptions table_options = 3;
  74. }
  75. message UpdateTableResponse {
  76. required ReservedThroughputDetails reserved_throughput_details = 1;
  77. required TableOptions table_options = 2;
  78. }
  79. /* ######################################################################################################### */
  80. /* ############################################# DescribeTable ############################################# */
  81. message DescribeTableRequest {
  82. required string table_name = 1;
  83. }
  84. message DescribeTableResponse {
  85. required TableMeta table_meta = 1;
  86. required ReservedThroughputDetails reserved_throughput_details = 2;
  87. required TableOptions table_options = 3;
  88. repeated bytes shard_splits = 6;
  89. }
  90. /* ########################################################################################################### */
  91. /* ############################################# ListTable ############################################# */
  92. message ListTableRequest {
  93. }
  94. /**
  95. * 当前只返回一个简单的名称列表
  96. */
  97. message ListTableResponse {
  98. repeated string table_names = 1;
  99. }
  100. /* ####################################################################################################### */
  101. /* ############################################# DeleteTable ############################################# */
  102. message DeleteTableRequest {
  103. required string table_name = 1;
  104. }
  105. message DeleteTableResponse {
  106. }
  107. /* ############################################# UnloadTable ############################################# */
  108. message UnloadTableRequest {
  109. required string table_name = 1;
  110. }
  111. message UnloadTableResponse {
  112. }
  113. /* ########################################################################################################## */
  114. /**
  115. * 时间戳的取值最小值为0,最大值为INT64.MAX
  116. * 1. 若要查询一个范围,则指定start_time和end_time
  117. * 2. 若要查询一个特定时间戳,则指定specific_time
  118. */
  119. message TimeRange {
  120. optional int64 start_time = 1;
  121. optional int64 end_time = 2;
  122. optional int64 specific_time = 3;
  123. }
  124. /* ############################################# GetRow ############################################# */
  125. enum ReturnType {
  126. RT_NONE = 0;
  127. RT_PK = 1;
  128. }
  129. message ReturnContent {
  130. optional ReturnType return_type = 1;
  131. }
  132. /**
  133. * 1. 支持用户指定版本时间戳范围或者特定的版本时间来读取指定版本的列
  134. * 2. 目前暂不支持行内的断点
  135. */
  136. message GetRowRequest {
  137. required string table_name = 1;
  138. required bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
  139. repeated string columns_to_get = 3; // 不指定则读出所有的列
  140. optional TimeRange time_range = 4;
  141. optional int32 max_versions = 5;
  142. optional bytes filter = 7;
  143. optional string start_column = 8;
  144. optional string end_column = 9;
  145. optional bytes token = 10;
  146. }
  147. message GetRowResponse {
  148. required ConsumedCapacity consumed = 1;
  149. required bytes row = 2; // encoded as InplaceRowChangeSet
  150. optional bytes next_token = 3;
  151. }
  152. /* #################################################################################################### */
  153. /* ############################################# UpdateRow ############################################# */
  154. message UpdateRowRequest {
  155. required string table_name = 1;
  156. required bytes row_change = 2;
  157. required Condition condition = 3;
  158. optional ReturnContent return_content = 4;
  159. }
  160. message UpdateRowResponse {
  161. required ConsumedCapacity consumed = 1;
  162. optional bytes row = 2;
  163. }
  164. /* ####################################################################################################### */
  165. /* ############################################# PutRow ############################################# */
  166. /**
  167. * 这里允许用户为每列单独设置timestamp,而不是强制整行统一一个timestamp。
  168. */
  169. message PutRowRequest {
  170. required string table_name = 1;
  171. required bytes row = 2; // encoded as InplaceRowChangeSet
  172. required Condition condition = 3;
  173. optional ReturnContent return_content = 4;
  174. }
  175. message PutRowResponse {
  176. required ConsumedCapacity consumed = 1;
  177. optional bytes row = 2;
  178. }
  179. /* #################################################################################################### */
  180. /* ############################################# DeleteRow ############################################# */
  181. /**
  182. * OTS只支持删除该行的所有列所有版本,不支持:
  183. * 1. 删除所有列的所有小于等于某个版本的所有版本
  184. */
  185. message DeleteRowRequest {
  186. required string table_name = 1;
  187. required bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
  188. required Condition condition = 3;
  189. optional ReturnContent return_content = 4;
  190. }
  191. message DeleteRowResponse {
  192. required ConsumedCapacity consumed = 1;
  193. optional bytes row = 2;
  194. }
  195. /* ####################################################################################################### */
  196. /* ############################################# BatchGetRow ############################################# */
  197. message TableInBatchGetRowRequest {
  198. required string table_name = 1;
  199. repeated bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
  200. repeated bytes token = 3;
  201. repeated string columns_to_get = 4; // 不指定则读出所有的列
  202. optional TimeRange time_range = 5;
  203. optional int32 max_versions = 6;
  204. optional bytes filter = 8;
  205. optional string start_column = 9;
  206. optional string end_column = 10;
  207. }
  208. message BatchGetRowRequest {
  209. repeated TableInBatchGetRowRequest tables = 1;
  210. }
  211. message RowInBatchGetRowResponse {
  212. required bool is_ok = 1;
  213. optional Error error = 2;
  214. optional ConsumedCapacity consumed = 3;
  215. optional bytes row = 4; // encoded as InplaceRowChangeSet
  216. optional bytes next_token = 5;
  217. }
  218. message TableInBatchGetRowResponse {
  219. required string table_name = 1;
  220. repeated RowInBatchGetRowResponse rows = 2;
  221. }
  222. message BatchGetRowResponse {
  223. repeated TableInBatchGetRowResponse tables = 1;
  224. }
  225. /* ######################################################################################################### */
  226. /* ############################################# BatchWriteRow ############################################# */
  227. enum OperationType {
  228. PUT = 1;
  229. UPDATE = 2;
  230. DELETE = 3;
  231. }
  232. message RowInBatchWriteRowRequest {
  233. required OperationType type = 1;
  234. required bytes row_change = 2; // encoded as InplaceRowChangeSet
  235. required Condition condition = 3;
  236. optional ReturnContent return_content = 4;
  237. }
  238. message TableInBatchWriteRowRequest {
  239. required string table_name = 1;
  240. repeated RowInBatchWriteRowRequest rows = 2;
  241. }
  242. message BatchWriteRowRequest {
  243. repeated TableInBatchWriteRowRequest tables = 1;
  244. }
  245. message RowInBatchWriteRowResponse {
  246. required bool is_ok = 1;
  247. optional Error error = 2;
  248. optional ConsumedCapacity consumed = 3;
  249. optional bytes row = 4;
  250. }
  251. message TableInBatchWriteRowResponse {
  252. required string table_name = 1;
  253. repeated RowInBatchWriteRowResponse rows = 2;
  254. }
  255. message BatchWriteRowResponse {
  256. repeated TableInBatchWriteRowResponse tables = 1;
  257. }
  258. /* ########################################################################################################### */
  259. /* ############################################# GetRange ############################################# */
  260. enum Direction {
  261. FORWARD = 0;
  262. BACKWARD = 1;
  263. }
  264. message GetRangeRequest {
  265. required string table_name = 1;
  266. required Direction direction = 2;
  267. repeated string columns_to_get = 3; // 不指定则读出所有的列
  268. optional TimeRange time_range = 4;
  269. optional int32 max_versions = 5;
  270. optional int32 limit = 6;
  271. required bytes inclusive_start_primary_key = 7; // encoded as InplaceRowChangeSet, but only has primary key
  272. required bytes exclusive_end_primary_key = 8; // encoded as InplaceRowChangeSet, but only has primary key
  273. optional bytes filter = 10;
  274. optional string start_column = 11;
  275. optional string end_column = 12;
  276. optional bytes token = 13;
  277. }
  278. message GetRangeResponse {
  279. required ConsumedCapacity consumed = 1;
  280. required bytes rows = 2; // encoded as InplaceRowChangeSet
  281. optional bytes next_start_primary_key = 3; // 若为空,则代表数据全部读取完毕. encoded as InplaceRowChangeSet, but only has primary key
  282. optional bytes next_token = 4;
  283. }
  284. /* #################### ComputeSplitPointsBySize #################### */
  285. message ComputeSplitPointsBySizeRequest {
  286. required string table_name = 1;
  287. required int64 split_size = 2; // in 100MB
  288. }
  289. message ComputeSplitPointsBySizeResponse {
  290. required ConsumedCapacity consumed = 1;
  291. repeated PrimaryKeySchema schema = 2;
  292. /**
  293. * Split points between splits, in the increasing order
  294. *
  295. * A split is a consecutive range of primary keys,
  296. * whose data size is about split_size specified in the request.
  297. * The size could be hard to be precise.
  298. *
  299. * A split point is an array of primary-key column w.r.t. table schema,
  300. * which is never longer than that of table schema.
  301. * Tailing -inf will be omitted to reduce transmission payloads.
  302. */
  303. repeated bytes split_points = 3;
  304. /**
  305. * Locations where splits lies in.
  306. *
  307. * By the managed nature of TableStore, these locations are no more than hints.
  308. * If a location is not suitable to be seen, an empty string will be placed.
  309. */
  310. message SplitLocation {
  311. required string location = 1;
  312. required sint64 repeat = 2;
  313. }
  314. repeated SplitLocation locations = 4;
  315. }

table_store_filter.proto

  1. package com.alicloud.openservices.tablestore.core.protocol;
  2. enum FilterType {
  3. FT_SINGLE_COLUMN_VALUE = 1;
  4. FT_COMPOSITE_COLUMN_VALUE = 2;
  5. FT_COLUMN_PAGINATION = 3;
  6. }
  7. enum ComparatorType {
  8. CT_EQUAL = 1;
  9. CT_NOT_EQUAL = 2;
  10. CT_GREATER_THAN = 3;
  11. CT_GREATER_EQUAL = 4;
  12. CT_LESS_THAN = 5;
  13. CT_LESS_EQUAL = 6;
  14. }
  15. message SingleColumnValueFilter {
  16. required ComparatorType comparator = 1;
  17. required string column_name = 2;
  18. required bytes column_value = 3;
  19. required bool filter_if_missing = 4;
  20. required bool latest_version_only = 5;
  21. }
  22. enum LogicalOperator {
  23. LO_NOT = 1;
  24. LO_AND = 2;
  25. LO_OR = 3;
  26. }
  27. message CompositeColumnValueFilter {
  28. required LogicalOperator combinator = 1;
  29. repeated Filter sub_filters = 2;
  30. }
  31. message ColumnPaginationFilter {
  32. required int32 offset = 1;
  33. required int32 limit = 2;
  34. }
  35. message Filter {
  36. required FilterType type = 1;
  37. required bytes filter = 2; // Serialized string of filter of the type
  38. }
本文导读目录