forked from liftbridge-io/liftbridge-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.pb.go
4306 lines (4131 loc) · 102 KB
/
api.pb.go
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
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: api.proto
/*
Package proto is a generated protocol buffer package.
It is generated from these files:
api.proto
It has these top-level messages:
CreateStreamRequest
CreateStreamResponse
SubscribeRequest
FetchMetadataRequest
FetchMetadataResponse
PublishRequest
PublishResponse
Broker
StreamMetadata
PartitionMetadata
Message
Ack
*/
package proto
import proto1 "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import context "golang.org/x/net/context"
import grpc "google.golang.org/grpc"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto1.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package
// StartPosition determines the start-position type on a subscription.
type StartPosition int32
const (
StartPosition_NEW_ONLY StartPosition = 0
StartPosition_OFFSET StartPosition = 1
StartPosition_EARLIEST StartPosition = 2
StartPosition_LATEST StartPosition = 3
StartPosition_TIMESTAMP StartPosition = 4
)
var StartPosition_name = map[int32]string{
0: "NEW_ONLY",
1: "OFFSET",
2: "EARLIEST",
3: "LATEST",
4: "TIMESTAMP",
}
var StartPosition_value = map[string]int32{
"NEW_ONLY": 0,
"OFFSET": 1,
"EARLIEST": 2,
"LATEST": 3,
"TIMESTAMP": 4,
}
func (x StartPosition) String() string {
return proto1.EnumName(StartPosition_name, int32(x))
}
func (StartPosition) EnumDescriptor() ([]byte, []int) { return fileDescriptorApi, []int{0} }
// AckPolicy controls the behavior of message acknowledgements.
type AckPolicy int32
const (
AckPolicy_LEADER AckPolicy = 0
AckPolicy_ALL AckPolicy = 1
AckPolicy_NONE AckPolicy = 2
)
var AckPolicy_name = map[int32]string{
0: "LEADER",
1: "ALL",
2: "NONE",
}
var AckPolicy_value = map[string]int32{
"LEADER": 0,
"ALL": 1,
"NONE": 2,
}
func (x AckPolicy) String() string {
return proto1.EnumName(AckPolicy_name, int32(x))
}
func (AckPolicy) EnumDescriptor() ([]byte, []int) { return fileDescriptorApi, []int{1} }
type StreamMetadata_Error int32
const (
StreamMetadata_OK StreamMetadata_Error = 0
StreamMetadata_UNKNOWN_STREAM StreamMetadata_Error = 1
)
var StreamMetadata_Error_name = map[int32]string{
0: "OK",
1: "UNKNOWN_STREAM",
}
var StreamMetadata_Error_value = map[string]int32{
"OK": 0,
"UNKNOWN_STREAM": 1,
}
func (x StreamMetadata_Error) String() string {
return proto1.EnumName(StreamMetadata_Error_name, int32(x))
}
func (StreamMetadata_Error) EnumDescriptor() ([]byte, []int) { return fileDescriptorApi, []int{8, 0} }
// CreateStreamRequest is sent to create a new stream.
type CreateStreamRequest struct {
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Group string `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"`
ReplicationFactor int32 `protobuf:"varint,4,opt,name=replicationFactor,proto3" json:"replicationFactor,omitempty"`
Partitions int32 `protobuf:"varint,5,opt,name=partitions,proto3" json:"partitions,omitempty"`
}
func (m *CreateStreamRequest) Reset() { *m = CreateStreamRequest{} }
func (m *CreateStreamRequest) String() string { return proto1.CompactTextString(m) }
func (*CreateStreamRequest) ProtoMessage() {}
func (*CreateStreamRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{0} }
func (m *CreateStreamRequest) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *CreateStreamRequest) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *CreateStreamRequest) GetGroup() string {
if m != nil {
return m.Group
}
return ""
}
func (m *CreateStreamRequest) GetReplicationFactor() int32 {
if m != nil {
return m.ReplicationFactor
}
return 0
}
func (m *CreateStreamRequest) GetPartitions() int32 {
if m != nil {
return m.Partitions
}
return 0
}
// CreateStreamResponse is sent by server after creating a stream.
type CreateStreamResponse struct {
}
func (m *CreateStreamResponse) Reset() { *m = CreateStreamResponse{} }
func (m *CreateStreamResponse) String() string { return proto1.CompactTextString(m) }
func (*CreateStreamResponse) ProtoMessage() {}
func (*CreateStreamResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{1} }
// SubscribeRequest is sent to subscribe to a stream partition.
type SubscribeRequest struct {
Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"`
Partition int32 `protobuf:"varint,2,opt,name=partition,proto3" json:"partition,omitempty"`
StartPosition StartPosition `protobuf:"varint,3,opt,name=startPosition,proto3,enum=proto.StartPosition" json:"startPosition,omitempty"`
StartOffset int64 `protobuf:"varint,4,opt,name=startOffset,proto3" json:"startOffset,omitempty"`
StartTimestamp int64 `protobuf:"varint,5,opt,name=startTimestamp,proto3" json:"startTimestamp,omitempty"`
}
func (m *SubscribeRequest) Reset() { *m = SubscribeRequest{} }
func (m *SubscribeRequest) String() string { return proto1.CompactTextString(m) }
func (*SubscribeRequest) ProtoMessage() {}
func (*SubscribeRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{2} }
func (m *SubscribeRequest) GetStream() string {
if m != nil {
return m.Stream
}
return ""
}
func (m *SubscribeRequest) GetPartition() int32 {
if m != nil {
return m.Partition
}
return 0
}
func (m *SubscribeRequest) GetStartPosition() StartPosition {
if m != nil {
return m.StartPosition
}
return StartPosition_NEW_ONLY
}
func (m *SubscribeRequest) GetStartOffset() int64 {
if m != nil {
return m.StartOffset
}
return 0
}
func (m *SubscribeRequest) GetStartTimestamp() int64 {
if m != nil {
return m.StartTimestamp
}
return 0
}
// FetchMetadataRequest is sent to retrieve the latest cluster metadata.
type FetchMetadataRequest struct {
Streams []string `protobuf:"bytes,1,rep,name=streams" json:"streams,omitempty"`
}
func (m *FetchMetadataRequest) Reset() { *m = FetchMetadataRequest{} }
func (m *FetchMetadataRequest) String() string { return proto1.CompactTextString(m) }
func (*FetchMetadataRequest) ProtoMessage() {}
func (*FetchMetadataRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{3} }
func (m *FetchMetadataRequest) GetStreams() []string {
if m != nil {
return m.Streams
}
return nil
}
// FetchMetadataResponse contains the cluster metadata requested.
type FetchMetadataResponse struct {
Brokers []*Broker `protobuf:"bytes,1,rep,name=brokers" json:"brokers,omitempty"`
Metadata []*StreamMetadata `protobuf:"bytes,2,rep,name=metadata" json:"metadata,omitempty"`
}
func (m *FetchMetadataResponse) Reset() { *m = FetchMetadataResponse{} }
func (m *FetchMetadataResponse) String() string { return proto1.CompactTextString(m) }
func (*FetchMetadataResponse) ProtoMessage() {}
func (*FetchMetadataResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{4} }
func (m *FetchMetadataResponse) GetBrokers() []*Broker {
if m != nil {
return m.Brokers
}
return nil
}
func (m *FetchMetadataResponse) GetMetadata() []*StreamMetadata {
if m != nil {
return m.Metadata
}
return nil
}
// PublishRequest is sent to publish a new message.
type PublishRequest struct {
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
Stream string `protobuf:"bytes,3,opt,name=stream,proto3" json:"stream,omitempty"`
Partition int32 `protobuf:"varint,4,opt,name=partition,proto3" json:"partition,omitempty"`
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
ReplySubject string `protobuf:"bytes,6,opt,name=replySubject,proto3" json:"replySubject,omitempty"`
Headers map[string][]byte `protobuf:"bytes,7,rep,name=headers" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
AckInbox string `protobuf:"bytes,8,opt,name=ackInbox,proto3" json:"ackInbox,omitempty"`
CorrelationId string `protobuf:"bytes,9,opt,name=correlationId,proto3" json:"correlationId,omitempty"`
AckPolicy AckPolicy `protobuf:"varint,10,opt,name=ackPolicy,proto3,enum=proto.AckPolicy" json:"ackPolicy,omitempty"`
}
func (m *PublishRequest) Reset() { *m = PublishRequest{} }
func (m *PublishRequest) String() string { return proto1.CompactTextString(m) }
func (*PublishRequest) ProtoMessage() {}
func (*PublishRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{5} }
func (m *PublishRequest) GetKey() []byte {
if m != nil {
return m.Key
}
return nil
}
func (m *PublishRequest) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
func (m *PublishRequest) GetStream() string {
if m != nil {
return m.Stream
}
return ""
}
func (m *PublishRequest) GetPartition() int32 {
if m != nil {
return m.Partition
}
return 0
}
func (m *PublishRequest) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *PublishRequest) GetReplySubject() string {
if m != nil {
return m.ReplySubject
}
return ""
}
func (m *PublishRequest) GetHeaders() map[string][]byte {
if m != nil {
return m.Headers
}
return nil
}
func (m *PublishRequest) GetAckInbox() string {
if m != nil {
return m.AckInbox
}
return ""
}
func (m *PublishRequest) GetCorrelationId() string {
if m != nil {
return m.CorrelationId
}
return ""
}
func (m *PublishRequest) GetAckPolicy() AckPolicy {
if m != nil {
return m.AckPolicy
}
return AckPolicy_LEADER
}
// PublishResponse is sent by the server after publishing a message.
type PublishResponse struct {
Ack *Ack `protobuf:"bytes,1,opt,name=ack" json:"ack,omitempty"`
}
func (m *PublishResponse) Reset() { *m = PublishResponse{} }
func (m *PublishResponse) String() string { return proto1.CompactTextString(m) }
func (*PublishResponse) ProtoMessage() {}
func (*PublishResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{6} }
func (m *PublishResponse) GetAck() *Ack {
if m != nil {
return m.Ack
}
return nil
}
// Broker contains information for a Liftbridge broker.
type Broker struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"`
Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
}
func (m *Broker) Reset() { *m = Broker{} }
func (m *Broker) String() string { return proto1.CompactTextString(m) }
func (*Broker) ProtoMessage() {}
func (*Broker) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{7} }
func (m *Broker) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Broker) GetHost() string {
if m != nil {
return m.Host
}
return ""
}
func (m *Broker) GetPort() int32 {
if m != nil {
return m.Port
}
return 0
}
// StreamMetadata contains information for a stream.
type StreamMetadata struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"`
Error StreamMetadata_Error `protobuf:"varint,3,opt,name=error,proto3,enum=proto.StreamMetadata_Error" json:"error,omitempty"`
Partitions map[int32]*PartitionMetadata `protobuf:"bytes,4,rep,name=partitions" json:"partitions,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
}
func (m *StreamMetadata) Reset() { *m = StreamMetadata{} }
func (m *StreamMetadata) String() string { return proto1.CompactTextString(m) }
func (*StreamMetadata) ProtoMessage() {}
func (*StreamMetadata) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{8} }
func (m *StreamMetadata) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *StreamMetadata) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *StreamMetadata) GetError() StreamMetadata_Error {
if m != nil {
return m.Error
}
return StreamMetadata_OK
}
func (m *StreamMetadata) GetPartitions() map[int32]*PartitionMetadata {
if m != nil {
return m.Partitions
}
return nil
}
// PartitionMetadata contains information for a stream partition.
type PartitionMetadata struct {
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Leader string `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"`
Replicas []string `protobuf:"bytes,3,rep,name=replicas" json:"replicas,omitempty"`
Isr []string `protobuf:"bytes,4,rep,name=isr" json:"isr,omitempty"`
}
func (m *PartitionMetadata) Reset() { *m = PartitionMetadata{} }
func (m *PartitionMetadata) String() string { return proto1.CompactTextString(m) }
func (*PartitionMetadata) ProtoMessage() {}
func (*PartitionMetadata) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{9} }
func (m *PartitionMetadata) GetId() int32 {
if m != nil {
return m.Id
}
return 0
}
func (m *PartitionMetadata) GetLeader() string {
if m != nil {
return m.Leader
}
return ""
}
func (m *PartitionMetadata) GetReplicas() []string {
if m != nil {
return m.Replicas
}
return nil
}
func (m *PartitionMetadata) GetIsr() []string {
if m != nil {
return m.Isr
}
return nil
}
// Message represents a message from a stream.
type Message struct {
Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Stream string `protobuf:"bytes,5,opt,name=stream,proto3" json:"stream,omitempty"`
Partition int32 `protobuf:"varint,6,opt,name=partition,proto3" json:"partition,omitempty"`
Subject string `protobuf:"bytes,7,opt,name=subject,proto3" json:"subject,omitempty"`
ReplySubject string `protobuf:"bytes,8,opt,name=replySubject,proto3" json:"replySubject,omitempty"`
Headers map[string][]byte `protobuf:"bytes,9,rep,name=headers" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
AckInbox string `protobuf:"bytes,10,opt,name=ackInbox,proto3" json:"ackInbox,omitempty"`
CorrelationId string `protobuf:"bytes,11,opt,name=correlationId,proto3" json:"correlationId,omitempty"`
AckPolicy AckPolicy `protobuf:"varint,12,opt,name=ackPolicy,proto3,enum=proto.AckPolicy" json:"ackPolicy,omitempty"`
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto1.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{10} }
func (m *Message) GetOffset() int64 {
if m != nil {
return m.Offset
}
return 0
}
func (m *Message) GetKey() []byte {
if m != nil {
return m.Key
}
return nil
}
func (m *Message) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
func (m *Message) GetTimestamp() int64 {
if m != nil {
return m.Timestamp
}
return 0
}
func (m *Message) GetStream() string {
if m != nil {
return m.Stream
}
return ""
}
func (m *Message) GetPartition() int32 {
if m != nil {
return m.Partition
}
return 0
}
func (m *Message) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *Message) GetReplySubject() string {
if m != nil {
return m.ReplySubject
}
return ""
}
func (m *Message) GetHeaders() map[string][]byte {
if m != nil {
return m.Headers
}
return nil
}
func (m *Message) GetAckInbox() string {
if m != nil {
return m.AckInbox
}
return ""
}
func (m *Message) GetCorrelationId() string {
if m != nil {
return m.CorrelationId
}
return ""
}
func (m *Message) GetAckPolicy() AckPolicy {
if m != nil {
return m.AckPolicy
}
return AckPolicy_LEADER
}
// Ack represents an acknowledgement that a message was committed to a stream
// partition.
type Ack struct {
Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"`
PartitionSubject string `protobuf:"bytes,2,opt,name=partitionSubject,proto3" json:"partitionSubject,omitempty"`
MsgSubject string `protobuf:"bytes,3,opt,name=msgSubject,proto3" json:"msgSubject,omitempty"`
Offset int64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"`
AckInbox string `protobuf:"bytes,5,opt,name=ackInbox,proto3" json:"ackInbox,omitempty"`
CorrelationId string `protobuf:"bytes,6,opt,name=correlationId,proto3" json:"correlationId,omitempty"`
AckPolicy AckPolicy `protobuf:"varint,7,opt,name=ackPolicy,proto3,enum=proto.AckPolicy" json:"ackPolicy,omitempty"`
}
func (m *Ack) Reset() { *m = Ack{} }
func (m *Ack) String() string { return proto1.CompactTextString(m) }
func (*Ack) ProtoMessage() {}
func (*Ack) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{11} }
func (m *Ack) GetStream() string {
if m != nil {
return m.Stream
}
return ""
}
func (m *Ack) GetPartitionSubject() string {
if m != nil {
return m.PartitionSubject
}
return ""
}
func (m *Ack) GetMsgSubject() string {
if m != nil {
return m.MsgSubject
}
return ""
}
func (m *Ack) GetOffset() int64 {
if m != nil {
return m.Offset
}
return 0
}
func (m *Ack) GetAckInbox() string {
if m != nil {
return m.AckInbox
}
return ""
}
func (m *Ack) GetCorrelationId() string {
if m != nil {
return m.CorrelationId
}
return ""
}
func (m *Ack) GetAckPolicy() AckPolicy {
if m != nil {
return m.AckPolicy
}
return AckPolicy_LEADER
}
func init() {
proto1.RegisterType((*CreateStreamRequest)(nil), "proto.CreateStreamRequest")
proto1.RegisterType((*CreateStreamResponse)(nil), "proto.CreateStreamResponse")
proto1.RegisterType((*SubscribeRequest)(nil), "proto.SubscribeRequest")
proto1.RegisterType((*FetchMetadataRequest)(nil), "proto.FetchMetadataRequest")
proto1.RegisterType((*FetchMetadataResponse)(nil), "proto.FetchMetadataResponse")
proto1.RegisterType((*PublishRequest)(nil), "proto.PublishRequest")
proto1.RegisterType((*PublishResponse)(nil), "proto.PublishResponse")
proto1.RegisterType((*Broker)(nil), "proto.Broker")
proto1.RegisterType((*StreamMetadata)(nil), "proto.StreamMetadata")
proto1.RegisterType((*PartitionMetadata)(nil), "proto.PartitionMetadata")
proto1.RegisterType((*Message)(nil), "proto.Message")
proto1.RegisterType((*Ack)(nil), "proto.Ack")
proto1.RegisterEnum("proto.StartPosition", StartPosition_name, StartPosition_value)
proto1.RegisterEnum("proto.AckPolicy", AckPolicy_name, AckPolicy_value)
proto1.RegisterEnum("proto.StreamMetadata_Error", StreamMetadata_Error_name, StreamMetadata_Error_value)
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for API service
type APIClient interface {
// CreateStream creates a new stream attached to a NATS subject. It returns
// an AlreadyExists status code if a stream with the given subject and name
// already exists.
CreateStream(ctx context.Context, in *CreateStreamRequest, opts ...grpc.CallOption) (*CreateStreamResponse, error)
// Subscribe creates an ephemeral subscription for the given stream. It
// begins to receive messages starting at the given offset and waits for
// new messages when it reaches the end of the stream. Use the request
// context to close the subscription.
Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (API_SubscribeClient, error)
// FetchMetadata retrieves the latest cluster metadata, including stream
// broker information.
FetchMetadata(ctx context.Context, in *FetchMetadataRequest, opts ...grpc.CallOption) (*FetchMetadataResponse, error)
// Publish a new message to a subject. If the AckPolicy is not NONE and a
// deadline is provided, this will synchronously block until the ack is
// received. If the ack is not received in time, a DeadlineExceeded status
// code is returned.
Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error)
}
type aPIClient struct {
cc *grpc.ClientConn
}
func NewAPIClient(cc *grpc.ClientConn) APIClient {
return &aPIClient{cc}
}
func (c *aPIClient) CreateStream(ctx context.Context, in *CreateStreamRequest, opts ...grpc.CallOption) (*CreateStreamResponse, error) {
out := new(CreateStreamResponse)
err := grpc.Invoke(ctx, "/proto.API/CreateStream", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *aPIClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (API_SubscribeClient, error) {
stream, err := grpc.NewClientStream(ctx, &_API_serviceDesc.Streams[0], c.cc, "/proto.API/Subscribe", opts...)
if err != nil {
return nil, err
}
x := &aPISubscribeClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type API_SubscribeClient interface {
Recv() (*Message, error)
grpc.ClientStream
}
type aPISubscribeClient struct {
grpc.ClientStream
}
func (x *aPISubscribeClient) Recv() (*Message, error) {
m := new(Message)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *aPIClient) FetchMetadata(ctx context.Context, in *FetchMetadataRequest, opts ...grpc.CallOption) (*FetchMetadataResponse, error) {
out := new(FetchMetadataResponse)
err := grpc.Invoke(ctx, "/proto.API/FetchMetadata", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *aPIClient) Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error) {
out := new(PublishResponse)
err := grpc.Invoke(ctx, "/proto.API/Publish", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for API service
type APIServer interface {
// CreateStream creates a new stream attached to a NATS subject. It returns
// an AlreadyExists status code if a stream with the given subject and name
// already exists.
CreateStream(context.Context, *CreateStreamRequest) (*CreateStreamResponse, error)
// Subscribe creates an ephemeral subscription for the given stream. It
// begins to receive messages starting at the given offset and waits for
// new messages when it reaches the end of the stream. Use the request
// context to close the subscription.
Subscribe(*SubscribeRequest, API_SubscribeServer) error
// FetchMetadata retrieves the latest cluster metadata, including stream
// broker information.
FetchMetadata(context.Context, *FetchMetadataRequest) (*FetchMetadataResponse, error)
// Publish a new message to a subject. If the AckPolicy is not NONE and a
// deadline is provided, this will synchronously block until the ack is
// received. If the ack is not received in time, a DeadlineExceeded status
// code is returned.
Publish(context.Context, *PublishRequest) (*PublishResponse, error)
}
func RegisterAPIServer(s *grpc.Server, srv APIServer) {
s.RegisterService(&_API_serviceDesc, srv)
}
func _API_CreateStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateStreamRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(APIServer).CreateStream(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.API/CreateStream",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(APIServer).CreateStream(ctx, req.(*CreateStreamRequest))
}
return interceptor(ctx, in, info, handler)
}
func _API_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(SubscribeRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(APIServer).Subscribe(m, &aPISubscribeServer{stream})
}
type API_SubscribeServer interface {
Send(*Message) error
grpc.ServerStream
}
type aPISubscribeServer struct {
grpc.ServerStream
}
func (x *aPISubscribeServer) Send(m *Message) error {
return x.ServerStream.SendMsg(m)
}
func _API_FetchMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FetchMetadataRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(APIServer).FetchMetadata(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.API/FetchMetadata",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(APIServer).FetchMetadata(ctx, req.(*FetchMetadataRequest))
}
return interceptor(ctx, in, info, handler)
}
func _API_Publish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PublishRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(APIServer).Publish(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.API/Publish",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(APIServer).Publish(ctx, req.(*PublishRequest))
}
return interceptor(ctx, in, info, handler)
}
var _API_serviceDesc = grpc.ServiceDesc{
ServiceName: "proto.API",
HandlerType: (*APIServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateStream",
Handler: _API_CreateStream_Handler,
},
{
MethodName: "FetchMetadata",
Handler: _API_FetchMetadata_Handler,
},
{
MethodName: "Publish",
Handler: _API_Publish_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Subscribe",
Handler: _API_Subscribe_Handler,
ServerStreams: true,
},
},
Metadata: "api.proto",
}
func (m *CreateStreamRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CreateStreamRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Subject) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Subject)))
i += copy(dAtA[i:], m.Subject)
}
if len(m.Name) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if len(m.Group) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Group)))
i += copy(dAtA[i:], m.Group)
}
if m.ReplicationFactor != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintApi(dAtA, i, uint64(m.ReplicationFactor))
}
if m.Partitions != 0 {
dAtA[i] = 0x28
i++
i = encodeVarintApi(dAtA, i, uint64(m.Partitions))
}
return i, nil
}
func (m *CreateStreamResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CreateStreamResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
return i, nil
}
func (m *SubscribeRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *SubscribeRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Stream) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Stream)))
i += copy(dAtA[i:], m.Stream)
}
if m.Partition != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintApi(dAtA, i, uint64(m.Partition))
}
if m.StartPosition != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintApi(dAtA, i, uint64(m.StartPosition))