-
Notifications
You must be signed in to change notification settings - Fork 3
/
writeside.proto
61 lines (53 loc) · 2.14 KB
/
writeside.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
syntax = "proto3";
package chief_of_state.v1;
option csharp_namespace = "Namely.ChiefOfState.V1";
option go_package = "chief_of_state/v1;chiefofstatev1";
option java_multiple_files = true;
option java_outer_classname = "CosWriteSideHandlerProto";
option java_package = "com.namely.protobuf.chiefofstate.v1";
import "chief_of_state/v1/common.proto";
import "google/protobuf/any.proto";
// Defines the interface that will be implemented by any application that
// wants to keeps its events and state with ChiefOfState. So an application will
// implement the gRPC server while ChiefOfState will make use the client side to
// interact.
service WriteSideHandlerService {
// Processes every command sent by ChiefOfState and return either a response
// containing an event to persist or a simple reply.
rpc HandleCommand(HandleCommandRequest) returns (HandleCommandResponse);
// Processes every event sent by ChiefOfState by applying the event to the
// current state to return a new state.
rpc HandleEvent(HandleEventRequest) returns (HandleEventResponse);
}
// HandleCommandRequest
message HandleCommandRequest {
// the command to handle
google.protobuf.Any command = 1;
// the aggregate state at the moment of handling the command. This is the
// state before the command being handled.
google.protobuf.Any prior_state = 2;
// the prior event meta data. This is the event meta data of the last event
// before this command
chief_of_state.v1.MetaData prior_event_meta = 3;
}
// HandleCommandResponse
message HandleCommandResponse {
// An event to append to the journal. If not set, COS
// will treat this command as a no-op.
google.protobuf.Any event = 1;
}
// HandleEventRequest
message HandleEventRequest {
// the event to handle
google.protobuf.Any event = 1;
// the state before the event is being handled.
google.protobuf.Any prior_state = 2;
// the meta data of this event
chief_of_state.v1.MetaData event_meta = 3;
}
// HandleEventResponse contains the resulting state
// after the event has been handled
message HandleEventResponse {
// resulting state after the event has been handled
google.protobuf.Any resulting_state = 1;
}