-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhstream.proto
875 lines (711 loc) · 22 KB
/
hstream.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
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
// ---------------------------------------------------------------------------
// HStreamDB public APIs
// ---------------------------------------------------------------------------
syntax = "proto3";
package hstream.server;
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
option java_package = "io.hstream.internal";
option java_multiple_files = true;
option java_outer_classname = "HStreamProto";
option go_package = "hstreamdb/hstream/server";
service HStreamApi {
// ---------------------------------------------------------------------------
// Stable APIs
// ---------------------------------------------------------------------------
rpc Echo(EchoRequest) returns (EchoResponse);
// Stream APIs
rpc CreateStream(Stream) returns (Stream) {}
rpc DeleteStream(DeleteStreamRequest) returns (google.protobuf.Empty) {}
rpc TrimStream(TrimStreamRequest) returns (google.protobuf.Empty) {}
// Find the oldest recordId in each shard, and trim all the records before
// that recordId(exclude)."
rpc TrimShards(TrimShardsRequest) returns (TrimShardsResponse) {}
rpc GetStream(GetStreamRequest) returns (GetStreamResponse) {}
rpc ListStreams(ListStreamsRequest) returns (ListStreamsResponse) {}
rpc ListStreamsWithPrefix(ListStreamsWithPrefixRequest)
returns (ListStreamsResponse) {}
rpc LookupShard(LookupShardRequest) returns (LookupShardResponse) {}
rpc Append(AppendRequest) returns (AppendResponse) {}
rpc GetTailRecordId(GetTailRecordIdRequest)
returns (GetTailRecordIdResponse) {}
// Shard APIs
rpc ListShards(ListShardsRequest) returns (ListShardsResponse) {}
rpc TrimShard(TrimShardRequest) returns (google.protobuf.Empty) {}
rpc CreateShardReader(CreateShardReaderRequest)
returns (CreateShardReaderResponse) {}
rpc LookupShardReader(LookupShardReaderRequest)
returns (LookupShardReaderResponse) {}
rpc ReadShard(ReadShardRequest) returns (ReadShardResponse) {}
rpc ReadShardStream(ReadShardStreamRequest)
returns (stream ReadShardStreamResponse) {}
rpc ListShardReaders(ListShardReadersRequest)
returns (ListShardReadersResponse) {}
rpc DeleteShardReader(DeleteShardReaderRequest)
returns (google.protobuf.Empty) {}
rpc ReadStream(ReadStreamRequest) returns (stream ReadStreamResponse) {}
rpc ReadSingleShardStream(ReadSingleShardStreamRequest)
returns (stream ReadSingleShardStreamResponse) {}
rpc ReadStreamByKey(stream ReadStreamByKeyRequest)
returns (stream ReadStreamByKeyResponse) {}
// Subscribe APIs
rpc CreateSubscription(Subscription) returns (Subscription) {}
rpc GetSubscription(GetSubscriptionRequest)
returns (GetSubscriptionResponse) {}
rpc ListSubscriptions(ListSubscriptionsRequest)
returns (ListSubscriptionsResponse) {}
rpc ListSubscriptionsWithPrefix(ListSubscriptionsWithPrefixRequest)
returns (ListSubscriptionsResponse) {}
rpc ListConsumers(ListConsumersRequest) returns (ListConsumersResponse) {}
rpc CheckSubscriptionExist(CheckSubscriptionExistRequest)
returns (CheckSubscriptionExistResponse) {}
rpc DeleteSubscription(DeleteSubscriptionRequest)
returns (google.protobuf.Empty) {}
rpc LookupSubscription(LookupSubscriptionRequest)
returns (LookupSubscriptionResponse) {}
rpc StreamingFetch(stream StreamingFetchRequest)
returns (stream StreamingFetchResponse) {}
// Cluster APIs
rpc DescribeCluster(google.protobuf.Empty) returns (DescribeClusterResponse) {
}
rpc LookupResource(LookupResourceRequest) returns (ServerNode) {}
rpc LookupKey(LookupKeyRequest) returns (ServerNode) {}
// Admin Command
rpc SendAdminCommand(AdminCommandRequest) returns (AdminCommandResponse);
// ---------------------------------------------------------------------------
// Developing APIs
// ---------------------------------------------------------------------------
// Stats
rpc PerStreamTimeSeriesStats(PerStreamTimeSeriesStatsRequest)
returns (PerStreamTimeSeriesStatsResponse);
rpc PerStreamTimeSeriesStatsAll(PerStreamTimeSeriesStatsAllRequest)
returns (PerStreamTimeSeriesStatsAllResponse);
rpc GetStats(GetStatsRequest) returns (GetStatsResponse);
// for execute any sql stmt except push query,
// e.g., insert, create, show/list, select(without emit changes) ...
rpc ExecuteQuery(CommandQuery) returns (CommandQueryResponse);
// query related apis
rpc CreateQuery(CreateQueryRequest) returns (Query) {}
rpc CreateQueryWithNamespace(CreateQueryWithNamespaceRequest)
returns (Query) {}
rpc ListQueries(ListQueriesRequest) returns (ListQueriesResponse) {}
rpc GetQuery(GetQueryRequest) returns (Query) {}
rpc TerminateQuery(TerminateQueryRequest) returns (google.protobuf.Empty) {}
rpc DeleteQuery(DeleteQueryRequest) returns (google.protobuf.Empty) {}
rpc ResumeQuery(ResumeQueryRequest) returns (google.protobuf.Empty) {}
rpc PauseQuery(PauseQueryRequest) returns (google.protobuf.Empty) {}
// parse query sql, return structuralized information
rpc ParseSql(ParseSqlRequest) returns (ParseSqlResponse) {}
rpc RegisterSchema(Schema) returns (google.protobuf.Empty) {}
rpc GetSchema(GetSchemaRequest) returns (Schema) {}
rpc UnregisterSchema(UnregisterSchemaRequest)
returns (google.protobuf.Empty) {}
// connector related apis
rpc CreateConnector(CreateConnectorRequest) returns (Connector) {}
rpc ListConnectors(ListConnectorsRequest) returns (ListConnectorsResponse) {}
rpc GetConnector(GetConnectorRequest) returns (Connector) {}
rpc GetConnectorSpec(GetConnectorSpecRequest)
returns (GetConnectorSpecResponse) {}
rpc GetConnectorLogs(GetConnectorLogsRequest)
returns (GetConnectorLogsResponse) {}
rpc DeleteConnector(DeleteConnectorRequest) returns (google.protobuf.Empty) {}
rpc PauseConnector(PauseConnectorRequest) returns (google.protobuf.Empty) {}
rpc ResumeConnector(ResumeConnectorRequest) returns (google.protobuf.Empty) {}
rpc AlterConnectorConfig(AlterConnectorConfigRequest)
returns (google.protobuf.Empty) {}
// view related apis
rpc ListViews(ListViewsRequest) returns (ListViewsResponse) {}
rpc GetView(GetViewRequest) returns (View) {}
rpc DeleteView(DeleteViewRequest) returns (google.protobuf.Empty) {}
rpc ExecuteViewQuery(ExecuteViewQueryRequest)
returns (ExecuteViewQueryResponse) {}
rpc ExecuteViewQueryWithNamespace(ExecuteViewQueryWithNamespaceRequest)
returns (ExecuteViewQueryResponse) {}
// overview related apis
// rpc GetOverview(GetOverviewRequest) returns (GetOverviewResponse) {}
}
enum SpecialOffset {
EARLIEST = 0;
LATEST = 1;
}
message TimestampOffset {
int64 timestampInMs = 1;
bool strictAccuracy = 2;
}
message ShardOffset {
oneof offset {
SpecialOffset specialOffset = 1;
RecordId recordOffset = 2;
TimestampOffset timestampOffset = 3;
}
}
message EchoRequest { string msg = 1; }
message EchoResponse { string msg = 1; }
message CommandStreamTask { string command_sql = 1; }
message CommandStreamTaskResponse { string command_resp = 1; }
message CommandConnect {
string client_version = 1;
int32 protocol_version = 2;
}
message CommandConnected {
string server_version = 1;
int32 protocol_version = 2;
}
message CommandQuery { string stmt_text = 1; }
message CommandQueryResponse { repeated google.protobuf.Struct result_set = 1; }
message GetStreamRequest { string name = 1; }
message GetStreamResponse { Stream stream = 1; }
message AppendRequest {
string streamName = 1;
uint64 shardId = 2;
BatchedRecord records = 3;
}
message AppendResponse {
string streamName = 1;
uint64 shardId = 2;
repeated RecordId recordIds = 3;
}
message Subscription {
string subscriptionId = 1;
string streamName = 2;
int32 ackTimeoutSeconds = 3;
int32 maxUnackedRecords = 4;
SpecialOffset offset = 5;
google.protobuf.Timestamp creationTime = 6;
}
message SubscriptionOffset {
uint64 shardId = 1;
uint64 batchId = 2;
}
message GetSubscriptionRequest { string id = 1; }
message GetSubscriptionResponse {
Subscription subscription = 1;
repeated SubscriptionOffset offsets = 2;
}
message DeleteSubscriptionRequest {
string subscriptionId = 1;
bool force = 2;
}
message CheckSubscriptionExistRequest { string subscriptionId = 1; }
message CheckSubscriptionExistResponse { bool exists = 1; }
message StreamingFetchRequest {
string subscriptionId = 1;
string consumerName = 2;
repeated RecordId ackIds = 3;
}
message StreamingFetchResponse { ReceivedRecord receivedRecords = 1; }
message ReceivedRecord {
repeated RecordId recordIds = 1;
BatchedRecord record = 2;
}
message DeleteStreamRequest {
string streamName = 1;
bool ignoreNonExist = 2;
bool force = 3;
}
message ListStreamsResponse { repeated Stream streams = 1; }
// TODO: Add options for filtering or max_size
message ListStreamsRequest {}
message ListStreamsWithPrefixRequest { string prefix = 1; }
message ListSubscriptionsRequest {}
message ListSubscriptionsWithPrefixRequest { string prefix = 1; }
message ListSubscriptionsResponse { repeated Subscription subscription = 1; }
message ListConsumersRequest { string subscriptionId = 1; }
message ListConsumersResponse { repeated Consumer consumers = 1; }
message TrimStreamRequest {
string streamName = 1;
// trim up to and including this offset
StreamOffset trimPoint = 2;
}
message TrimShardsRequest {
string streamName = 1;
// recordId: "shardId-batchId-batchIndex"
repeated string recordIds = 2;
}
message TrimShardsResponse {
// return map{shardId -> RecordId}, records before recordId(exclude) for each
// shard are all trimmed
map<uint64, string> trimPoints = 1;
}
message Stream {
string streamName = 1;
uint32 replicationFactor = 2;
uint32 backlogDuration = 3;
uint32 shardCount = 4;
google.protobuf.Timestamp creationTime = 5;
}
enum CompressionType {
None = 0;
Gzip = 1;
Zstd = 2;
}
message BatchedRecord {
CompressionType compressionType = 1;
// Required.
// The time at which the message was published,
// populated by the server.
google.protobuf.Timestamp publishTime = 2;
// Required
// batchSize records the number of compressed HStreamRecords
// in the current batch. This field allows the server to build
// the RecordId correctly without decompression after reading
// the data from the store.
uint32 batchSize = 3;
bytes payload = 4; // serialized BatchHStreamRecords
}
message HStreamRecord {
// Required.
HStreamRecordHeader header = 1;
// Optional.
// Payload may be empty.
bytes payload = 2;
}
// Auxiliary types for serialization [HStreamRecord]
message BatchHStreamRecords { repeated HStreamRecord records = 1; }
message HStreamRecordHeader {
// Required.
// Flag for payload.
enum Flag {
JSON = 0;
RAW = 1;
}
Flag flag = 1;
// Optional.
// Attributes attached to this record.
map<string, string> attributes = 2;
// Optional.
// key for the message.
string key = 3;
}
message RecordId {
uint64 shardId = 1;
// LSN of the total batch records
uint64 batchId = 2;
// Offset of each record in the batch
uint32 batchIndex = 3;
}
message Shard {
string streamName = 1;
uint64 shardId = 2;
string startHashRangeKey = 3;
string endHashRangeKey = 4;
uint64 epoch = 5;
bool isActive = 6;
}
message ListShardsRequest { string streamName = 1; }
message ListShardsResponse { repeated Shard shards = 1; }
message TrimShardRequest {
string streamName = 1;
uint64 shardId = 2;
// trim up to and including this offset
ShardOffset trimPoint = 3;
}
message CreateShardReaderRequest {
string streamName = 1;
uint64 shardId = 2;
ShardOffset shardOffset = 3;
string readerId = 4;
uint32 timeout = 5;
}
message CreateShardReaderResponse {
string streamName = 1;
uint64 shardId = 2;
ShardOffset shardOffset = 3;
string readerId = 4;
uint32 timeout = 5;
}
message ReadShardRequest {
string readerId = 1;
uint32 maxRecords = 2;
}
message DeleteShardReaderRequest { string readerId = 1; }
message ReadShardResponse { repeated ReceivedRecord receivedRecords = 1; }
message ListShardReadersRequest {}
message ListShardReadersResponse { repeated string readerId = 1; }
message ReadShardStreamRequest {
string readerId = 1;
uint64 shardId = 2;
ShardOffset from = 3;
// Total number of batches reader read at most
uint64 maxReadBatches = 4;
ShardOffset until = 5;
string streamName = 6;
}
message ReadShardStreamResponse { repeated ReceivedRecord receivedRecords = 1; }
message StreamOffset {
oneof offset {
SpecialOffset specialOffset = 1;
TimestampOffset timestampOffset = 2;
}
}
message ReadStreamRequest {
string readerId = 1;
string streamName = 2;
StreamOffset from = 3;
StreamOffset until = 4;
// Total number of batches reader read at most
uint64 maxReadBatches = 5;
}
message ReadStreamResponse { repeated ReceivedRecord receivedRecords = 1; }
message ReadStreamByKeyRequest {
string readerId = 1;
string streamName = 2;
string key = 3;
ShardOffset from = 4;
ShardOffset until = 5;
// total record return in next round read
uint64 readRecordCount = 6;
}
message ReadStreamByKeyResponse {
repeated RecordId recordIds = 1;
repeated HStreamRecord receivedRecords = 2;
}
message ReadSingleShardStreamRequest {
string readerId = 1;
string streamName = 2;
ShardOffset from = 3;
ShardOffset until = 4;
// Total number of batches reader read at most
uint64 maxReadBatches = 5;
}
message ReadSingleShardStreamResponse {
repeated ReceivedRecord receivedRecords = 1;
}
message TerminateQueryRequest { string queryId = 1; }
// Query realated Request and Response
message CreateQueryRequest {
string sql = 1;
string queryName = 2;
}
message CreateQueryWithNamespaceRequest {
string sql = 1;
string queryName = 2;
string namespace = 3;
}
message ListQueriesRequest {}
message ListQueriesResponse { repeated Query queries = 1; }
message GetQueryRequest { string id = 1; }
enum TaskStatusPB {
TASK_CREATING = 0;
TASK_RUNNING = 1;
TASK_ABORTED = 2;
TASK_PAUSED = 3;
TASK_RESUMING = 4;
TASK_TERMINATED = 5;
TASK_UNKNOWN = 6;
}
message Consumer {
string name = 1;
string uri = 2;
string userAgent = 3;
}
enum QueryType {
CreateStreamAs = 0;
CreateViewAs = 1;
}
message Query {
string id = 1;
TaskStatusPB status = 2;
int64 createdTime = 3;
string queryText = 4;
repeated string sources = 5;
string resultName = 6;
// type:
// CreateStreamAs: resultName is result stream name
// CreateViewAs: resultName is result view name
QueryType type = 7;
// Id of the node to execute the query
uint32 nodeId = 8;
}
message DeleteQueryRequest { string id = 1; }
message ResumeQueryRequest { string id = 1; }
message PauseQueryRequest { string id = 1; }
message ParseSqlRequest { string sql = 1; }
message ParseSqlResponse {
oneof sql { ExecuteViewQuerySql evqSql = 1; }
}
message ColumnCatalog {
uint32 index = 1;
string name = 2;
string type = 3;
bool isNullable = 4;
bool isHidden = 5;
}
message Schema {
string owner = 1;
repeated ColumnCatalog columns = 2;
}
message GetSchemaRequest { string owner = 1; }
message UnregisterSchemaRequest { string owner = 1; }
message ExecuteViewQuerySql { string view = 1; }
// Connector Related Request and Response
message CreateConnectorRequest {
string name = 1;
string type = 2;
string target = 3;
string config = 4;
}
message AlterConnectorConfigRequest {
string name = 1;
string config = 2;
}
message ListConnectorsRequest {}
message ListConnectorsResponse { repeated Connector connectors = 1; }
message GetConnectorRequest { string name = 1; }
message GetConnectorSpecRequest {
// SOURCE or SINK
string type = 1;
// e.g. mysql, postgresql, etc.
string target = 2;
}
message GetConnectorSpecResponse { string spec = 1; }
message GetConnectorLogsRequest {
string name = 1;
int32 begin = 2;
int32 count = 3;
}
message GetConnectorLogsResponse { string logs = 1; }
message Connector {
string name = 1;
string type = 2;
string target = 3;
google.protobuf.Timestamp creationTime = 4;
string status = 5;
string config = 6;
repeated google.protobuf.Struct offsets = 7;
string taskId = 8;
string node = 9;
string dockerStatus = 10;
string image = 11;
}
message DeleteConnectorRequest { string name = 1; }
message PauseConnectorRequest { string name = 1; }
message ResumeConnectorRequest { string name = 1; }
// View related Request and Response
message GetViewRequest { string viewId = 1; }
message DeleteViewRequest {
string viewId = 1;
bool ignoreNonExist = 2;
}
message ListViewsRequest {}
message ListViewsResponse { repeated View views = 1; }
message View {
string viewId = 1;
TaskStatusPB status = 2;
int64 createdTime = 3;
string sql = 4;
repeated string schema = 5;
string queryName = 6;
}
message ExecuteViewQueryResponse {
repeated google.protobuf.Struct results = 1;
}
message ExecuteViewQueryRequest { string sql = 1; }
message ExecuteViewQueryWithNamespaceRequest {
string sql = 1;
string namespace = 2;
}
message StatsIntervalVals { repeated int32 intervals = 1; }
message StatsDoubleVals { repeated double vals = 1; }
message AdminCommandRequest { string command = 1; }
message AdminCommandResponse { string result = 1; }
message PerStreamTimeSeriesStatsRequest {
string method = 1;
string streamName = 2;
StatsIntervalVals intervals = 3;
}
message PerStreamTimeSeriesStatsResponse { StatsDoubleVals stats = 1; }
message PerStreamTimeSeriesStatsAllResponse {
map<string, StatsDoubleVals> stats = 1;
}
message PerStreamTimeSeriesStatsAllRequest {
string method = 1;
StatsIntervalVals intervals = 2;
}
// ---------------------------------------------------------------------------
// Messages for Cluster
// ---------------------------------------------------------------------------
message DescribeClusterResponse {
string protocolVersion = 1;
repeated ServerNode serverNodes = 2;
repeated ServerNodeStatus serverNodesStatus = 3;
uint64 clusterUpTime = 4;
}
message ServerNode {
uint32 id = 1;
string host = 2;
uint32 port = 3;
HStreamVersion version = 4;
}
enum NodeState {
Starting = 0;
Running = 1;
Unavailable = 2;
Dead = 3;
}
message ServerNodeStatus {
ServerNode node = 1;
NodeState state = 2;
}
message HStreamVersion {
string version = 1;
string commit = 2;
}
message LookupShardRequest { uint64 shardId = 1; }
message LookupShardResponse {
uint64 shardId = 1;
ServerNode serverNode = 2;
}
message LookupSubscriptionRequest { string subscriptionId = 1; }
message LookupSubscriptionResponse {
string subscriptionId = 1;
ServerNode serverNode = 2;
}
message LookupShardReaderRequest { string readerId = 1; }
message LookupShardReaderResponse {
string readerId = 1;
ServerNode serverNode = 2;
}
enum ResourceType {
ResStream = 0;
ResSubscription = 1;
ResShard = 2;
ResShardReader = 3;
ResConnector = 4;
ResQuery = 5;
ResView = 6;
}
message LookupResourceRequest {
ResourceType resType = 1;
string resId = 2;
}
message LookupKeyRequest { string partitionKey = 1; }
message GetTailRecordIdRequest {
string streamName = 1;
uint64 shardId = 2;
}
message GetTailRecordIdResponse { RecordId tailRecordId = 1; }
enum StreamStats {
AppendInBytes = 0;
AppendInRecords = 1;
AppendTotal = 2;
AppendFailed = 3;
ReadInBytes = 4;
ReadInBatches = 5;
}
enum SubscriptionStats {
SendOutBytes = 0;
SendOutRecords = 1;
SendOutRecordsFailed = 2;
ResendRecords = 3;
ResendRecordsFailed = 4;
ReceivedAcks = 5;
RequestMessages = 6;
ResponseMessages = 7;
ChecklistSize = 8;
}
enum ConnectorStats {
DeliveredInRecords = 0;
DeliveredInBytes = 1;
IsAlive = 2;
}
enum QueryStats {
TotalInputRecords = 0;
TotalOutputRecords = 1;
TotalExecuteErrors = 2;
}
enum ViewStats { TotalExecuteQueries = 0; }
enum CacheStoreStats {
CSAppendInBytes = 0;
CSAppendInRecords = 1;
CSAppendTotal = 2;
CSAppendFailed = 3;
CSReadInBytes = 4;
CSReadInRecords = 5;
CSDeliveredInRecords = 6;
CSDeliveredTotal = 7;
CSDeliveredFailed = 8;
}
message StatType {
oneof stat {
StreamStats streamStat = 1;
SubscriptionStats subStat = 2;
ConnectorStats connStat = 3;
QueryStats queryStat = 4;
ViewStats viewStat = 5;
CacheStoreStats cacheStoreStat = 6;
}
}
message StatValue {
StatType statType = 1;
map<string, int64> statValues = 2;
}
message StatError {
StatType statType = 1;
string message = 2;
}
message GetStatsRequest { repeated StatType stats = 1; }
message GetStatsResponse {
repeated StatValue statsValues = 1;
repeated StatError errors = 2;
}
// ErrorCodes
enum ErrorCode {
// 0xx -> internal error
InternalError = 0;
// 1xx -> Proxy Errors
// 2xx -> Stream Errors
StreamNotFound = 200;
StreamExists = 201;
StreamFoundSubscription = 202;
StreamInvalidReplicaFactor = 203;
StreamInvalidObjectIdentifier = 204;
StreamInvalidShardCount = 205;
StreamEmptyBatchedRecord = 206;
StreamInvalidRecordSize = 207;
StreamInvalidOffset = 208;
StreamInvalidRecordId = 209;
StreamShardNotExists = 210;
// 3xx -> Subscription Errors
SubscriptionNotFound = 300;
SubscriptionExists = 301;
SubscriptionCreationOnNonExistentStream = 302;
SubscriptionInvalidOffset = 303;
SubscriptionInvalidObjectIdentifier = 304;
SubscriptionFoundActiveConsumers = 305;
// 4xx -> Query Errors
QueryNotFound = 400;
QueryExists = 401;
QueryInvalidSQL = 402;
QueryFoundAssociatedView = 403;
QueryInvalidObjectIdentifier = 404;
QueryStillRunning = 405;
QueryNotRunning = 406;
QueryNotTerminated = 407;
QueryAlreadyTerminated = 408;
// 5xx -> View Errors
ViewNotFound = 500;
ViewExists = 501;
ViewInvalidSQL = 502;
ViewInvalidObjectIdentifier = 503;
// 6xx -> IO
ConnectorNotFound = 600;
ConnectorExists = 601;
ConnectorInvalidType = 602;
ConnectorInvalidObjectIdentifier = 603;
ConnectorCheckFailed = 604;
ConnectorUnimplemented = 605;
ConnectorInvalidStatus = 606;
// 7xx -> Stats
// 8xx -> Cluster
WrongServer = 800;
// 9xx -> ShardReader
ShardReaderInvalidObjectIdentifier = 900;
ShardReaderConflictOffset = 901;
ShardReaderTooManyShards = 902;
ShardReaderDataLossGap = 903;
ShardReaderAccessGap = 904;
ShardReaderNotInConfigGap = 905;
ShardReaderUnknownGap = 906;
}