All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.openservices.ots.protocol.ots_protocol.2.proto Maven / Gradle / Ivy

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;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy