-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathq3.proto
67 lines (56 loc) · 1.21 KB
/
q3.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
syntax = "proto3";
package MyUber;
message RideRequest {
string rider_name = 1;
string source = 2;
string destination = 3;
}
message RideResponse {
int32 ride_id = 1;
enum Status {
SEARCHING_FOR_DRIVER = 0;
NO_DRIVERS_AVAILABLE = 1;
};
Status status = 2;
}
message RideStatusRequest {
int32 ride_id = 1;
}
message RideStatusResponse {
string status = 1;
string driver_name = 2;
}
message GetRideRequest {
int32 ride_id = 1;
string driver_name = 2;
enum Request {
ACCEPTED = 0;
REJECTED = 1;
};
Request request = 3;
}
message RespondToRideRequest {
int32 ride_id = 1;
string source = 2;
string destination = 3;
enum Status {
AVAILABLE = 0;
ACCEPTED = 1;
TIMED_OUT = 2;
}
Status status = 4;
}
message RideCompletionRequest {
int32 ride_id = 1;
}
message RideCompletionResponse {
int32 ride_id = 1;
}
service RiderServices {
rpc RequestRide(RideRequest) returns (RideResponse) {}
rpc GetRideStatus(RideStatusRequest) returns (RideStatusResponse) {}
}
service DriverServices {
rpc SubscribeToRideRequests(stream GetRideRequest) returns (stream RespondToRideRequest) {}
rpc CompleteRide(RideCompletionRequest) returns (RideCompletionResponse) {}
}