Skip to content

Commit b63c9b9

Browse files
author
Alex Walker
authored
Add methods to get and list Cluster databases (#120)
## What is the goal of this PR? We added new service methods to Cluster that retrieve Cluster databases, including their replica info. Although this was possible before with `database_replicas`, this method was not well aligned with what Core does. Using the terms `get` and `all` allows us to establish a more Core-like API. ## What are the changes implemented in this PR? - Add `database_all` and `database_get` methods to Cluster service
1 parent a3b1f02 commit b63c9b9

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

protobuf/cluster/database.proto

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,31 @@ option java_outer_classname = "DatabaseProto";
2323
package grakn.protocol.cluster;
2424

2525
message Database {
26+
string name = 1;
27+
repeated Replica replicas = 2;
2628

2729
message Replica {
2830
string address = 1;
29-
string database = 2;
30-
bool primary = 3;
31-
bool preferred_secondary = 4;
32-
int64 term = 5;
31+
bool primary = 2;
32+
bool preferred_secondary = 3;
33+
int64 term = 4;
3334
}
3435

35-
message Replicas {
36+
message Get {
3637
message Req {
37-
string database = 1;
38+
string name = 1;
3839
}
3940

4041
message Res {
41-
repeated Replica replicas = 1;
42+
Database database = 1;
43+
}
44+
}
45+
46+
message All {
47+
message Req {}
48+
49+
message Res {
50+
repeated Database databases = 1;
4251
}
4352
}
4453
}

protobuf/cluster/grakn_cluster.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ package grakn.protocol.cluster;
2727

2828
service GraknCluster {
2929
rpc cluster_servers (Cluster.Servers.Req) returns (Cluster.Servers.Res);
30-
rpc database_replicas (Database.Replicas.Req) returns (Database.Replicas.Res);
30+
31+
rpc database_get (Database.Get.Req) returns (Database.Get.Res);
32+
rpc database_all (Database.All.Req) returns (Database.All.Res);
3133
}

0 commit comments

Comments
 (0)