TableStore ProtocolBuffer Message Definitions

Last Updated: Oct 11, 2016

  1. package com.aliyun.cloudservice.ots2;
  2. message Error {
  3. required string code = 1;
  4. optional string message = 2;
  5. }
  6. enum ColumnType {
  7. INF_MIN = 0; // only for GetRange
  8. INF_MAX = 1; // only for GetRange
  9. INTEGER = 2;
  10. STRING = 3;
  11. BOOLEAN = 4;
  12. DOUBLE = 5;
  13. BINARY = 6;
  14. }
  15. message ColumnSchema {
  16. required string name = 1;
  17. required ColumnType type = 2;
  18. }
  19. message ColumnValue {
  20. required ColumnType type = 1;
  21. optional int64 v_int = 2;
  22. optional string v_string = 3;
  23. optional bool v_bool = 4;
  24. optional double v_double = 5;
  25. optional bytes v_binary = 6;
  26. }
  27. message Column {
  28. required string name = 1;
  29. required ColumnValue value = 2;
  30. }
  31. message Row {
  32. repeated Column primary_key_columns = 1;
  33. repeated Column attribute_columns = 2;
  34. }
  35. message TableMeta {
  36. required string table_name = 1;
  37. repeated ColumnSchema primary_key = 2;
  38. }
  39. enum RowExistenceExpectation {
  40. IGNORE = 0;
  41. EXPECT_EXIST = 1;
  42. EXPECT_NOT_EXIST = 2;
  43. }
  44. message Condition {
  45. required RowExistenceExpectation row_existence = 1;
  46. }
  47. message CapacityUnit {
  48. optional int32 read = 1;
  49. optional int32 write = 2;
  50. }
  51. message ReservedThroughputDetails {
  52. required CapacityUnit capacity_unit = 1;
  53. required int64 last_increase_time = 2;
  54. optional int64 last_decrease_time = 3;
  55. required int32 number_of_decreases_today = 4;
  56. }
  57. message ReservedThroughput {
  58. required CapacityUnit capacity_unit = 1;
  59. }
  60. message ConsumedCapacity {
  61. required CapacityUnit capacity_unit = 1;
  62. }
  63. /* CreateTable */
  64. message CreateTableRequest {
  65. required TableMeta table_meta = 1;
  66. required ReservedThroughput reserved_throughput = 2;
  67. }
  68. message CreateTableResponse {
  69. }
  70. /* UpdateTable */
  71. message UpdateTableRequest {
  72. required string table_name = 1;
  73. required ReservedThroughput reserved_throughput = 2;
  74. }
  75. message UpdateTableResponse {
  76. required ReservedThroughputDetails reserved_throughput_details = 1;
  77. }
  78. /* DescribeTable */
  79. message DescribeTableRequest {
  80. required string table_name = 1;
  81. }
  82. message DescribeTableResponse {
  83. required TableMeta table_meta = 1;
  84. required ReservedThroughputDetails reserved_throughput_details = 2;
  85. }
  86. /* ListTable */
  87. message ListTableRequest {
  88. }
  89. message ListTableResponse {
  90. repeated string table_names = 1;
  91. }
  92. /* DeleteTable */
  93. message DeleteTableRequest {
  94. required string table_name = 1;
  95. }
  96. message DeleteTableResponse {
  97. }
  98. /* GetRow */
  99. message GetRowRequest {
  100. required string table_name = 1;
  101. repeated Column primary_key = 2;
  102. repeated string columns_to_get = 3;
  103. }
  104. message GetRowResponse {
  105. required ConsumedCapacity consumed = 1;
  106. required Row row = 2;
  107. }
  108. /* UpdateRow */
  109. enum OperationType {
  110. PUT = 1;
  111. DELETE = 2;
  112. }
  113. message ColumnUpdate {
  114. required OperationType type = 1;
  115. required string name = 2;
  116. optional ColumnValue value = 3;
  117. }
  118. message UpdateRowRequest {
  119. required string table_name = 1;
  120. required Condition condition = 2;
  121. repeated Column primary_key = 3;
  122. repeated ColumnUpdate attribute_columns = 4;
  123. }
  124. message UpdateRowResponse {
  125. required ConsumedCapacity consumed = 1;
  126. }
  127. /* PutRow */
  128. message PutRowRequest {
  129. required string table_name = 1;
  130. required Condition condition = 2;
  131. repeated Column primary_key = 3;
  132. repeated Column attribute_columns = 4;
  133. }
  134. message PutRowResponse {
  135. required ConsumedCapacity consumed = 1;
  136. }
  137. /* DeleteRow */
  138. message DeleteRowRequest {
  139. required string table_name = 1;
  140. required Condition condition = 2;
  141. repeated Column primary_key = 3;
  142. }
  143. message DeleteRowResponse {
  144. required ConsumedCapacity consumed = 1;
  145. }
  146. /* BatchGetRow */
  147. message RowInBatchGetRowRequest {
  148. repeated Column primary_key = 1;
  149. }
  150. message TableInBatchGetRowRequest {
  151. required string table_name = 1;
  152. repeated RowInBatchGetRowRequest rows = 2;
  153. repeated string columns_to_get = 3;
  154. }
  155. message BatchGetRowRequest {
  156. repeated TableInBatchGetRowRequest tables = 1;
  157. }
  158. message RowInBatchGetRowResponse {
  159. required bool is_ok = 1 [default = true];
  160. optional Error error = 2;
  161. optional ConsumedCapacity consumed = 3;
  162. optional Row row = 4;
  163. }
  164. message TableInBatchGetRowResponse {
  165. required string table_name = 1;
  166. repeated RowInBatchGetRowResponse rows = 2; // same indices w.r.t. request
  167. }
  168. message BatchGetRowResponse {
  169. repeated TableInBatchGetRowResponse tables = 1; // same indices w.r.t. request
  170. }
  171. /* BatchWriteRow */
  172. message PutRowInBatchWriteRowRequest {
  173. required Condition condition = 1;
  174. repeated Column primary_key = 2;
  175. repeated Column attribute_columns = 3;
  176. }
  177. message UpdateRowInBatchWriteRowRequest {
  178. required Condition condition = 1;
  179. repeated Column primary_key = 2;
  180. repeated ColumnUpdate attribute_columns = 3;
  181. }
  182. message DeleteRowInBatchWriteRowRequest {
  183. required Condition condition = 1;
  184. repeated Column primary_key = 2;
  185. }
  186. message TableInBatchWriteRowRequest {
  187. required string table_name = 1;
  188. repeated PutRowInBatchWriteRowRequest put_rows = 2;
  189. repeated UpdateRowInBatchWriteRowRequest update_rows = 3;
  190. repeated DeleteRowInBatchWriteRowRequest delete_rows = 4;
  191. }
  192. message BatchWriteRowRequest {
  193. repeated TableInBatchWriteRowRequest tables = 1; // same indices w.r.t. request
  194. }
  195. message RowInBatchWriteRowResponse {
  196. required bool is_ok = 1 [default = true];
  197. optional Error error = 2;
  198. optional ConsumedCapacity consumed = 3;
  199. }
  200. message TableInBatchWriteRowResponse {
  201. required string table_name = 1;
  202. repeated RowInBatchWriteRowResponse put_rows = 2; // same indices w.r.t. request
  203. repeated RowInBatchWriteRowResponse update_rows = 3; // same indices w.r.t. request
  204. repeated RowInBatchWriteRowResponse delete_rows = 4; // same indices w.r.t. request
  205. }
  206. message BatchWriteRowResponse {
  207. repeated TableInBatchWriteRowResponse tables = 1;
  208. }
  209. /* GetRange */
  210. enum Direction {
  211. FORWARD = 0;
  212. BACKWARD = 1;
  213. }
  214. message GetRangeRequest {
  215. required string table_name = 1;
  216. required Direction direction = 2;
  217. repeated string columns_to_get = 3;
  218. optional int32 limit = 4;
  219. repeated Column inclusive_start_primary_key = 5; // required all PKs, possibly filled with INF_MIN/INF_MAX
  220. repeated Column exclusive_end_primary_key = 6; // required all PKs, possibly filled with INF_MIN/INF_MAX
  221. }
  222. message GetRangeResponse {
  223. required ConsumedCapacity consumed = 1;
  224. repeated Column next_start_primary_key = 2; // missing means hitting the end
  225. repeated Row rows = 3;
  226. }
Thank you! We've received your feedback.