Skip to content

Commit

Permalink
docs(metarepos): add specification to management RPCs
Browse files Browse the repository at this point in the history
Update: #658
  • Loading branch information
ijsong committed Jan 21, 2024
1 parent f34ccca commit e566251
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
29 changes: 29 additions & 0 deletions proto/mrpb/management.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions proto/mrpb/management.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ option (gogoproto.goproto_unkeyed_all) = false;
option (gogoproto.goproto_unrecognized_all) = false;
option (gogoproto.goproto_sizecache_all) = false;

// AddPeerRequest is a request message for AddPeer RPC.
message AddPeerRequest {
int32 cluster_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.ClusterID",
Expand All @@ -28,6 +29,7 @@ message AddPeerRequest {
string url = 3;
}

// RemovePeerRequest is a request message for RemovePeer RPC.
message RemovePeerRequest {
int32 cluster_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.ClusterID",
Expand All @@ -40,13 +42,15 @@ message RemovePeerRequest {
];
}

// GetClusterInfoRequest is a request message for GetClusterInfo RPC.
message GetClusterInfoRequest {
int32 cluster_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.ClusterID",
(gogoproto.customname) = "ClusterID"
];
}

// ClusterInfo is a metadata representing the Raft cluster.
message ClusterInfo {
message Member {
string peer = 1;
Expand Down Expand Up @@ -80,12 +84,25 @@ message ClusterInfo {
uint64 applied_index = 6 [(gogoproto.jsontag) = "appliedIndex"];
}

// GetClusterInfoResponse is a response message for GetClusterInfo RPC.
message GetClusterInfoResponse {
ClusterInfo cluster_info = 1;
}

service Management {
// AddPeer is a remote procedure to add a new node to the Raft cluster. If the
// node is already a member or learner, it fails and returns the gRPC status
// code "AlreadyExists". Users can cancel this RPC, but it doesn't guarantee
// that adding a new peer is not handled.
rpc AddPeer(AddPeerRequest) returns (google.protobuf.Empty) {}
// RemovePeer is a remote procedure to remove a node from the Raft cluster. If
// the node is neither a member nor a learner of the cluster, it fails and
// returns the gRPC status code "NotFound". Users can cancel this RPC, but it
// doesn't guarantee that the node will not be removed.
rpc RemovePeer(RemovePeerRequest) returns (google.protobuf.Empty) {}
// GetClusterInfo is a remote procedure used to retrieve information about the
// Raft cluster, specifically the ClusterInfo. If the current node is not a
// member of the cluster, it will fail and return the gRPC status code
// "codes.Unavailable".
rpc GetClusterInfo(GetClusterInfoRequest) returns (GetClusterInfoResponse) {}
}

0 comments on commit e566251

Please sign in to comment.