-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.proto
56 lines (48 loc) · 2.27 KB
/
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
syntax = "proto3";
package chief_of_state.v1;
import "chief_of_state/v1/common.proto";
import "google/protobuf/any.proto";
option csharp_namespace = "ChiefOfState.V1";
option go_package = "chief_of_state/v1;chiefofstatev1";
option java_multiple_files = true;
option java_outer_classname = "CosServiceProto";
option java_package = "com.github.chiefofstate.protobuf.v1";
// Service definition
service ChiefOfStateService {
// Used to process command sent by an application. Once chief of state receives the command, it either provisions an entity
// given the entity unique id when the entity does not exist or retrieves the given entity using the provided entity unique id.
// In case of error a gRPC error is returned. For more information refer to https://www.grpc.io/docs/guides/error/
rpc ProcessCommand(ProcessCommandRequest) returns (ProcessCommandResponse);
// Used to get the current state of that entity. When the given entity is not found a NOT_FOUND gRPC error is returned.
// In case of error a gRPC error is returned. For more information refer to https://www.grpc.io/docs/guides/error/
rpc GetState(GetStateRequest) returns (GetStateResponse);
}
// ProcessCommandRequest is used to process the command
// One needs to pass in the entity id and the actual command to send
message ProcessCommandRequest {
// Specifies the entity unique id
string entity_id = 1;
// Specifies the actual command to process
google.protobuf.Any command = 2;
}
// ProcessCommandResponse is the response of ProcessCommandRequest
// This is returned when the command and event have been successfully processed
// This includes the resulting state of the processed command and the metadata
message ProcessCommandResponse {
// Specifies the entity state returned after the command has been processed
google.protobuf.Any state = 1;
// Specifies the additional meta data
chief_of_state.v1.MetaData meta = 2;
}
// GetStateRequest is used to fetch the entity current state
message GetStateRequest {
// Specifies the entity unique id
string entity_id = 1;
}
// GetStateResponse is the response of GetStateRequest
message GetStateResponse {
// Specifies the current state of the entity
google.protobuf.Any state = 1;
// Specifies the additional meta data
chief_of_state.v1.MetaData meta = 2;
}