-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraft_service.proto
108 lines (87 loc) · 2.3 KB
/
raft_service.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* Copyright (c) 2025 Karagatan LLC.
* SPDX-License-Identifier: BUSL-1.1
*/
syntax = "proto3";
import "google/api/annotations.proto";
option go_package = "../raftpb";
option java_multiple_files = true;
option java_package = "com.codeallergy";
option java_outer_classname = "RaftProtos";
option objc_class_prefix = "RP";
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/protobuf/empty.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "RaftService";
version: "1.0";
contact: {
name: "RaftService";
url: "https://github.com/codeallergy/raft";
email: "zander@schwid.com";
};
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
consumes: "application/octet-stream";
produces: "application/json";
produces: "application/octet-stream";
};
package raft;
//
// RaftService
//
service RaftService {
rpc Bootstrap(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/api/v1/raft/bootstrap"
};
}
rpc Join(RaftNode) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/api/v1/raft/join"
};
}
rpc GetConfiguration(google.protobuf.Empty) returns (RaftConfiguration) {
option (google.api.http) = {
get: "/api/v1/raft/config"
};
}
rpc ApplyCommand(Command) returns (Status) {
option (google.api.http) = {
get: "/api/v1/raft/apply"
};
}
rpc Recover(stream Content) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/api/v1/fsm/recover"
};
}
}
message RaftNode {
string node_id = 1;
string node_addr = 2;
}
message Content {
bytes content = 1;
}
message RaftServer {
string node_id = 1;
string raft_addr = 2;
string suffrage = 3;
string api_addr = 4;
}
message RaftConfiguration {
string state = 1;
uint64 last_index = 2;
repeated RaftServer server_list = 3;
}
message Status {
bool updated = 1;
double elapsed = 2; // operation cost in seconds
string id = 3; // optional id field
}
message Command {
bytes payload = 1;
}