-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This splits the proto file into three files: aeon_sql.proto, aeon_crud.proto, and aeon_common.proto. This patch also adds a warning that CRUD operations are experimental. Closes #2
- Loading branch information
Showing
3 changed files
with
235 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
syntax = "proto3"; | ||
|
||
package aeon; | ||
|
||
option go_package = "./pb"; | ||
|
||
// Common API to Aeon - a distributed database based on Tarantool. | ||
service CommonService { | ||
// | ||
// Diagnostic requests. | ||
// | ||
|
||
// Pings the router. | ||
rpc Ping(PingRequest) returns (PingResponse) {} | ||
} | ||
|
||
// | ||
// Common structures. | ||
// | ||
|
||
// Special value denoting null. | ||
enum NullValue { NULL_VALUE = 0; } | ||
|
||
// Array of arbitrary-typed values. | ||
message ArrayValue { repeated Value fields = 1; } | ||
|
||
// Map with string keys and arbitrary-typed values.. | ||
message MapValue { map<string, Value> fields = 1; } | ||
|
||
// Date time value. | ||
message DateTimeValue { | ||
int64 seconds = 1; | ||
int64 nsec = 2; | ||
string location = 3; | ||
} | ||
|
||
// Date time interval value. | ||
message IntervalValue { | ||
enum IntervalAdjust { | ||
INTERVAL_ADJUST_NONE = 0; | ||
INTERVAL_ADJUST_EXCESS = 1; | ||
INTERVAL_ADJUST_LAST = 2; | ||
} | ||
int64 year = 1; | ||
int64 month = 2; | ||
int64 week = 3; | ||
int64 day = 4; | ||
int64 hour = 5; | ||
int64 min = 6; | ||
int64 sec = 7; | ||
int64 nsec = 8; | ||
IntervalAdjust adjust = 9; | ||
} | ||
|
||
// Arbitrary value that can be serialized to be sent over the network or | ||
// stored in the database. | ||
message Value { | ||
oneof kind { | ||
uint64 unsigned_value = 1; | ||
string string_value = 2; | ||
double number_value = 3; | ||
sint64 integer_value = 4; | ||
bool boolean_value = 5; | ||
bytes varbinary_value = 6; | ||
string decimal_value = 7; | ||
string uuid_value = 8; | ||
DateTimeValue datetime_value = 9; | ||
IntervalValue interval_value = 10; | ||
ArrayValue array_value = 11; | ||
MapValue map_value = 12; | ||
NullValue null_value = 13; | ||
} | ||
} | ||
|
||
// Error information. | ||
message Error { | ||
// Error type. | ||
// * AeonError for core Aeon errors. | ||
// * AeonSQLError for issues with SQL parsing. | ||
// * AeonGRPCError for issues with gRPC encoding. | ||
string type = 1; | ||
// Error name. | ||
string name = 2; | ||
// Error location: file, line. | ||
string file = 3; | ||
uint64 line = 4; | ||
// Human-readable error description. | ||
string msg = 5; | ||
// System errno (usually not set). | ||
uint64 errno = 6; | ||
// Error code. | ||
uint64 code = 7; | ||
// Fields with extra information. | ||
MapValue fields = 8; | ||
// Previous error on the error stack (cause of this error). | ||
Error prev = 9; | ||
} | ||
|
||
// Tuple: array of values. | ||
message Tuple { repeated Value fields = 1; } | ||
|
||
// Tuple format: array of field names. | ||
message TupleFormat { repeated string names = 1; } | ||
|
||
// Read or write operation executed in a transaction. | ||
message Operation { | ||
// Target space name. | ||
string space = 1; | ||
// Target key in the space. Must be full (have all defined key parts). | ||
Tuple key = 2; | ||
// In a request: | ||
// * Ignored for read operations. | ||
// * Specifies the tuple to write in a write operation. | ||
// In a response: | ||
// * Tuple read from or written to the target space. | ||
// The write operation type depends on the tuple value: | ||
// * NOP if the tuple is not set. | ||
// * DELETE if the tuple is set but has no fields. | ||
// * REPLACE otherwise. The tuple must match the target key. | ||
// The tuple may be overwritten by the user-defined function specified in | ||
// a request to change the written value or even operation type depending on | ||
// read values. | ||
Tuple tuple = 3; | ||
} | ||
|
||
// Type a space field can have. | ||
enum FieldType { | ||
FIELD_TYPE_UNSPECIFIED = 0; | ||
FIELD_TYPE_ANY = 1; | ||
FIELD_TYPE_UNSIGNED = 2; | ||
FIELD_TYPE_STRING = 3; | ||
FIELD_TYPE_NUMBER = 4; | ||
FIELD_TYPE_DOUBLE = 5; | ||
FIELD_TYPE_INTEGER = 6; | ||
FIELD_TYPE_BOOLEAN = 7; | ||
FIELD_TYPE_VARBINARY = 8; | ||
FIELD_TYPE_SCALAR = 9; | ||
FIELD_TYPE_DECIMAL = 10; | ||
FIELD_TYPE_UUID = 11; | ||
FIELD_TYPE_DATETIME = 12; | ||
FIELD_TYPE_INTERVAL = 13; | ||
FIELD_TYPE_ARRAY = 14; | ||
FIELD_TYPE_MAP = 15; | ||
} | ||
|
||
// Space field definition. | ||
message FieldDef { | ||
// Field name. | ||
string name = 1; | ||
// Field type. | ||
FieldType type = 2; | ||
// If set to true, the field may store null values. Optional. | ||
bool is_nullable = 3; | ||
} | ||
|
||
// Key part definition. | ||
message KeyPartDef { | ||
enum KeyPartSortOrder { | ||
KEY_PART_SORT_ORDER_ASC = 0; | ||
KEY_PART_SORT_ORDER_DESC = 1; | ||
} | ||
// Indexed field ordinal number (1-based) or name. | ||
oneof field { | ||
uint64 id = 1; | ||
string name = 2; | ||
} | ||
// Key part type. Optional: if omitted, it will be deduced from | ||
// the corresponding space field type. | ||
FieldType type = 3; | ||
// Sorting order: ascending (default) or descending. | ||
KeyPartSortOrder sort_order = 4; | ||
} | ||
|
||
// | ||
// Diagnostic requests. | ||
// | ||
|
||
// Pings the router. | ||
|
||
message PingRequest {} | ||
|
||
message PingResponse { | ||
// Error information. Set only on failure. | ||
Error error = 1; | ||
} |
Oops, something went wrong.