-
Notifications
You must be signed in to change notification settings - Fork 0
/
GRPCEventStore.proto
139 lines (116 loc) · 4.55 KB
/
GRPCEventStore.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
syntax = "proto3";
package grpceventstore;
service EventStore {
// Ping
rpc Ping (EmptyDTO) returns (EmptyDTO);
/////////////////////////////////
// QUERIES TO THE ENTIRE STORE //
/////////////////////////////////
// Returns a live stream of events emitted as soon as they are stored.
rpc SubscribeToStore (stream EmptyDTO) returns (stream StoredEvent);
// Returns a live stream of all the events stored after a certain one.
// The server implementation should transparently switch to live events as soon as the old ones are sent.
rpc CatchUpWithStore (stream CatchUpWithStoreRequest) returns (stream StoredEvent);
// Returns an ending stream of events stored after a certain one, up to the moment of request.
// Clients can specify a `limit` to receive just N events.
rpc ReadStoreForward (ReadStoreForwardRequest) returns (stream StoredEvent);
/////////////////////////
// QUERIES TO A STREAM //
/////////////////////////
// Returns a live stream of events belonging to the same... stream, emitted as soon as they are stored.
rpc SubscribeToStream (stream SubscribeToStreamRequest) returns (stream StoredEvent);
// Returns a live stream of all events belonging to the same stream and having a version number > than the provided one.
// The server implementation should transparently switch to live events as soon as the old ones are sent.
rpc CatchUpWithStream (stream CatchUpWithStreamRequest) returns (stream StoredEvent);
// Returns an ending stream of all the events belonging to the same stream, having a version number > than the provided one and stored before the time of request.
// Clients can specify a `limit` to receive just N events.
rpc ReadStreamForward (ReadStreamForwardRequest) returns (stream StoredEvent);
///////////////////////////////////
// QUERIES TO A TYPE OF STREAMS //
///////////////////////////////////
// Returns a live stream of multiplexed events belonging to streams having the same type, emitted as soon as they are stored.
rpc SubscribeToStreamType (stream SubscribeToStreamTypeRequest) returns (stream StoredEvent);
// Returns a live stream of multiplexed events belonging to streams having the same type stored after a given event.
// The server implementation should transparently switch to live events as soon as the old ones are sent.
rpc CatchUpWithStreamType (stream CatchUpWithStreamTypeRequest) returns (stream StoredEvent);
// Returns an ending stream of multiplexed events belonging to streams having the same type, stored after a given event and before the time of request.
// Clients can specify a `limit` to receive just N events.
rpc ReadStreamTypeForward (ReadStreamTypeForwardRequest) returns (stream StoredEvent);
//////////////////////
// WRITE PROCEDURES //
//////////////////////
// Attempts to append a list of events belonging to a stream
rpc AppendEventsToStream (AppendEventsToStreamRequest) returns (StoredEventsList);
// Attempts to append N list of events belonging to N streams
rpc AppendEventsToMultipleStreams (AppendEventsToMultipleStreamsRequest) returns (StoredEventsList);
}
message EmptyDTO {}
message StreamType {
string context = 1;
string name = 2;
}
message Stream {
StreamType type = 1;
string id = 2;
}
message Event {
string type = 1;
string data = 2;
}
message StoredEvent {
Stream stream = 1;
int64 id = 2;
string type = 3;
string storedOn = 4;
int32 sequenceNumber = 5;
string data = 6;
string correlationId = 7;
string transactionId = 8;
}
message CatchUpWithStoreRequest {
int64 fromEventId = 1;
}
message ReadStoreForwardRequest {
int64 fromEventId = 1;
int32 limit = 2;
}
message SubscribeToStreamRequest {
Stream stream = 1;
}
message CatchUpWithStreamRequest {
Stream stream = 1;
int32 fromSequenceNumber = 2;
}
message ReadStreamForwardRequest {
Stream stream = 1;
int32 fromSequenceNumber = 2;
int32 limit = 3;
}
message SubscribeToStreamTypeRequest {
StreamType streamType = 1;
}
message CatchUpWithStreamTypeRequest {
StreamType streamType = 1;
int64 fromEventId = 2;
}
message ReadStreamTypeForwardRequest {
StreamType streamType = 1;
int64 fromEventId = 2;
int32 limit = 3;
}
message AppendEventsRequest {
Stream stream = 1;
int32 expectedSequenceNumber = 2;
repeated Event events = 3;
}
message AppendEventsToStreamRequest {
string correlationId = 1;
AppendEventsRequest appendRequest = 2;
}
message AppendEventsToMultipleStreamsRequest {
string correlationId = 1;
repeated AppendEventsRequest appendRequests = 2;
}
message StoredEventsList {
repeated StoredEvent events = 1;
}