-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathload_balancer.proto
54 lines (42 loc) · 1.15 KB
/
load_balancer.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
syntax = "proto3";
import "chat.proto";
service LoadBalancerServer{
// Can be used for the chat server to connect to the load balancer
// Receives requests either asking to create a thread, or for the chat server to send its load
rpc receiveRequests(ConnectionInfo) returns (stream Request) {}
// Used for the chat server to send its load to the load balancer
rpc sendLoad(Load) returns (Status) {}
// Send pong to the load balancer after receiving a ping
rpc sendPong(Pong) returns (Status) {}
// Client can request to connect to a thread
// The load balancer will return the server information to which the client should connect
rpc ConnectRequest(Thread) returns (ConnectionInfo) {}
}
message Pong{
ConnectionInfo info = 1;
}
message Load{
float cpuLoad = 1;
float networkLoad = 2;
ConnectionInfo info = 3;
}
enum StatusCode{
ERROR = 0;
SUCCESS = 1;
}
message Status{
StatusCode status = 1;
}
enum RequestType{
CREATETHREAD = 0;
LOAD = 1;
PING = 2;
}
message Request{
RequestType type = 1;
Thread thread = 2;
}
message ConnectionInfo{
string ip = 1;
string port = 2;
}