Skip to content

Commit

Permalink
refactor: build client without ServerId
Browse files Browse the repository at this point in the history
add client builder
add `fetch_cluster` rpc
allows the client to build without `ServerId`, which automatically fetch the cluster information from the server

Signed-off-by: themanforfree <themanforfree@gmail.com>
  • Loading branch information
themanforfree committed Aug 7, 2023
1 parent 9b747ec commit 0cbd181
Show file tree
Hide file tree
Showing 15 changed files with 387 additions and 67 deletions.
12 changes: 11 additions & 1 deletion curp/proto/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ message FetchLeaderResponse {
uint64 term = 2;
}

message FetchClusterRequest {
}

message FetchClusterResponse {
optional string leader_id = 1;
map<string, string> all_members = 2;
uint64 term = 3;
}

message WaitSyncedRequest {
bytes id = 1;
}
Expand Down Expand Up @@ -105,7 +114,8 @@ service Protocol {
rpc WaitSynced (WaitSyncedRequest) returns (WaitSyncedResponse);
rpc AppendEntries (AppendEntriesRequest) returns (AppendEntriesResponse);
rpc Vote (VoteRequest) returns (VoteResponse);
rpc FetchLeader (FetchLeaderRequest) returns (FetchLeaderResponse);
rpc InstallSnapshot (stream InstallSnapshotRequest) returns (InstallSnapshotResponse);
rpc FetchLeader (FetchLeaderRequest) returns (FetchLeaderResponse);
rpc FetchCluster (FetchClusterRequest) returns (FetchClusterResponse);
rpc FetchReadState (FetchReadStateRequest) returns (FetchReadStateResponse);
}
Loading

0 comments on commit 0cbd181

Please sign in to comment.