syntax = "proto3"; package raft_service; import "eraftpb.proto"; service RaftService { rpc RequestId(RequestIdArgs) returns (RequestIdResponse) {} rpc ChangeConfig(ChangeConfigArgs) returns (ChangeConfigResponse) {} rpc Propose(ProposeArgs) returns (ProposeResponse) {} rpc SendMessage(eraftpb.Message) returns (Empty) {} rpc GetPeers(Empty) returns (GetPeersResponse) {} rpc SetPeers(Peers) returns (Empty) {} rpc LeaveJoint(Empty) returns (Empty) {} rpc DebugNode(Empty) returns (DebugNodeResponse) {} rpc CreateSnapshot(Empty) returns (Empty) {} } // Common message Empty {} enum ResultCode { Ok = 0; Error = 1; WrongLeader = 2; } // Used in ChangeConfig message ChangeConfigArgs { repeated string addrs = 1; repeated eraftpb.ConfChangeSingle changes = 2; } // Used in SetPeers message Peers { repeated Peer peers = 1; } message Peer { uint64 node_id = 1; string addr = 2; } // Used in Propose message ProposeArgs { bytes msg = 1; } message ProposeResponse { bytes error = 1; } // Used in GetPeers message GetPeersResponse { string peers_json = 1; } // Used in Dynamic Membership Change message RequestIdArgs { string raft_addr = 1; } message RequestIdResponse{ ResultCode code = 1; uint64 leader_id = 2; string leader_addr = 3; uint64 reserved_id = 4; bytes peers = 5; bytes error = 6; } // Config Change enum ChangeConfigResultType { ChangeConfig_Success = 0; ChangeConfig_WrongLeader = 1; ChangeConfig_TimeoutError = 2; ChangeConfig_UnknownError = 3; ChangeConfig_Rejected = 4; } message ChangeConfigResponse { ChangeConfigResultType result_type = 1; repeated uint64 assigned_ids = 2; // Used in JoinSuccess bytes peers = 3; // Used in JoinSuccess bytes error = 4; // Used in Handling error } // Debug Node message DebugNodeResponse { string result_json = 1; }