forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
/
raft.pb.go
2491 lines (2387 loc) · 66 KB
/
raft.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.
// source: cockroach/pkg/storage/raft.proto
// DO NOT EDIT!
package storage
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import cockroach_roachpb3 "github.com/cockroachdb/cockroach/pkg/roachpb"
import cockroach_roachpb "github.com/cockroachdb/cockroach/pkg/roachpb"
import cockroach_storage_storagebase "github.com/cockroachdb/cockroach/pkg/storage/storagebase"
import raftpb "github.com/coreos/etcd/raft/raftpb"
import github_com_cockroachdb_cockroach_pkg_roachpb "github.com/cockroachdb/cockroach/pkg/roachpb"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type SnapshotRequest_Priority int32
const (
SnapshotRequest_UNKNOWN SnapshotRequest_Priority = 0
// RECOVERY is used for a Raft-initiated snapshots and for
// up-replication snapshots (i.e. when a dead node has been
// removed and the range needs to be up-replicated).
SnapshotRequest_RECOVERY SnapshotRequest_Priority = 1
// REBALANCE is used for snapshots involved in rebalancing.
SnapshotRequest_REBALANCE SnapshotRequest_Priority = 2
)
var SnapshotRequest_Priority_name = map[int32]string{
0: "UNKNOWN",
1: "RECOVERY",
2: "REBALANCE",
}
var SnapshotRequest_Priority_value = map[string]int32{
"UNKNOWN": 0,
"RECOVERY": 1,
"REBALANCE": 2,
}
func (x SnapshotRequest_Priority) Enum() *SnapshotRequest_Priority {
p := new(SnapshotRequest_Priority)
*p = x
return p
}
func (x SnapshotRequest_Priority) String() string {
return proto.EnumName(SnapshotRequest_Priority_name, int32(x))
}
func (x *SnapshotRequest_Priority) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(SnapshotRequest_Priority_value, data, "SnapshotRequest_Priority")
if err != nil {
return err
}
*x = SnapshotRequest_Priority(value)
return nil
}
func (SnapshotRequest_Priority) EnumDescriptor() ([]byte, []int) {
return fileDescriptorRaft, []int{5, 0}
}
type SnapshotResponse_Status int32
const (
SnapshotResponse_UNKNOWN SnapshotResponse_Status = 0
SnapshotResponse_ACCEPTED SnapshotResponse_Status = 1
SnapshotResponse_APPLIED SnapshotResponse_Status = 2
SnapshotResponse_ERROR SnapshotResponse_Status = 3
SnapshotResponse_DECLINED SnapshotResponse_Status = 4
)
var SnapshotResponse_Status_name = map[int32]string{
0: "UNKNOWN",
1: "ACCEPTED",
2: "APPLIED",
3: "ERROR",
4: "DECLINED",
}
var SnapshotResponse_Status_value = map[string]int32{
"UNKNOWN": 0,
"ACCEPTED": 1,
"APPLIED": 2,
"ERROR": 3,
"DECLINED": 4,
}
func (x SnapshotResponse_Status) Enum() *SnapshotResponse_Status {
p := new(SnapshotResponse_Status)
*p = x
return p
}
func (x SnapshotResponse_Status) String() string {
return proto.EnumName(SnapshotResponse_Status_name, int32(x))
}
func (x *SnapshotResponse_Status) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(SnapshotResponse_Status_value, data, "SnapshotResponse_Status")
if err != nil {
return err
}
*x = SnapshotResponse_Status(value)
return nil
}
func (SnapshotResponse_Status) EnumDescriptor() ([]byte, []int) {
return fileDescriptorRaft, []int{6, 0}
}
// RaftHeartbeat is a request that contains the barebones information for a
// raftpb.MsgHeartbeat raftpb.Message. RaftHeartbeats are coalesced and sent
// in a RaftMessageRequest, and reconstructed by the receiver into individual
// raftpb.Message protos.
type RaftHeartbeat struct {
RangeID github_com_cockroachdb_cockroach_pkg_roachpb.RangeID `protobuf:"varint,1,opt,name=range_id,json=rangeId,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" json:"range_id"`
FromReplicaID github_com_cockroachdb_cockroach_pkg_roachpb.ReplicaID `protobuf:"varint,2,opt,name=from_replica_id,json=fromReplicaId,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.ReplicaID" json:"from_replica_id"`
ToReplicaID github_com_cockroachdb_cockroach_pkg_roachpb.ReplicaID `protobuf:"varint,3,opt,name=to_replica_id,json=toReplicaId,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.ReplicaID" json:"to_replica_id"`
Term uint64 `protobuf:"varint,4,opt,name=term" json:"term"`
Commit uint64 `protobuf:"varint,5,opt,name=commit" json:"commit"`
Quiesce bool `protobuf:"varint,6,opt,name=quiesce" json:"quiesce"`
}
func (m *RaftHeartbeat) Reset() { *m = RaftHeartbeat{} }
func (m *RaftHeartbeat) String() string { return proto.CompactTextString(m) }
func (*RaftHeartbeat) ProtoMessage() {}
func (*RaftHeartbeat) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{0} }
// RaftMessageRequest is the request used to send raft messages using our
// protobuf-based RPC codec. If a RaftMessageRequest has a non-empty number of
// heartbeats or heartbeat_resps, the contents of the message field is treated
// as a dummy message and discarded. A coalesced heartbeat request's replica
// descriptor's range ID must be zero.
type RaftMessageRequest struct {
RangeID github_com_cockroachdb_cockroach_pkg_roachpb.RangeID `protobuf:"varint,1,opt,name=range_id,json=rangeId,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" json:"range_id"`
FromReplica cockroach_roachpb.ReplicaDescriptor `protobuf:"bytes,2,opt,name=from_replica,json=fromReplica" json:"from_replica"`
ToReplica cockroach_roachpb.ReplicaDescriptor `protobuf:"bytes,3,opt,name=to_replica,json=toReplica" json:"to_replica"`
Message raftpb.Message `protobuf:"bytes,4,opt,name=message" json:"message"`
// Is this a quiesce request? A quiesce request is a MsgHeartbeat
// which is requesting the recipient to stop ticking its local
// replica as long as the current Raft state matches the heartbeat
// Term/Commit. If the Term/Commit match, the recipient is marked as
// quiescent. If they don't match, the message is passed along to
// Raft which will generate a MsgHeartbeatResp that will unquiesce
// the sender.
Quiesce bool `protobuf:"varint,5,opt,name=quiesce" json:"quiesce"`
// A coalesced heartbeat request is any RaftMessageRequest with a nonzero number of
// heartbeats or heartbeat_resps.
Heartbeats []RaftHeartbeat `protobuf:"bytes,6,rep,name=heartbeats" json:"heartbeats"`
HeartbeatResps []RaftHeartbeat `protobuf:"bytes,7,rep,name=heartbeat_resps,json=heartbeatResps" json:"heartbeat_resps"`
}
func (m *RaftMessageRequest) Reset() { *m = RaftMessageRequest{} }
func (m *RaftMessageRequest) String() string { return proto.CompactTextString(m) }
func (*RaftMessageRequest) ProtoMessage() {}
func (*RaftMessageRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{1} }
type RaftMessageRequestBatch struct {
Requests []RaftMessageRequest `protobuf:"bytes,1,rep,name=requests" json:"requests"`
}
func (m *RaftMessageRequestBatch) Reset() { *m = RaftMessageRequestBatch{} }
func (m *RaftMessageRequestBatch) String() string { return proto.CompactTextString(m) }
func (*RaftMessageRequestBatch) ProtoMessage() {}
func (*RaftMessageRequestBatch) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{2} }
type RaftMessageResponseUnion struct {
Error *cockroach_roachpb3.Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
}
func (m *RaftMessageResponseUnion) Reset() { *m = RaftMessageResponseUnion{} }
func (m *RaftMessageResponseUnion) String() string { return proto.CompactTextString(m) }
func (*RaftMessageResponseUnion) ProtoMessage() {}
func (*RaftMessageResponseUnion) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{3} }
// RaftMessageResponse may be sent to the sender of a
// RaftMessageRequest. RaftMessage does not use the usual
// request/response pattern; it is primarily modeled as a one-way
// stream of requests. Normal 'responses' are usually sent as new
// requests on a separate stream in the other direction.
// RaftMessageResponse is not sent for every RaftMessageRequest, but
// may be used for certain error conditions.
type RaftMessageResponse struct {
RangeID github_com_cockroachdb_cockroach_pkg_roachpb.RangeID `protobuf:"varint,1,opt,name=range_id,json=rangeId,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" json:"range_id"`
FromReplica cockroach_roachpb.ReplicaDescriptor `protobuf:"bytes,2,opt,name=from_replica,json=fromReplica" json:"from_replica"`
ToReplica cockroach_roachpb.ReplicaDescriptor `protobuf:"bytes,3,opt,name=to_replica,json=toReplica" json:"to_replica"`
Union RaftMessageResponseUnion `protobuf:"bytes,4,opt,name=union" json:"union"`
}
func (m *RaftMessageResponse) Reset() { *m = RaftMessageResponse{} }
func (m *RaftMessageResponse) String() string { return proto.CompactTextString(m) }
func (*RaftMessageResponse) ProtoMessage() {}
func (*RaftMessageResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{4} }
// SnapshotRequest is the request used to send streaming snapshot requests.
type SnapshotRequest struct {
Header *SnapshotRequest_Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
// A RocksDB BatchRepr. Multiple kv_batches may be sent across multiple request messages.
KVBatch []byte `protobuf:"bytes,2,opt,name=kv_batch,json=kvBatch" json:"kv_batch,omitempty"`
// These are really raftpb.Entry, but we model them as raw bytes to avoid
// roundtripping through memory. They are separate from the kv_batch to
// allow flexibility in log implementations.
LogEntries [][]byte `protobuf:"bytes,3,rep,name=log_entries,json=logEntries" json:"log_entries,omitempty"`
Final bool `protobuf:"varint,4,opt,name=final" json:"final"`
}
func (m *SnapshotRequest) Reset() { *m = SnapshotRequest{} }
func (m *SnapshotRequest) String() string { return proto.CompactTextString(m) }
func (*SnapshotRequest) ProtoMessage() {}
func (*SnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{5} }
type SnapshotRequest_Header struct {
// The replica state at the time the snapshot was generated. Note
// that ReplicaState.Desc differs from the above range_descriptor
// field which holds the updated descriptor after the new replica
// has been added while ReplicaState.Desc holds the descriptor
// before the new replica has been added.
State cockroach_storage_storagebase.ReplicaState `protobuf:"bytes,5,opt,name=state" json:"state"`
// The inner raft message is of type MsgSnap, and its snapshot data contains a UUID.
RaftMessageRequest RaftMessageRequest `protobuf:"bytes,2,opt,name=raft_message_request,json=raftMessageRequest" json:"raft_message_request"`
// The estimated size of the range, to be used in reservation decisions.
RangeSize int64 `protobuf:"varint,3,opt,name=range_size,json=rangeSize" json:"range_size"`
// can_decline is set on preemptive snapshots, but not those generated
// by raft because at that point it is better to queue up the stream
// than to cancel it.
CanDecline bool `protobuf:"varint,4,opt,name=can_decline,json=canDecline" json:"can_decline"`
// The priority of the snapshot.
Priority SnapshotRequest_Priority `protobuf:"varint,6,opt,name=priority,enum=cockroach.storage.SnapshotRequest_Priority" json:"priority"`
}
func (m *SnapshotRequest_Header) Reset() { *m = SnapshotRequest_Header{} }
func (m *SnapshotRequest_Header) String() string { return proto.CompactTextString(m) }
func (*SnapshotRequest_Header) ProtoMessage() {}
func (*SnapshotRequest_Header) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{5, 0} }
type SnapshotResponse struct {
Status SnapshotResponse_Status `protobuf:"varint,1,opt,name=status,enum=cockroach.storage.SnapshotResponse_Status" json:"status"`
Message string `protobuf:"bytes,2,opt,name=message" json:"message"`
}
func (m *SnapshotResponse) Reset() { *m = SnapshotResponse{} }
func (m *SnapshotResponse) String() string { return proto.CompactTextString(m) }
func (*SnapshotResponse) ProtoMessage() {}
func (*SnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{6} }
// ConfChangeContext is encoded in the raftpb.ConfChange.Context field.
type ConfChangeContext struct {
CommandID string `protobuf:"bytes,1,opt,name=command_id,json=commandId" json:"command_id"`
// Payload is the application-level command (i.e. an encoded
// storagebase.RaftCommand).
Payload []byte `protobuf:"bytes,2,opt,name=payload" json:"payload,omitempty"`
// Replica contains full details about the replica being added or removed.
Replica cockroach_roachpb.ReplicaDescriptor `protobuf:"bytes,3,opt,name=replica" json:"replica"`
}
func (m *ConfChangeContext) Reset() { *m = ConfChangeContext{} }
func (m *ConfChangeContext) String() string { return proto.CompactTextString(m) }
func (*ConfChangeContext) ProtoMessage() {}
func (*ConfChangeContext) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{7} }
func init() {
proto.RegisterType((*RaftHeartbeat)(nil), "cockroach.storage.RaftHeartbeat")
proto.RegisterType((*RaftMessageRequest)(nil), "cockroach.storage.RaftMessageRequest")
proto.RegisterType((*RaftMessageRequestBatch)(nil), "cockroach.storage.RaftMessageRequestBatch")
proto.RegisterType((*RaftMessageResponseUnion)(nil), "cockroach.storage.RaftMessageResponseUnion")
proto.RegisterType((*RaftMessageResponse)(nil), "cockroach.storage.RaftMessageResponse")
proto.RegisterType((*SnapshotRequest)(nil), "cockroach.storage.SnapshotRequest")
proto.RegisterType((*SnapshotRequest_Header)(nil), "cockroach.storage.SnapshotRequest.Header")
proto.RegisterType((*SnapshotResponse)(nil), "cockroach.storage.SnapshotResponse")
proto.RegisterType((*ConfChangeContext)(nil), "cockroach.storage.ConfChangeContext")
proto.RegisterEnum("cockroach.storage.SnapshotRequest_Priority", SnapshotRequest_Priority_name, SnapshotRequest_Priority_value)
proto.RegisterEnum("cockroach.storage.SnapshotResponse_Status", SnapshotResponse_Status_name, SnapshotResponse_Status_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 MultiRaft service
type MultiRaftClient interface {
RaftMessageBatch(ctx context.Context, opts ...grpc.CallOption) (MultiRaft_RaftMessageBatchClient, error)
RaftSnapshot(ctx context.Context, opts ...grpc.CallOption) (MultiRaft_RaftSnapshotClient, error)
}
type multiRaftClient struct {
cc *grpc.ClientConn
}
func NewMultiRaftClient(cc *grpc.ClientConn) MultiRaftClient {
return &multiRaftClient{cc}
}
func (c *multiRaftClient) RaftMessageBatch(ctx context.Context, opts ...grpc.CallOption) (MultiRaft_RaftMessageBatchClient, error) {
stream, err := grpc.NewClientStream(ctx, &_MultiRaft_serviceDesc.Streams[0], c.cc, "/cockroach.storage.MultiRaft/RaftMessageBatch", opts...)
if err != nil {
return nil, err
}
x := &multiRaftRaftMessageBatchClient{stream}
return x, nil
}
type MultiRaft_RaftMessageBatchClient interface {
Send(*RaftMessageRequestBatch) error
Recv() (*RaftMessageResponse, error)
grpc.ClientStream
}
type multiRaftRaftMessageBatchClient struct {
grpc.ClientStream
}
func (x *multiRaftRaftMessageBatchClient) Send(m *RaftMessageRequestBatch) error {
return x.ClientStream.SendMsg(m)
}
func (x *multiRaftRaftMessageBatchClient) Recv() (*RaftMessageResponse, error) {
m := new(RaftMessageResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *multiRaftClient) RaftSnapshot(ctx context.Context, opts ...grpc.CallOption) (MultiRaft_RaftSnapshotClient, error) {
stream, err := grpc.NewClientStream(ctx, &_MultiRaft_serviceDesc.Streams[1], c.cc, "/cockroach.storage.MultiRaft/RaftSnapshot", opts...)
if err != nil {
return nil, err
}
x := &multiRaftRaftSnapshotClient{stream}
return x, nil
}
type MultiRaft_RaftSnapshotClient interface {
Send(*SnapshotRequest) error
Recv() (*SnapshotResponse, error)
grpc.ClientStream
}
type multiRaftRaftSnapshotClient struct {
grpc.ClientStream
}
func (x *multiRaftRaftSnapshotClient) Send(m *SnapshotRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *multiRaftRaftSnapshotClient) Recv() (*SnapshotResponse, error) {
m := new(SnapshotResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for MultiRaft service
type MultiRaftServer interface {
RaftMessageBatch(MultiRaft_RaftMessageBatchServer) error
RaftSnapshot(MultiRaft_RaftSnapshotServer) error
}
func RegisterMultiRaftServer(s *grpc.Server, srv MultiRaftServer) {
s.RegisterService(&_MultiRaft_serviceDesc, srv)
}
func _MultiRaft_RaftMessageBatch_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(MultiRaftServer).RaftMessageBatch(&multiRaftRaftMessageBatchServer{stream})
}
type MultiRaft_RaftMessageBatchServer interface {
Send(*RaftMessageResponse) error
Recv() (*RaftMessageRequestBatch, error)
grpc.ServerStream
}
type multiRaftRaftMessageBatchServer struct {
grpc.ServerStream
}
func (x *multiRaftRaftMessageBatchServer) Send(m *RaftMessageResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *multiRaftRaftMessageBatchServer) Recv() (*RaftMessageRequestBatch, error) {
m := new(RaftMessageRequestBatch)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _MultiRaft_RaftSnapshot_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(MultiRaftServer).RaftSnapshot(&multiRaftRaftSnapshotServer{stream})
}
type MultiRaft_RaftSnapshotServer interface {
Send(*SnapshotResponse) error
Recv() (*SnapshotRequest, error)
grpc.ServerStream
}
type multiRaftRaftSnapshotServer struct {
grpc.ServerStream
}
func (x *multiRaftRaftSnapshotServer) Send(m *SnapshotResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *multiRaftRaftSnapshotServer) Recv() (*SnapshotRequest, error) {
m := new(SnapshotRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
var _MultiRaft_serviceDesc = grpc.ServiceDesc{
ServiceName: "cockroach.storage.MultiRaft",
HandlerType: (*MultiRaftServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "RaftMessageBatch",
Handler: _MultiRaft_RaftMessageBatch_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "RaftSnapshot",
Handler: _MultiRaft_RaftSnapshot_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "cockroach/pkg/storage/raft.proto",
}
func (m *RaftHeartbeat) 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 *RaftHeartbeat) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintRaft(dAtA, i, uint64(m.RangeID))
dAtA[i] = 0x10
i++
i = encodeVarintRaft(dAtA, i, uint64(m.FromReplicaID))
dAtA[i] = 0x18
i++
i = encodeVarintRaft(dAtA, i, uint64(m.ToReplicaID))
dAtA[i] = 0x20
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Term))
dAtA[i] = 0x28
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Commit))
dAtA[i] = 0x30
i++
if m.Quiesce {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
return i, nil
}
func (m *RaftMessageRequest) 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 *RaftMessageRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintRaft(dAtA, i, uint64(m.RangeID))
dAtA[i] = 0x12
i++
i = encodeVarintRaft(dAtA, i, uint64(m.FromReplica.Size()))
n1, err := m.FromReplica.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
dAtA[i] = 0x1a
i++
i = encodeVarintRaft(dAtA, i, uint64(m.ToReplica.Size()))
n2, err := m.ToReplica.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
dAtA[i] = 0x22
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Message.Size()))
n3, err := m.Message.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
dAtA[i] = 0x28
i++
if m.Quiesce {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
if len(m.Heartbeats) > 0 {
for _, msg := range m.Heartbeats {
dAtA[i] = 0x32
i++
i = encodeVarintRaft(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.HeartbeatResps) > 0 {
for _, msg := range m.HeartbeatResps {
dAtA[i] = 0x3a
i++
i = encodeVarintRaft(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
return i, nil
}
func (m *RaftMessageRequestBatch) 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 *RaftMessageRequestBatch) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Requests) > 0 {
for _, msg := range m.Requests {
dAtA[i] = 0xa
i++
i = encodeVarintRaft(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
return i, nil
}
func (m *RaftMessageResponseUnion) 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 *RaftMessageResponseUnion) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Error != nil {
dAtA[i] = 0xa
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Error.Size()))
n4, err := m.Error.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
}
return i, nil
}
func (m *RaftMessageResponse) 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 *RaftMessageResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintRaft(dAtA, i, uint64(m.RangeID))
dAtA[i] = 0x12
i++
i = encodeVarintRaft(dAtA, i, uint64(m.FromReplica.Size()))
n5, err := m.FromReplica.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n5
dAtA[i] = 0x1a
i++
i = encodeVarintRaft(dAtA, i, uint64(m.ToReplica.Size()))
n6, err := m.ToReplica.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
dAtA[i] = 0x22
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Union.Size()))
n7, err := m.Union.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n7
return i, nil
}
func (m *SnapshotRequest) 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 *SnapshotRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Header != nil {
dAtA[i] = 0xa
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Header.Size()))
n8, err := m.Header.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n8
}
if m.KVBatch != nil {
dAtA[i] = 0x12
i++
i = encodeVarintRaft(dAtA, i, uint64(len(m.KVBatch)))
i += copy(dAtA[i:], m.KVBatch)
}
if len(m.LogEntries) > 0 {
for _, b := range m.LogEntries {
dAtA[i] = 0x1a
i++
i = encodeVarintRaft(dAtA, i, uint64(len(b)))
i += copy(dAtA[i:], b)
}
}
dAtA[i] = 0x20
i++
if m.Final {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
return i, nil
}
func (m *SnapshotRequest_Header) 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 *SnapshotRequest_Header) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0x12
i++
i = encodeVarintRaft(dAtA, i, uint64(m.RaftMessageRequest.Size()))
n9, err := m.RaftMessageRequest.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n9
dAtA[i] = 0x18
i++
i = encodeVarintRaft(dAtA, i, uint64(m.RangeSize))
dAtA[i] = 0x20
i++
if m.CanDecline {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
dAtA[i] = 0x2a
i++
i = encodeVarintRaft(dAtA, i, uint64(m.State.Size()))
n10, err := m.State.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n10
dAtA[i] = 0x30
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Priority))
return i, nil
}
func (m *SnapshotResponse) 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 *SnapshotResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Status))
dAtA[i] = 0x12
i++
i = encodeVarintRaft(dAtA, i, uint64(len(m.Message)))
i += copy(dAtA[i:], m.Message)
return i, nil
}
func (m *ConfChangeContext) 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 *ConfChangeContext) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintRaft(dAtA, i, uint64(len(m.CommandID)))
i += copy(dAtA[i:], m.CommandID)
if m.Payload != nil {
dAtA[i] = 0x12
i++
i = encodeVarintRaft(dAtA, i, uint64(len(m.Payload)))
i += copy(dAtA[i:], m.Payload)
}
dAtA[i] = 0x1a
i++
i = encodeVarintRaft(dAtA, i, uint64(m.Replica.Size()))
n11, err := m.Replica.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n11
return i, nil
}
func encodeFixed64Raft(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Raft(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintRaft(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *RaftHeartbeat) Size() (n int) {
var l int
_ = l
n += 1 + sovRaft(uint64(m.RangeID))
n += 1 + sovRaft(uint64(m.FromReplicaID))
n += 1 + sovRaft(uint64(m.ToReplicaID))
n += 1 + sovRaft(uint64(m.Term))
n += 1 + sovRaft(uint64(m.Commit))
n += 2
return n
}
func (m *RaftMessageRequest) Size() (n int) {
var l int
_ = l
n += 1 + sovRaft(uint64(m.RangeID))
l = m.FromReplica.Size()
n += 1 + l + sovRaft(uint64(l))
l = m.ToReplica.Size()
n += 1 + l + sovRaft(uint64(l))
l = m.Message.Size()
n += 1 + l + sovRaft(uint64(l))
n += 2
if len(m.Heartbeats) > 0 {
for _, e := range m.Heartbeats {
l = e.Size()
n += 1 + l + sovRaft(uint64(l))
}
}
if len(m.HeartbeatResps) > 0 {
for _, e := range m.HeartbeatResps {
l = e.Size()
n += 1 + l + sovRaft(uint64(l))
}
}
return n
}
func (m *RaftMessageRequestBatch) Size() (n int) {
var l int
_ = l
if len(m.Requests) > 0 {
for _, e := range m.Requests {
l = e.Size()
n += 1 + l + sovRaft(uint64(l))
}
}
return n
}
func (m *RaftMessageResponseUnion) Size() (n int) {
var l int
_ = l
if m.Error != nil {
l = m.Error.Size()
n += 1 + l + sovRaft(uint64(l))
}
return n
}
func (m *RaftMessageResponse) Size() (n int) {
var l int
_ = l
n += 1 + sovRaft(uint64(m.RangeID))
l = m.FromReplica.Size()
n += 1 + l + sovRaft(uint64(l))
l = m.ToReplica.Size()
n += 1 + l + sovRaft(uint64(l))
l = m.Union.Size()
n += 1 + l + sovRaft(uint64(l))
return n
}
func (m *SnapshotRequest) Size() (n int) {
var l int
_ = l
if m.Header != nil {
l = m.Header.Size()
n += 1 + l + sovRaft(uint64(l))
}
if m.KVBatch != nil {
l = len(m.KVBatch)
n += 1 + l + sovRaft(uint64(l))
}
if len(m.LogEntries) > 0 {
for _, b := range m.LogEntries {
l = len(b)
n += 1 + l + sovRaft(uint64(l))
}
}
n += 2
return n
}
func (m *SnapshotRequest_Header) Size() (n int) {
var l int
_ = l
l = m.RaftMessageRequest.Size()
n += 1 + l + sovRaft(uint64(l))
n += 1 + sovRaft(uint64(m.RangeSize))
n += 2
l = m.State.Size()
n += 1 + l + sovRaft(uint64(l))
n += 1 + sovRaft(uint64(m.Priority))
return n
}
func (m *SnapshotResponse) Size() (n int) {
var l int
_ = l
n += 1 + sovRaft(uint64(m.Status))
l = len(m.Message)
n += 1 + l + sovRaft(uint64(l))
return n
}
func (m *ConfChangeContext) Size() (n int) {
var l int
_ = l
l = len(m.CommandID)
n += 1 + l + sovRaft(uint64(l))
if m.Payload != nil {
l = len(m.Payload)
n += 1 + l + sovRaft(uint64(l))
}
l = m.Replica.Size()
n += 1 + l + sovRaft(uint64(l))
return n
}
func sovRaft(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozRaft(x uint64) (n int) {
return sovRaft(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *RaftMessageResponseUnion) GetValue() interface{} {