-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathstreams.proto
More file actions
353 lines (313 loc) · 8.58 KB
/
Copy pathstreams.proto
File metadata and controls
353 lines (313 loc) · 8.58 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
syntax = "proto3";
package event_store.client.streams;
option java_package = "io.kurrent.dbclient.proto.streams";
import "shared.proto";
import "status.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
service Streams {
rpc Read (ReadReq) returns (stream ReadResp);
rpc Append (stream AppendReq) returns (AppendResp);
rpc Delete (DeleteReq) returns (DeleteResp);
rpc Tombstone (TombstoneReq) returns (TombstoneResp);
rpc BatchAppend (stream BatchAppendReq) returns (stream BatchAppendResp);
}
message ReadReq {
Options options = 1;
message Options {
oneof stream_option {
StreamOptions stream = 1;
AllOptions all = 2;
}
ReadDirection read_direction = 3;
bool resolve_links = 4;
oneof count_option {
uint64 count = 5;
SubscriptionOptions subscription = 6;
}
oneof filter_option {
FilterOptions filter = 7;
event_store.client.Empty no_filter = 8;
}
UUIDOption uuid_option = 9;
ControlOption control_option = 10;
enum ReadDirection {
Forwards = 0;
Backwards = 1;
}
message StreamOptions {
event_store.client.StreamIdentifier stream_identifier = 1;
oneof revision_option {
uint64 revision = 2;
event_store.client.Empty start = 3;
event_store.client.Empty end = 4;
}
}
message AllOptions {
oneof all_option {
Position position = 1;
event_store.client.Empty start = 2;
event_store.client.Empty end = 3;
}
}
message SubscriptionOptions {
}
message Position {
uint64 commit_position = 1;
uint64 prepare_position = 2;
}
message FilterOptions {
oneof filter {
Expression stream_identifier = 1;
Expression event_type = 2;
}
oneof window {
uint32 max = 3;
event_store.client.Empty count = 4;
}
uint32 checkpointIntervalMultiplier = 5;
message Expression {
string regex = 1;
repeated string prefix = 2;
}
}
message UUIDOption {
oneof content {
event_store.client.Empty structured = 1;
event_store.client.Empty string = 2;
}
}
message ControlOption {
uint32 compatibility = 1;
}
}
}
message ReadResp {
oneof content {
ReadEvent event = 1;
SubscriptionConfirmation confirmation = 2;
Checkpoint checkpoint = 3;
StreamNotFound stream_not_found = 4;
uint64 first_stream_position = 5;
uint64 last_stream_position = 6;
AllStreamPosition last_all_stream_position = 7;
CaughtUp caught_up = 8;
FellBehind fell_behind = 9;
}
// The $all or stream subscription has caught up and become live.
message CaughtUp {
// Current time in the server when the subscription caught up
google.protobuf.Timestamp timestamp = 1;
// Checkpoint for resuming a stream subscription.
// For stream subscriptions it is populated unless the stream is empty.
// For $all subscriptions it is not populated.
optional int64 stream_revision = 2;
// Checkpoint for resuming a $all subscription.
// For stream subscriptions it is not populated.
// For $all subscriptions it is populated unless the database is empty.
optional Position position = 3;
}
// The $all or stream subscription has fallen back into catchup mode and is no longer live.
message FellBehind {
// Current time in the server when the subscription fell behind
google.protobuf.Timestamp timestamp = 1;
// Checkpoint for resuming a stream subscription.
// For stream subscriptions it is populated unless the stream is empty.
// For $all subscriptions it is not populated.
optional int64 stream_revision = 2;
// Checkpoint for resuming a $all subscription.
// For stream subscriptions it is not populated.
// For $all subscriptions it is populated unless the database is empty.
optional Position position = 3;
}
message ReadEvent {
RecordedEvent event = 1;
RecordedEvent link = 2;
oneof position {
uint64 commit_position = 3;
event_store.client.Empty no_position = 4;
}
message RecordedEvent {
event_store.client.UUID id = 1;
event_store.client.StreamIdentifier stream_identifier = 2;
uint64 stream_revision = 3;
uint64 prepare_position = 4;
uint64 commit_position = 5;
map<string, string> metadata = 6;
bytes custom_metadata = 7;
bytes data = 8;
}
}
message SubscriptionConfirmation {
string subscription_id = 1;
}
message Checkpoint {
uint64 commit_position = 1;
uint64 prepare_position = 2;
// Current time in the server when the checkpoint was reached
google.protobuf.Timestamp timestamp = 3;
}
message Position {
uint64 commit_position = 1;
uint64 prepare_position = 2;
}
message StreamNotFound {
event_store.client.StreamIdentifier stream_identifier = 1;
}
}
message AppendReq {
oneof content {
Options options = 1;
ProposedMessage proposed_message = 2;
}
message Options {
event_store.client.StreamIdentifier stream_identifier = 1;
oneof expected_stream_revision {
uint64 revision = 2;
event_store.client.Empty no_stream = 3;
event_store.client.Empty any = 4;
event_store.client.Empty stream_exists = 5;
}
}
message ProposedMessage {
event_store.client.UUID id = 1;
map<string, string> metadata = 2;
bytes custom_metadata = 3;
bytes data = 4;
}
}
message AppendResp {
oneof result {
Success success = 1;
WrongExpectedVersion wrong_expected_version = 2;
}
message Position {
uint64 commit_position = 1;
uint64 prepare_position = 2;
}
message Success {
oneof current_revision_option {
uint64 current_revision = 1;
event_store.client.Empty no_stream = 2;
}
oneof position_option {
Position position = 3;
event_store.client.Empty no_position = 4;
}
}
message WrongExpectedVersion {
oneof current_revision_option_20_6_0 {
uint64 current_revision_20_6_0 = 1;
event_store.client.Empty no_stream_20_6_0 = 2;
}
oneof expected_revision_option_20_6_0 {
uint64 expected_revision_20_6_0 = 3;
event_store.client.Empty any_20_6_0 = 4;
event_store.client.Empty stream_exists_20_6_0 = 5;
}
oneof current_revision_option {
uint64 current_revision = 6;
event_store.client.Empty current_no_stream = 7;
}
oneof expected_revision_option {
uint64 expected_revision = 8;
event_store.client.Empty expected_any = 9;
event_store.client.Empty expected_stream_exists = 10;
event_store.client.Empty expected_no_stream = 11;
}
}
}
message BatchAppendReq {
event_store.client.UUID correlation_id = 1;
Options options = 2;
repeated ProposedMessage proposed_messages = 3;
bool is_final = 4;
message Options {
event_store.client.StreamIdentifier stream_identifier = 1;
oneof expected_stream_position {
uint64 stream_position = 2;
google.protobuf.Empty no_stream = 3;
google.protobuf.Empty any = 4;
google.protobuf.Empty stream_exists = 5;
}
oneof deadline_option {
google.protobuf.Timestamp deadline_21_10_0 = 6;
google.protobuf.Duration deadline = 7;
}
}
message ProposedMessage {
event_store.client.UUID id = 1;
map<string, string> metadata = 2;
bytes custom_metadata = 3;
bytes data = 4;
}
}
message BatchAppendResp {
event_store.client.UUID correlation_id = 1;
oneof result {
google.rpc.Status error = 2;
Success success = 3;
}
event_store.client.StreamIdentifier stream_identifier = 4;
oneof expected_stream_position {
uint64 stream_position = 5;
google.protobuf.Empty no_stream = 6;
google.protobuf.Empty any = 7;
google.protobuf.Empty stream_exists = 8;
}
message Success {
oneof current_revision_option {
uint64 current_revision = 1;
google.protobuf.Empty no_stream = 2;
}
oneof position_option {
event_store.client.AllStreamPosition position = 3;
google.protobuf.Empty no_position = 4;
}
}
}
message DeleteReq {
Options options = 1;
message Options {
event_store.client.StreamIdentifier stream_identifier = 1;
oneof expected_stream_revision {
uint64 revision = 2;
event_store.client.Empty no_stream = 3;
event_store.client.Empty any = 4;
event_store.client.Empty stream_exists = 5;
}
}
}
message DeleteResp {
oneof position_option {
Position position = 1;
event_store.client.Empty no_position = 2;
}
message Position {
uint64 commit_position = 1;
uint64 prepare_position = 2;
}
}
message TombstoneReq {
Options options = 1;
message Options {
event_store.client.StreamIdentifier stream_identifier = 1;
oneof expected_stream_revision {
uint64 revision = 2;
event_store.client.Empty no_stream = 3;
event_store.client.Empty any = 4;
event_store.client.Empty stream_exists = 5;
}
}
}
message TombstoneResp {
oneof position_option {
Position position = 1;
event_store.client.Empty no_position = 2;
}
message Position {
uint64 commit_position = 1;
uint64 prepare_position = 2;
}
}