Skip to content

Commit 475b0b8

Browse files
committed
proto: add FindRange, FindSpace and UpdateRanges
This patch adds three new internal RPCs: 1. FindSpace looks up a space in the space cache and returns its definition if the space is found. 2. FindRange looks up a range in the range cache and returns its description if the range is found. 3. UpdateCache updates the space and range caches on the server. Needed for tarantool/aeon#313
1 parent 3f438f2 commit 475b0b8

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

aeon_internal.proto

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ syntax = "proto3";
22

33
import "aeon_error.proto";
44
import "aeon_value.proto";
5+
import "aeon_schema.proto";
56

67
package aeon;
78

89
// Internal API to Aeon - a distributed database based on Tarantool.
910
service InternalService {
1011
// Get the gRPC server sideservice configuration.
1112
rpc GetConfig(GetConfigRequest) returns (GetConfigResponse) {}
13+
// Find space by name in space cache.
14+
rpc FindSpace(FindSpaceRequest) returns (FindSpaceResponse) {}
15+
// Find range by space name and a key in range cache.
16+
rpc FindRange(FindRangeRequest) returns (FindRangeResponse) {}
17+
// Update space cache.
18+
rpc UpdateCache(UpdateCacheRequest) returns (UpdateCacheResponse) {}
1219
}
1320

1421
// Get the gRPC server sideservice configuration.
@@ -44,3 +51,68 @@ message GetConfigResponse {
4451
// The gRPC server sideservice configuration.
4552
Config config = 2;
4653
}
54+
55+
// Find space by name in space cache.
56+
57+
message FindSpaceRequest {
58+
// Name of the space to find.
59+
string name = 1;
60+
}
61+
62+
message FindSpaceResponse {
63+
// Error information. Set only on failure.
64+
Error error = 1;
65+
// Definition of the found space.
66+
SpaceDef space = 2;
67+
}
68+
69+
// Find range by space name and a key in range cache.
70+
71+
// Description of a range.
72+
message Range {
73+
// The range ID.
74+
string id = 1;
75+
// The shard where the range is located.
76+
string shard = 2;
77+
// The space to which the range belongs.
78+
string space = 3;
79+
// Raw format of the space.
80+
Value format = 4;
81+
// Raw key definition of the space.
82+
Value key_def = 5;
83+
// Minimum key of the range.
84+
Tuple begin = 6;
85+
// Supremum key of the range, not included into the range.
86+
Tuple end = 7;
87+
// The state of the range.
88+
string state = 8;
89+
// The epoch of the range.
90+
uint64 epoch = 9;
91+
// The timestamp of the last change to the range.
92+
uint64 timestamp = 10;
93+
// The context of the range.
94+
Value context = 11;
95+
}
96+
97+
message FindRangeRequest {
98+
// The name of the space in which to search for the range.
99+
string space = 1;
100+
// Key from the range.
101+
Tuple key = 2;
102+
}
103+
104+
message FindRangeResponse {
105+
// Error information. Set only on failure.
106+
Error error = 1;
107+
// Description of the found range.
108+
Range range = 2;
109+
}
110+
111+
// Update space and range caches.
112+
113+
message UpdateCacheRequest {}
114+
115+
message UpdateCacheResponse {
116+
// Error information. Set only on failure.
117+
Error error = 1;
118+
}

aeon_schema.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,13 @@ message KeyPartDef {
8484
// Sorting order: ascending (default) or descending.
8585
KeyPartSortOrder sort_order = 4;
8686
}
87+
88+
// Space definition.
89+
message SpaceDef {
90+
// Name of the space.
91+
string name = 1;
92+
// Format of the space.
93+
repeated FieldDef format = 2;
94+
// Key definition of the space.
95+
repeated KeyPartDef key_def = 3;
96+
}

0 commit comments

Comments
 (0)