Skip to content

Commit 444addb

Browse files
Protocol refinements (#208)
## Release notes: usage and product changes 1. Simplify connection open to pre-send database information (reduces 1 round trip on connection open) 2. Standardise `AnswerRow` to `ConceptRow` terminology 3. Type concepts only contain labels and possibly value types, and no annotations (right now)
1 parent b25355a commit 444addb

File tree

7 files changed

+25
-23
lines changed

7 files changed

+25
-23
lines changed

proto/answer.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import "proto/concept.proto";
88

99
package typedb.protocol;
1010

11-
message AnswerRow {
12-
repeated Answer row = 1;
11+
message ConceptRow {
12+
repeated RowEntry row = 1;
1313
// Explainables explainables = 2;
1414
}
1515

16-
message Answer {
17-
oneof answer {
16+
message RowEntry {
17+
oneof entry {
1818
Empty empty = 1;
1919
Concept concept = 2;
2020
Value value = 3;

proto/concept.proto

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ message Value {
9595
}
9696

9797
message Struct {
98-
98+
string struct_type_name = 1;
9999
}
100100
}
101101

@@ -109,25 +109,20 @@ message Type {
109109
}
110110

111111
message RoleType {
112-
string name = 1;
113-
string scope = 2;
114-
repeated Annotation annotations = 3;
112+
string label = 1;
115113
}
116114

117115
message EntityType {
118116
string label = 1;
119-
repeated Annotation annotations = 2;
120117
}
121118

122119
message RelationType {
123120
string label = 1;
124-
repeated Annotation annotations = 2;
125121
}
126122

127123
message AttributeType {
128124
string label = 1;
129125
optional ValueType value_type = 2;
130-
repeated Annotation annotations = 3;
131126
}
132127

133128
message ValueType {

proto/connection.proto

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
syntax = "proto3";
66

77
import "proto/version.proto";
8+
import "proto/database.proto";
89

910
package typedb.protocol;
1011

@@ -18,9 +19,13 @@ message Connection {
1819
}
1920

2021
message Res {
21-
uint64 server_duration_millis = 2;
22-
ConnectionID connection_id = 1;
23-
// also: initial Token
22+
uint64 server_duration_millis = 1;
23+
ConnectionID connection_id = 2;
24+
25+
// TODO: initial Token
26+
27+
// pre-send all databases and replica info
28+
DatabaseManager.All.Res databases_all = 3;
2429
}
2530
}
2631
}

proto/database.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ message DatabaseManager {
3737
message Req {
3838
string name = 1;
3939
}
40-
message Res {}
40+
message Res {
41+
DatabaseReplicas database = 1;
42+
}
4143
}
4244
}
4345

proto/logic.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ message Rule {
9494
message Explanation {
9595
Rule rule = 1;
9696
map<string, VarList> var_mapping = 2;
97-
AnswerRow condition = 3;
98-
AnswerRow conclusion = 4;
97+
ConceptRow condition = 3;
98+
ConceptRow conclusion = 4;
9999

100100
message VarList {
101101
repeated string vars = 1;

proto/query.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ message Query {
2727
oneof ok {
2828
Empty empty = 1;
2929
ReadableConceptTreeStream readable_concept_tree_stream = 3;
30-
AnswerRowStream concept_row_stream = 4;
30+
ConceptRowStream concept_row_stream = 4;
3131
}
3232

3333
message Empty {
@@ -38,7 +38,7 @@ message Query {
3838
// note: we could use this first response to record debug info, type annotations, warnings, etc
3939
}
4040

41-
message AnswerRowStream {
41+
message ConceptRowStream {
4242
repeated string column_variable_names = 1;
4343
}
4444
}
@@ -47,15 +47,15 @@ message Query {
4747
message ResPart {
4848
oneof res {
4949
ReadableConceptTreesRes trees_res = 1;
50-
AnswerRowsRes rows_res = 2;
50+
ConceptRowsRes rows_res = 2;
5151
}
5252

5353
message ReadableConceptTreesRes {
5454
repeated ReadableConceptTree trees = 1;
5555
}
5656

57-
message AnswerRowsRes {
58-
repeated AnswerRow rows = 1;
57+
message ConceptRowsRes {
58+
repeated ConceptRow rows = 1;
5959
}
6060
}
6161
}

proto/transaction.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ message Transaction {
4040
bytes req_id = 1;
4141
oneof res {
4242
Open.Res open_res = 2;
43-
Query.InitialRes query_res = 3;
43+
Query.InitialRes query_initial_res = 3;
4444
Commit.Res commit_res = 5;
4545
Rollback.Res rollback_res = 6;
4646
}

0 commit comments

Comments
 (0)