11syntax = "proto3" ;
22
3- package aeon_router ;
3+ import "aeon_error.proto" ;
4+ import "aeon_value.proto" ;
5+ import "aeon_schema.proto" ;
46
5- option go_package = "./pb" ;
7+ package aeon ;
68
7- // API to Aeon - a distributed database based on Tarantool.
8- service AeonRouterService {
9- //
10- // Diagnostic requests.
11- //
12-
13- // Pings the router.
14- rpc Ping (PingRequest ) returns (PingResponse ) {}
15-
16- //
17- // DDL requests.
18- //
9+ option go_package = "github.com/tarantool/aeon/aeon/grpc/server/pb" ;
1910
20- // Creates a space with the given definition.
21- rpc CreateSpace (CreateSpaceRequest ) returns (CreateSpaceResponse ) {}
22-
23- // Drops a space by name.
24- rpc DropSpace (DropSpaceRequest ) returns (DropSpaceResponse ) {}
25-
26- //
27- // DML requests.
28- //
11+ // ATTENTION: This module is EXPERIMENTAL and we do not recommend using it.
2912
13+ // CRUD API to Aeon - a distributed database based on Tarantool.
14+ service CRUDService {
3015 // Transactionally executes a set of read and write operations.
3116 rpc Execute (ExecuteRequest ) returns (ExecuteResponse ) {}
3217
@@ -47,222 +32,6 @@ service AeonRouterService {
4732
4833 // Non-transactionally select tuples from a space.
4934 rpc Select (SelectRequest ) returns (stream SelectResponse ) {}
50-
51- //
52- // SQL requests.
53- //
54-
55- // Execute a SQL query.
56- rpc SQL (SQLRequest ) returns (SQLResponse ) {}
57-
58- // Execute a SQL query and return the result using a stream.
59- rpc SQLStream (SQLRequest ) returns (stream SQLResponse ) {}
60-
61- // Check if an SQL is valid
62- // We provide the method for database CLI.
63- rpc SQLCheck (SQLRequest ) returns (SQLCheckResponse ) {}
64- }
65-
66- //
67- // Common structures.
68- //
69-
70- // Special value denoting null.
71- enum NullValue { NULL_VALUE = 0 ; }
72-
73- // Array of arbitrary-typed values.
74- message ArrayValue { repeated Value fields = 1 ; }
75-
76- // Map with string keys and arbitrary-typed values..
77- message MapValue { map <string , Value > fields = 1 ; }
78-
79- // Date time value.
80- message DateTimeValue {
81- int64 seconds = 1 ;
82- int64 nsec = 2 ;
83- string location = 3 ;
84- }
85-
86- // Date time interval value.
87- message IntervalValue {
88- enum IntervalAdjust {
89- INTERVAL_ADJUST_NONE = 0 ;
90- INTERVAL_ADJUST_EXCESS = 1 ;
91- INTERVAL_ADJUST_LAST = 2 ;
92- }
93- int64 year = 1 ;
94- int64 month = 2 ;
95- int64 week = 3 ;
96- int64 day = 4 ;
97- int64 hour = 5 ;
98- int64 min = 6 ;
99- int64 sec = 7 ;
100- int64 nsec = 8 ;
101- IntervalAdjust adjust = 9 ;
102- }
103-
104- // Arbitrary value that can be serialized to be sent over the network or
105- // stored in the database.
106- message Value {
107- oneof kind {
108- uint64 unsigned_value = 1 ;
109- string string_value = 2 ;
110- double number_value = 3 ;
111- sint64 integer_value = 4 ;
112- bool boolean_value = 5 ;
113- bytes varbinary_value = 6 ;
114- string decimal_value = 7 ;
115- string uuid_value = 8 ;
116- DateTimeValue datetime_value = 9 ;
117- IntervalValue interval_value = 10 ;
118- ArrayValue array_value = 11 ;
119- MapValue map_value = 12 ;
120- NullValue null_value = 13 ;
121- }
122- }
123-
124- // Error information.
125- message Error {
126- // Error type.
127- // * AeonError for core Aeon errors.
128- // * AeonSQLError for issues with SQL parsing.
129- // * AeonGRPCError for issues with gRPC encoding.
130- string type = 1 ;
131- // Error name.
132- string name = 2 ;
133- // Error location: file, line.
134- string file = 3 ;
135- uint64 line = 4 ;
136- // Human-readable error description.
137- string msg = 5 ;
138- // System errno (usually not set).
139- uint64 errno = 6 ;
140- // Error code.
141- uint64 code = 7 ;
142- // Fields with extra information.
143- MapValue fields = 8 ;
144- // Previous error on the error stack (cause of this error).
145- Error prev = 9 ;
146- }
147-
148- // Tuple: array of values.
149- message Tuple { repeated Value fields = 1 ; }
150-
151- // Tuple format: array of field names.
152- message TupleFormat { repeated string names = 1 ; }
153-
154- // Read or write operation executed in a transaction.
155- message Operation {
156- // Target space name.
157- string space = 1 ;
158- // Target key in the space. Must be full (have all defined key parts).
159- Tuple key = 2 ;
160- // In a request:
161- // * Ignored for read operations.
162- // * Specifies the tuple to write in a write operation.
163- // In a response:
164- // * Tuple read from or written to the target space.
165- // The write operation type depends on the tuple value:
166- // * NOP if the tuple is not set.
167- // * DELETE if the tuple is set but has no fields.
168- // * REPLACE otherwise. The tuple must match the target key.
169- // The tuple may be overwritten by the user-defined function specified in
170- // a request to change the written value or even operation type depending on
171- // read values.
172- Tuple tuple = 3 ;
173- }
174-
175- // Type a space field can have.
176- enum FieldType {
177- FIELD_TYPE_UNSPECIFIED = 0 ;
178- FIELD_TYPE_ANY = 1 ;
179- FIELD_TYPE_UNSIGNED = 2 ;
180- FIELD_TYPE_STRING = 3 ;
181- FIELD_TYPE_NUMBER = 4 ;
182- FIELD_TYPE_DOUBLE = 5 ;
183- FIELD_TYPE_INTEGER = 6 ;
184- FIELD_TYPE_BOOLEAN = 7 ;
185- FIELD_TYPE_VARBINARY = 8 ;
186- FIELD_TYPE_SCALAR = 9 ;
187- FIELD_TYPE_DECIMAL = 10 ;
188- FIELD_TYPE_UUID = 11 ;
189- FIELD_TYPE_DATETIME = 12 ;
190- FIELD_TYPE_INTERVAL = 13 ;
191- FIELD_TYPE_ARRAY = 14 ;
192- FIELD_TYPE_MAP = 15 ;
193- }
194-
195- // Space field definition.
196- message FieldDef {
197- // Field name.
198- string name = 1 ;
199- // Field type.
200- FieldType type = 2 ;
201- // If set to true, the field may store null values. Optional.
202- bool is_nullable = 3 ;
203- }
204-
205- // Key part definition.
206- message KeyPartDef {
207- enum KeyPartSortOrder {
208- KEY_PART_SORT_ORDER_ASC = 0 ;
209- KEY_PART_SORT_ORDER_DESC = 1 ;
210- }
211- // Indexed field ordinal number (1-based) or name.
212- oneof field {
213- uint64 id = 1 ;
214- string name = 2 ;
215- }
216- // Key part type. Optional: if omitted, it will be deduced from
217- // the corresponding space field type.
218- FieldType type = 3 ;
219- // Sorting order: ascending (default) or descending.
220- KeyPartSortOrder sort_order = 4 ;
221- }
222-
223- //
224- // Diagnostic requests.
225- //
226-
227- // Pings the router.
228-
229- message PingRequest {}
230-
231- message PingResponse {
232- // Error information. Set only on failure.
233- Error error = 1 ;
234- }
235-
236- //
237- // DDL requests.
238- //
239-
240- // Creates a space with the given definition.
241-
242- message CreateSpaceRequest {
243- // Name of the new space.
244- string name = 1 ;
245- // Format of the new space.
246- repeated FieldDef format = 2 ;
247- // Sorting key definition (indexed fields).
248- repeated KeyPartDef key_def = 3 ;
249- }
250-
251- message CreateSpaceResponse {
252- // Error information. Set only on failure.
253- Error error = 1 ;
254- }
255-
256- // Drops a space by name.
257-
258- message DropSpaceRequest {
259- // Name of the space to drop.
260- string name = 1 ;
261- }
262-
263- message DropSpaceResponse {
264- // Error information. Set only on failure.
265- Error error = 1 ;
26635}
26736
26837//
@@ -496,31 +265,3 @@ message SelectResponse {
496265 // Format of the returned tuples.
497266 TupleFormat tuple_format = 8 ;
498267}
499-
500- //
501- // SQL requests.
502- //
503-
504- message SQLRequest {
505- // SQL query.
506- string query = 1 ;
507- // Bind variables.
508- map <string , Value > vars = 2 ;
509- }
510-
511- message SQLResponse {
512- // Error information. Set only on failure.
513- Error error = 1 ;
514- // Retrieved tuples.
515- repeated Tuple tuples = 2 ;
516- // Format of the returned tuples.
517- TupleFormat tuple_format = 3 ;
518- }
519-
520- enum SQLCheckStatus {
521- SQL_QUERY_VALID = 0 ;
522- SQL_QUERY_INCOMPLETE = 1 ;
523- SQL_QUERY_INVALID = 2 ;
524- }
525-
526- message SQLCheckResponse { SQLCheckStatus status = 1 ; }
0 commit comments