开发者社区> 问答> 正文

表格存储 ProtocolBuffer 消息定义(二)

/**
* 时间戳的取值最小值为0,最大值为INT64.MAX
* 1. 若要查询一个范围,则指定start_time和end_time
* 2. 若要查询一个特定时间戳,则指定specific_time
*/
message TimeRange {
    optional int64 start_time = 1;
    optional int64 end_time = 2;
    optional int64 specific_time = 3;
}
/* #############################################  GetRow  ############################################# */
enum ReturnType {
    RT_NONE = 0;
    RT_PK = 1;
}
message ReturnContent {
    optional ReturnType return_type = 1;
}
/**
* 1. 支持用户指定版本时间戳范围或者特定的版本时间来读取指定版本的列
* 2. 目前暂不支持行内的断点
*/
message GetRowRequest {
    required string table_name = 1;
    required bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
    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;
}
message GetRowResponse {
    required ConsumedCapacity consumed = 1;
    required bytes row = 2; // encoded as InplaceRowChangeSet
    optional bytes next_token = 3;
}
/* #################################################################################################### */
/* #############################################  UpdateRow  ############################################# */
message UpdateRowRequest {
    required string table_name = 1;
    required bytes row_change = 2;
    required Condition condition = 3;
    optional ReturnContent return_content = 4;
}
message UpdateRowResponse {
    required ConsumedCapacity consumed = 1;
    optional bytes row = 2;
}
/* ####################################################################################################### */
/* #############################################  PutRow  ############################################# */
/**
* 这里允许用户为每列单独设置timestamp,而不是强制整行统一一个timestamp。
*/
message PutRowRequest {
    required string table_name = 1;
    required bytes row = 2; // encoded as InplaceRowChangeSet
    required Condition condition = 3;
    optional ReturnContent return_content = 4;
}
message PutRowResponse {
    required ConsumedCapacity consumed = 1;
    optional bytes row = 2;
}
/* #################################################################################################### */
/* #############################################  DeleteRow  ############################################# */
/**
* OTS只支持删除该行的所有列所有版本,不支持:
*  1. 删除所有列的所有小于等于某个版本的所有版本
*/
message DeleteRowRequest {
    required string table_name = 1;
    required bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
    required Condition condition = 3;
    optional ReturnContent return_content = 4;
}
message DeleteRowResponse {
    required ConsumedCapacity consumed = 1;
    optional bytes row = 2;
}
/* ####################################################################################################### */
/* #############################################  BatchGetRow  ############################################# */
message TableInBatchGetRowRequest {
    required string table_name = 1;
    repeated bytes primary_key = 2; // encoded as InplaceRowChangeSet, but only has primary key
    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; // encoded as InplaceRowChangeSet
    optional bytes next_token = 5;
}
message TableInBatchGetRowResponse {
    required string table_name = 1;
    repeated RowInBatchGetRowResponse rows = 2;
}
message BatchGetRowResponse {
    repeated TableInBatchGetRowResponse tables = 1;
}


展开
收起
云栖大讲堂 2017-10-25 14:28:28 1875 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
TableStore在社交类场景下的应用 立即下载
表格存储实时数据流Steam的技术揭秘和应用场景 立即下载
表格存储(TableStore) 立即下载