1// Code generated by protoc-gen-gogo. 2// source: raft.proto 3// DO NOT EDIT! 4 5/* 6 Package raftpb is a generated protocol buffer package. 7 8 It is generated from these files: 9 raft.proto 10 11 It has these top-level messages: 12 Entry 13 SnapshotMetadata 14 Snapshot 15 Message 16 HardState 17 ConfState 18 ConfChange 19*/ 20package raftpb 21 22import ( 23 "fmt" 24 25 proto "github.com/golang/protobuf/proto" 26 27 math "math" 28 29 io "io" 30) 31 32// Reference imports to suppress errors if they are not otherwise used. 33var _ = proto.Marshal 34var _ = fmt.Errorf 35var _ = math.Inf 36 37// This is a compile-time assertion to ensure that this generated file 38// is compatible with the proto package it is being compiled against. 39// A compilation error at this line likely means your copy of the 40// proto package needs to be updated. 41const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 42 43type EntryType int32 44 45const ( 46 EntryNormal EntryType = 0 47 EntryConfChange EntryType = 1 48) 49 50var EntryType_name = map[int32]string{ 51 0: "EntryNormal", 52 1: "EntryConfChange", 53} 54var EntryType_value = map[string]int32{ 55 "EntryNormal": 0, 56 "EntryConfChange": 1, 57} 58 59func (x EntryType) Enum() *EntryType { 60 p := new(EntryType) 61 *p = x 62 return p 63} 64func (x EntryType) String() string { 65 return proto.EnumName(EntryType_name, int32(x)) 66} 67func (x *EntryType) UnmarshalJSON(data []byte) error { 68 value, err := proto.UnmarshalJSONEnum(EntryType_value, data, "EntryType") 69 if err != nil { 70 return err 71 } 72 *x = EntryType(value) 73 return nil 74} 75func (EntryType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaft, []int{0} } 76 77type MessageType int32 78 79const ( 80 MsgHup MessageType = 0 81 MsgBeat MessageType = 1 82 MsgProp MessageType = 2 83 MsgApp MessageType = 3 84 MsgAppResp MessageType = 4 85 MsgVote MessageType = 5 86 MsgVoteResp MessageType = 6 87 MsgSnap MessageType = 7 88 MsgHeartbeat MessageType = 8 89 MsgHeartbeatResp MessageType = 9 90 MsgUnreachable MessageType = 10 91 MsgSnapStatus MessageType = 11 92 MsgCheckQuorum MessageType = 12 93 MsgTransferLeader MessageType = 13 94 MsgTimeoutNow MessageType = 14 95 MsgReadIndex MessageType = 15 96 MsgReadIndexResp MessageType = 16 97 MsgPreVote MessageType = 17 98 MsgPreVoteResp MessageType = 18 99) 100 101var MessageType_name = map[int32]string{ 102 0: "MsgHup", 103 1: "MsgBeat", 104 2: "MsgProp", 105 3: "MsgApp", 106 4: "MsgAppResp", 107 5: "MsgVote", 108 6: "MsgVoteResp", 109 7: "MsgSnap", 110 8: "MsgHeartbeat", 111 9: "MsgHeartbeatResp", 112 10: "MsgUnreachable", 113 11: "MsgSnapStatus", 114 12: "MsgCheckQuorum", 115 13: "MsgTransferLeader", 116 14: "MsgTimeoutNow", 117 15: "MsgReadIndex", 118 16: "MsgReadIndexResp", 119 17: "MsgPreVote", 120 18: "MsgPreVoteResp", 121} 122var MessageType_value = map[string]int32{ 123 "MsgHup": 0, 124 "MsgBeat": 1, 125 "MsgProp": 2, 126 "MsgApp": 3, 127 "MsgAppResp": 4, 128 "MsgVote": 5, 129 "MsgVoteResp": 6, 130 "MsgSnap": 7, 131 "MsgHeartbeat": 8, 132 "MsgHeartbeatResp": 9, 133 "MsgUnreachable": 10, 134 "MsgSnapStatus": 11, 135 "MsgCheckQuorum": 12, 136 "MsgTransferLeader": 13, 137 "MsgTimeoutNow": 14, 138 "MsgReadIndex": 15, 139 "MsgReadIndexResp": 16, 140 "MsgPreVote": 17, 141 "MsgPreVoteResp": 18, 142} 143 144func (x MessageType) Enum() *MessageType { 145 p := new(MessageType) 146 *p = x 147 return p 148} 149func (x MessageType) String() string { 150 return proto.EnumName(MessageType_name, int32(x)) 151} 152func (x *MessageType) UnmarshalJSON(data []byte) error { 153 value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType") 154 if err != nil { 155 return err 156 } 157 *x = MessageType(value) 158 return nil 159} 160func (MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaft, []int{1} } 161 162type ConfChangeType int32 163 164const ( 165 ConfChangeAddNode ConfChangeType = 0 166 ConfChangeRemoveNode ConfChangeType = 1 167 ConfChangeUpdateNode ConfChangeType = 2 168) 169 170var ConfChangeType_name = map[int32]string{ 171 0: "ConfChangeAddNode", 172 1: "ConfChangeRemoveNode", 173 2: "ConfChangeUpdateNode", 174} 175var ConfChangeType_value = map[string]int32{ 176 "ConfChangeAddNode": 0, 177 "ConfChangeRemoveNode": 1, 178 "ConfChangeUpdateNode": 2, 179} 180 181func (x ConfChangeType) Enum() *ConfChangeType { 182 p := new(ConfChangeType) 183 *p = x 184 return p 185} 186func (x ConfChangeType) String() string { 187 return proto.EnumName(ConfChangeType_name, int32(x)) 188} 189func (x *ConfChangeType) UnmarshalJSON(data []byte) error { 190 value, err := proto.UnmarshalJSONEnum(ConfChangeType_value, data, "ConfChangeType") 191 if err != nil { 192 return err 193 } 194 *x = ConfChangeType(value) 195 return nil 196} 197func (ConfChangeType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaft, []int{2} } 198 199type Entry struct { 200 Term uint64 `protobuf:"varint,2,opt,name=Term" json:"Term"` 201 Index uint64 `protobuf:"varint,3,opt,name=Index" json:"Index"` 202 Type EntryType `protobuf:"varint,1,opt,name=Type,enum=raftpb.EntryType" json:"Type"` 203 Data []byte `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"` 204 XXX_unrecognized []byte `json:"-"` 205} 206 207func (m *Entry) Reset() { *m = Entry{} } 208func (m *Entry) String() string { return proto.CompactTextString(m) } 209func (*Entry) ProtoMessage() {} 210func (*Entry) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{0} } 211 212type SnapshotMetadata struct { 213 ConfState ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state"` 214 Index uint64 `protobuf:"varint,2,opt,name=index" json:"index"` 215 Term uint64 `protobuf:"varint,3,opt,name=term" json:"term"` 216 XXX_unrecognized []byte `json:"-"` 217} 218 219func (m *SnapshotMetadata) Reset() { *m = SnapshotMetadata{} } 220func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) } 221func (*SnapshotMetadata) ProtoMessage() {} 222func (*SnapshotMetadata) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{1} } 223 224type Snapshot struct { 225 Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` 226 Metadata SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata"` 227 XXX_unrecognized []byte `json:"-"` 228} 229 230func (m *Snapshot) Reset() { *m = Snapshot{} } 231func (m *Snapshot) String() string { return proto.CompactTextString(m) } 232func (*Snapshot) ProtoMessage() {} 233func (*Snapshot) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{2} } 234 235type Message struct { 236 Type MessageType `protobuf:"varint,1,opt,name=type,enum=raftpb.MessageType" json:"type"` 237 To uint64 `protobuf:"varint,2,opt,name=to" json:"to"` 238 From uint64 `protobuf:"varint,3,opt,name=from" json:"from"` 239 Term uint64 `protobuf:"varint,4,opt,name=term" json:"term"` 240 LogTerm uint64 `protobuf:"varint,5,opt,name=logTerm" json:"logTerm"` 241 Index uint64 `protobuf:"varint,6,opt,name=index" json:"index"` 242 Entries []Entry `protobuf:"bytes,7,rep,name=entries" json:"entries"` 243 Commit uint64 `protobuf:"varint,8,opt,name=commit" json:"commit"` 244 Snapshot Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot"` 245 Reject bool `protobuf:"varint,10,opt,name=reject" json:"reject"` 246 RejectHint uint64 `protobuf:"varint,11,opt,name=rejectHint" json:"rejectHint"` 247 Context []byte `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"` 248 XXX_unrecognized []byte `json:"-"` 249} 250 251func (m *Message) Reset() { *m = Message{} } 252func (m *Message) String() string { return proto.CompactTextString(m) } 253func (*Message) ProtoMessage() {} 254func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{3} } 255 256type HardState struct { 257 Term uint64 `protobuf:"varint,1,opt,name=term" json:"term"` 258 Vote uint64 `protobuf:"varint,2,opt,name=vote" json:"vote"` 259 Commit uint64 `protobuf:"varint,3,opt,name=commit" json:"commit"` 260 XXX_unrecognized []byte `json:"-"` 261} 262 263func (m *HardState) Reset() { *m = HardState{} } 264func (m *HardState) String() string { return proto.CompactTextString(m) } 265func (*HardState) ProtoMessage() {} 266func (*HardState) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{4} } 267 268type ConfState struct { 269 Nodes []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes,omitempty"` 270 XXX_unrecognized []byte `json:"-"` 271} 272 273func (m *ConfState) Reset() { *m = ConfState{} } 274func (m *ConfState) String() string { return proto.CompactTextString(m) } 275func (*ConfState) ProtoMessage() {} 276func (*ConfState) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{5} } 277 278type ConfChange struct { 279 ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"` 280 Type ConfChangeType `protobuf:"varint,2,opt,name=Type,enum=raftpb.ConfChangeType" json:"Type"` 281 NodeID uint64 `protobuf:"varint,3,opt,name=NodeID" json:"NodeID"` 282 Context []byte `protobuf:"bytes,4,opt,name=Context" json:"Context,omitempty"` 283 XXX_unrecognized []byte `json:"-"` 284} 285 286func (m *ConfChange) Reset() { *m = ConfChange{} } 287func (m *ConfChange) String() string { return proto.CompactTextString(m) } 288func (*ConfChange) ProtoMessage() {} 289func (*ConfChange) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{6} } 290 291func init() { 292 proto.RegisterType((*Entry)(nil), "raftpb.Entry") 293 proto.RegisterType((*SnapshotMetadata)(nil), "raftpb.SnapshotMetadata") 294 proto.RegisterType((*Snapshot)(nil), "raftpb.Snapshot") 295 proto.RegisterType((*Message)(nil), "raftpb.Message") 296 proto.RegisterType((*HardState)(nil), "raftpb.HardState") 297 proto.RegisterType((*ConfState)(nil), "raftpb.ConfState") 298 proto.RegisterType((*ConfChange)(nil), "raftpb.ConfChange") 299 proto.RegisterEnum("raftpb.EntryType", EntryType_name, EntryType_value) 300 proto.RegisterEnum("raftpb.MessageType", MessageType_name, MessageType_value) 301 proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) 302} 303func (m *Entry) Marshal() (dAtA []byte, err error) { 304 size := m.Size() 305 dAtA = make([]byte, size) 306 n, err := m.MarshalTo(dAtA) 307 if err != nil { 308 return nil, err 309 } 310 return dAtA[:n], nil 311} 312 313func (m *Entry) MarshalTo(dAtA []byte) (int, error) { 314 var i int 315 _ = i 316 var l int 317 _ = l 318 dAtA[i] = 0x8 319 i++ 320 i = encodeVarintRaft(dAtA, i, uint64(m.Type)) 321 dAtA[i] = 0x10 322 i++ 323 i = encodeVarintRaft(dAtA, i, uint64(m.Term)) 324 dAtA[i] = 0x18 325 i++ 326 i = encodeVarintRaft(dAtA, i, uint64(m.Index)) 327 if m.Data != nil { 328 dAtA[i] = 0x22 329 i++ 330 i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) 331 i += copy(dAtA[i:], m.Data) 332 } 333 if m.XXX_unrecognized != nil { 334 i += copy(dAtA[i:], m.XXX_unrecognized) 335 } 336 return i, nil 337} 338 339func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error) { 340 size := m.Size() 341 dAtA = make([]byte, size) 342 n, err := m.MarshalTo(dAtA) 343 if err != nil { 344 return nil, err 345 } 346 return dAtA[:n], nil 347} 348 349func (m *SnapshotMetadata) MarshalTo(dAtA []byte) (int, error) { 350 var i int 351 _ = i 352 var l int 353 _ = l 354 dAtA[i] = 0xa 355 i++ 356 i = encodeVarintRaft(dAtA, i, uint64(m.ConfState.Size())) 357 n1, err := m.ConfState.MarshalTo(dAtA[i:]) 358 if err != nil { 359 return 0, err 360 } 361 i += n1 362 dAtA[i] = 0x10 363 i++ 364 i = encodeVarintRaft(dAtA, i, uint64(m.Index)) 365 dAtA[i] = 0x18 366 i++ 367 i = encodeVarintRaft(dAtA, i, uint64(m.Term)) 368 if m.XXX_unrecognized != nil { 369 i += copy(dAtA[i:], m.XXX_unrecognized) 370 } 371 return i, nil 372} 373 374func (m *Snapshot) Marshal() (dAtA []byte, err error) { 375 size := m.Size() 376 dAtA = make([]byte, size) 377 n, err := m.MarshalTo(dAtA) 378 if err != nil { 379 return nil, err 380 } 381 return dAtA[:n], nil 382} 383 384func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { 385 var i int 386 _ = i 387 var l int 388 _ = l 389 if m.Data != nil { 390 dAtA[i] = 0xa 391 i++ 392 i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) 393 i += copy(dAtA[i:], m.Data) 394 } 395 dAtA[i] = 0x12 396 i++ 397 i = encodeVarintRaft(dAtA, i, uint64(m.Metadata.Size())) 398 n2, err := m.Metadata.MarshalTo(dAtA[i:]) 399 if err != nil { 400 return 0, err 401 } 402 i += n2 403 if m.XXX_unrecognized != nil { 404 i += copy(dAtA[i:], m.XXX_unrecognized) 405 } 406 return i, nil 407} 408 409func (m *Message) Marshal() (dAtA []byte, err error) { 410 size := m.Size() 411 dAtA = make([]byte, size) 412 n, err := m.MarshalTo(dAtA) 413 if err != nil { 414 return nil, err 415 } 416 return dAtA[:n], nil 417} 418 419func (m *Message) MarshalTo(dAtA []byte) (int, error) { 420 var i int 421 _ = i 422 var l int 423 _ = l 424 dAtA[i] = 0x8 425 i++ 426 i = encodeVarintRaft(dAtA, i, uint64(m.Type)) 427 dAtA[i] = 0x10 428 i++ 429 i = encodeVarintRaft(dAtA, i, uint64(m.To)) 430 dAtA[i] = 0x18 431 i++ 432 i = encodeVarintRaft(dAtA, i, uint64(m.From)) 433 dAtA[i] = 0x20 434 i++ 435 i = encodeVarintRaft(dAtA, i, uint64(m.Term)) 436 dAtA[i] = 0x28 437 i++ 438 i = encodeVarintRaft(dAtA, i, uint64(m.LogTerm)) 439 dAtA[i] = 0x30 440 i++ 441 i = encodeVarintRaft(dAtA, i, uint64(m.Index)) 442 if len(m.Entries) > 0 { 443 for _, msg := range m.Entries { 444 dAtA[i] = 0x3a 445 i++ 446 i = encodeVarintRaft(dAtA, i, uint64(msg.Size())) 447 n, err := msg.MarshalTo(dAtA[i:]) 448 if err != nil { 449 return 0, err 450 } 451 i += n 452 } 453 } 454 dAtA[i] = 0x40 455 i++ 456 i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) 457 dAtA[i] = 0x4a 458 i++ 459 i = encodeVarintRaft(dAtA, i, uint64(m.Snapshot.Size())) 460 n3, err := m.Snapshot.MarshalTo(dAtA[i:]) 461 if err != nil { 462 return 0, err 463 } 464 i += n3 465 dAtA[i] = 0x50 466 i++ 467 if m.Reject { 468 dAtA[i] = 1 469 } else { 470 dAtA[i] = 0 471 } 472 i++ 473 dAtA[i] = 0x58 474 i++ 475 i = encodeVarintRaft(dAtA, i, uint64(m.RejectHint)) 476 if m.Context != nil { 477 dAtA[i] = 0x62 478 i++ 479 i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) 480 i += copy(dAtA[i:], m.Context) 481 } 482 if m.XXX_unrecognized != nil { 483 i += copy(dAtA[i:], m.XXX_unrecognized) 484 } 485 return i, nil 486} 487 488func (m *HardState) Marshal() (dAtA []byte, err error) { 489 size := m.Size() 490 dAtA = make([]byte, size) 491 n, err := m.MarshalTo(dAtA) 492 if err != nil { 493 return nil, err 494 } 495 return dAtA[:n], nil 496} 497 498func (m *HardState) MarshalTo(dAtA []byte) (int, error) { 499 var i int 500 _ = i 501 var l int 502 _ = l 503 dAtA[i] = 0x8 504 i++ 505 i = encodeVarintRaft(dAtA, i, uint64(m.Term)) 506 dAtA[i] = 0x10 507 i++ 508 i = encodeVarintRaft(dAtA, i, uint64(m.Vote)) 509 dAtA[i] = 0x18 510 i++ 511 i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) 512 if m.XXX_unrecognized != nil { 513 i += copy(dAtA[i:], m.XXX_unrecognized) 514 } 515 return i, nil 516} 517 518func (m *ConfState) Marshal() (dAtA []byte, err error) { 519 size := m.Size() 520 dAtA = make([]byte, size) 521 n, err := m.MarshalTo(dAtA) 522 if err != nil { 523 return nil, err 524 } 525 return dAtA[:n], nil 526} 527 528func (m *ConfState) MarshalTo(dAtA []byte) (int, error) { 529 var i int 530 _ = i 531 var l int 532 _ = l 533 if len(m.Nodes) > 0 { 534 for _, num := range m.Nodes { 535 dAtA[i] = 0x8 536 i++ 537 i = encodeVarintRaft(dAtA, i, uint64(num)) 538 } 539 } 540 if m.XXX_unrecognized != nil { 541 i += copy(dAtA[i:], m.XXX_unrecognized) 542 } 543 return i, nil 544} 545 546func (m *ConfChange) Marshal() (dAtA []byte, err error) { 547 size := m.Size() 548 dAtA = make([]byte, size) 549 n, err := m.MarshalTo(dAtA) 550 if err != nil { 551 return nil, err 552 } 553 return dAtA[:n], nil 554} 555 556func (m *ConfChange) MarshalTo(dAtA []byte) (int, error) { 557 var i int 558 _ = i 559 var l int 560 _ = l 561 dAtA[i] = 0x8 562 i++ 563 i = encodeVarintRaft(dAtA, i, uint64(m.ID)) 564 dAtA[i] = 0x10 565 i++ 566 i = encodeVarintRaft(dAtA, i, uint64(m.Type)) 567 dAtA[i] = 0x18 568 i++ 569 i = encodeVarintRaft(dAtA, i, uint64(m.NodeID)) 570 if m.Context != nil { 571 dAtA[i] = 0x22 572 i++ 573 i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) 574 i += copy(dAtA[i:], m.Context) 575 } 576 if m.XXX_unrecognized != nil { 577 i += copy(dAtA[i:], m.XXX_unrecognized) 578 } 579 return i, nil 580} 581 582func encodeFixed64Raft(dAtA []byte, offset int, v uint64) int { 583 dAtA[offset] = uint8(v) 584 dAtA[offset+1] = uint8(v >> 8) 585 dAtA[offset+2] = uint8(v >> 16) 586 dAtA[offset+3] = uint8(v >> 24) 587 dAtA[offset+4] = uint8(v >> 32) 588 dAtA[offset+5] = uint8(v >> 40) 589 dAtA[offset+6] = uint8(v >> 48) 590 dAtA[offset+7] = uint8(v >> 56) 591 return offset + 8 592} 593func encodeFixed32Raft(dAtA []byte, offset int, v uint32) int { 594 dAtA[offset] = uint8(v) 595 dAtA[offset+1] = uint8(v >> 8) 596 dAtA[offset+2] = uint8(v >> 16) 597 dAtA[offset+3] = uint8(v >> 24) 598 return offset + 4 599} 600func encodeVarintRaft(dAtA []byte, offset int, v uint64) int { 601 for v >= 1<<7 { 602 dAtA[offset] = uint8(v&0x7f | 0x80) 603 v >>= 7 604 offset++ 605 } 606 dAtA[offset] = uint8(v) 607 return offset + 1 608} 609func (m *Entry) Size() (n int) { 610 var l int 611 _ = l 612 n += 1 + sovRaft(uint64(m.Type)) 613 n += 1 + sovRaft(uint64(m.Term)) 614 n += 1 + sovRaft(uint64(m.Index)) 615 if m.Data != nil { 616 l = len(m.Data) 617 n += 1 + l + sovRaft(uint64(l)) 618 } 619 if m.XXX_unrecognized != nil { 620 n += len(m.XXX_unrecognized) 621 } 622 return n 623} 624 625func (m *SnapshotMetadata) Size() (n int) { 626 var l int 627 _ = l 628 l = m.ConfState.Size() 629 n += 1 + l + sovRaft(uint64(l)) 630 n += 1 + sovRaft(uint64(m.Index)) 631 n += 1 + sovRaft(uint64(m.Term)) 632 if m.XXX_unrecognized != nil { 633 n += len(m.XXX_unrecognized) 634 } 635 return n 636} 637 638func (m *Snapshot) Size() (n int) { 639 var l int 640 _ = l 641 if m.Data != nil { 642 l = len(m.Data) 643 n += 1 + l + sovRaft(uint64(l)) 644 } 645 l = m.Metadata.Size() 646 n += 1 + l + sovRaft(uint64(l)) 647 if m.XXX_unrecognized != nil { 648 n += len(m.XXX_unrecognized) 649 } 650 return n 651} 652 653func (m *Message) Size() (n int) { 654 var l int 655 _ = l 656 n += 1 + sovRaft(uint64(m.Type)) 657 n += 1 + sovRaft(uint64(m.To)) 658 n += 1 + sovRaft(uint64(m.From)) 659 n += 1 + sovRaft(uint64(m.Term)) 660 n += 1 + sovRaft(uint64(m.LogTerm)) 661 n += 1 + sovRaft(uint64(m.Index)) 662 if len(m.Entries) > 0 { 663 for _, e := range m.Entries { 664 l = e.Size() 665 n += 1 + l + sovRaft(uint64(l)) 666 } 667 } 668 n += 1 + sovRaft(uint64(m.Commit)) 669 l = m.Snapshot.Size() 670 n += 1 + l + sovRaft(uint64(l)) 671 n += 2 672 n += 1 + sovRaft(uint64(m.RejectHint)) 673 if m.Context != nil { 674 l = len(m.Context) 675 n += 1 + l + sovRaft(uint64(l)) 676 } 677 if m.XXX_unrecognized != nil { 678 n += len(m.XXX_unrecognized) 679 } 680 return n 681} 682 683func (m *HardState) Size() (n int) { 684 var l int 685 _ = l 686 n += 1 + sovRaft(uint64(m.Term)) 687 n += 1 + sovRaft(uint64(m.Vote)) 688 n += 1 + sovRaft(uint64(m.Commit)) 689 if m.XXX_unrecognized != nil { 690 n += len(m.XXX_unrecognized) 691 } 692 return n 693} 694 695func (m *ConfState) Size() (n int) { 696 var l int 697 _ = l 698 if len(m.Nodes) > 0 { 699 for _, e := range m.Nodes { 700 n += 1 + sovRaft(uint64(e)) 701 } 702 } 703 if m.XXX_unrecognized != nil { 704 n += len(m.XXX_unrecognized) 705 } 706 return n 707} 708 709func (m *ConfChange) Size() (n int) { 710 var l int 711 _ = l 712 n += 1 + sovRaft(uint64(m.ID)) 713 n += 1 + sovRaft(uint64(m.Type)) 714 n += 1 + sovRaft(uint64(m.NodeID)) 715 if m.Context != nil { 716 l = len(m.Context) 717 n += 1 + l + sovRaft(uint64(l)) 718 } 719 if m.XXX_unrecognized != nil { 720 n += len(m.XXX_unrecognized) 721 } 722 return n 723} 724 725func sovRaft(x uint64) (n int) { 726 for { 727 n++ 728 x >>= 7 729 if x == 0 { 730 break 731 } 732 } 733 return n 734} 735func sozRaft(x uint64) (n int) { 736 return sovRaft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 737} 738func (m *Entry) Unmarshal(dAtA []byte) error { 739 l := len(dAtA) 740 iNdEx := 0 741 for iNdEx < l { 742 preIndex := iNdEx 743 var wire uint64 744 for shift := uint(0); ; shift += 7 { 745 if shift >= 64 { 746 return ErrIntOverflowRaft 747 } 748 if iNdEx >= l { 749 return io.ErrUnexpectedEOF 750 } 751 b := dAtA[iNdEx] 752 iNdEx++ 753 wire |= (uint64(b) & 0x7F) << shift 754 if b < 0x80 { 755 break 756 } 757 } 758 fieldNum := int32(wire >> 3) 759 wireType := int(wire & 0x7) 760 if wireType == 4 { 761 return fmt.Errorf("proto: Entry: wiretype end group for non-group") 762 } 763 if fieldNum <= 0 { 764 return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) 765 } 766 switch fieldNum { 767 case 1: 768 if wireType != 0 { 769 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) 770 } 771 m.Type = 0 772 for shift := uint(0); ; shift += 7 { 773 if shift >= 64 { 774 return ErrIntOverflowRaft 775 } 776 if iNdEx >= l { 777 return io.ErrUnexpectedEOF 778 } 779 b := dAtA[iNdEx] 780 iNdEx++ 781 m.Type |= (EntryType(b) & 0x7F) << shift 782 if b < 0x80 { 783 break 784 } 785 } 786 case 2: 787 if wireType != 0 { 788 return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) 789 } 790 m.Term = 0 791 for shift := uint(0); ; shift += 7 { 792 if shift >= 64 { 793 return ErrIntOverflowRaft 794 } 795 if iNdEx >= l { 796 return io.ErrUnexpectedEOF 797 } 798 b := dAtA[iNdEx] 799 iNdEx++ 800 m.Term |= (uint64(b) & 0x7F) << shift 801 if b < 0x80 { 802 break 803 } 804 } 805 case 3: 806 if wireType != 0 { 807 return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) 808 } 809 m.Index = 0 810 for shift := uint(0); ; shift += 7 { 811 if shift >= 64 { 812 return ErrIntOverflowRaft 813 } 814 if iNdEx >= l { 815 return io.ErrUnexpectedEOF 816 } 817 b := dAtA[iNdEx] 818 iNdEx++ 819 m.Index |= (uint64(b) & 0x7F) << shift 820 if b < 0x80 { 821 break 822 } 823 } 824 case 4: 825 if wireType != 2 { 826 return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) 827 } 828 var byteLen int 829 for shift := uint(0); ; shift += 7 { 830 if shift >= 64 { 831 return ErrIntOverflowRaft 832 } 833 if iNdEx >= l { 834 return io.ErrUnexpectedEOF 835 } 836 b := dAtA[iNdEx] 837 iNdEx++ 838 byteLen |= (int(b) & 0x7F) << shift 839 if b < 0x80 { 840 break 841 } 842 } 843 if byteLen < 0 { 844 return ErrInvalidLengthRaft 845 } 846 postIndex := iNdEx + byteLen 847 if postIndex > l { 848 return io.ErrUnexpectedEOF 849 } 850 m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) 851 if m.Data == nil { 852 m.Data = []byte{} 853 } 854 iNdEx = postIndex 855 default: 856 iNdEx = preIndex 857 skippy, err := skipRaft(dAtA[iNdEx:]) 858 if err != nil { 859 return err 860 } 861 if skippy < 0 { 862 return ErrInvalidLengthRaft 863 } 864 if (iNdEx + skippy) > l { 865 return io.ErrUnexpectedEOF 866 } 867 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 868 iNdEx += skippy 869 } 870 } 871 872 if iNdEx > l { 873 return io.ErrUnexpectedEOF 874 } 875 return nil 876} 877func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { 878 l := len(dAtA) 879 iNdEx := 0 880 for iNdEx < l { 881 preIndex := iNdEx 882 var wire uint64 883 for shift := uint(0); ; shift += 7 { 884 if shift >= 64 { 885 return ErrIntOverflowRaft 886 } 887 if iNdEx >= l { 888 return io.ErrUnexpectedEOF 889 } 890 b := dAtA[iNdEx] 891 iNdEx++ 892 wire |= (uint64(b) & 0x7F) << shift 893 if b < 0x80 { 894 break 895 } 896 } 897 fieldNum := int32(wire >> 3) 898 wireType := int(wire & 0x7) 899 if wireType == 4 { 900 return fmt.Errorf("proto: SnapshotMetadata: wiretype end group for non-group") 901 } 902 if fieldNum <= 0 { 903 return fmt.Errorf("proto: SnapshotMetadata: illegal tag %d (wire type %d)", fieldNum, wire) 904 } 905 switch fieldNum { 906 case 1: 907 if wireType != 2 { 908 return fmt.Errorf("proto: wrong wireType = %d for field ConfState", wireType) 909 } 910 var msglen int 911 for shift := uint(0); ; shift += 7 { 912 if shift >= 64 { 913 return ErrIntOverflowRaft 914 } 915 if iNdEx >= l { 916 return io.ErrUnexpectedEOF 917 } 918 b := dAtA[iNdEx] 919 iNdEx++ 920 msglen |= (int(b) & 0x7F) << shift 921 if b < 0x80 { 922 break 923 } 924 } 925 if msglen < 0 { 926 return ErrInvalidLengthRaft 927 } 928 postIndex := iNdEx + msglen 929 if postIndex > l { 930 return io.ErrUnexpectedEOF 931 } 932 if err := m.ConfState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 933 return err 934 } 935 iNdEx = postIndex 936 case 2: 937 if wireType != 0 { 938 return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) 939 } 940 m.Index = 0 941 for shift := uint(0); ; shift += 7 { 942 if shift >= 64 { 943 return ErrIntOverflowRaft 944 } 945 if iNdEx >= l { 946 return io.ErrUnexpectedEOF 947 } 948 b := dAtA[iNdEx] 949 iNdEx++ 950 m.Index |= (uint64(b) & 0x7F) << shift 951 if b < 0x80 { 952 break 953 } 954 } 955 case 3: 956 if wireType != 0 { 957 return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) 958 } 959 m.Term = 0 960 for shift := uint(0); ; shift += 7 { 961 if shift >= 64 { 962 return ErrIntOverflowRaft 963 } 964 if iNdEx >= l { 965 return io.ErrUnexpectedEOF 966 } 967 b := dAtA[iNdEx] 968 iNdEx++ 969 m.Term |= (uint64(b) & 0x7F) << shift 970 if b < 0x80 { 971 break 972 } 973 } 974 default: 975 iNdEx = preIndex 976 skippy, err := skipRaft(dAtA[iNdEx:]) 977 if err != nil { 978 return err 979 } 980 if skippy < 0 { 981 return ErrInvalidLengthRaft 982 } 983 if (iNdEx + skippy) > l { 984 return io.ErrUnexpectedEOF 985 } 986 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 987 iNdEx += skippy 988 } 989 } 990 991 if iNdEx > l { 992 return io.ErrUnexpectedEOF 993 } 994 return nil 995} 996func (m *Snapshot) Unmarshal(dAtA []byte) error { 997 l := len(dAtA) 998 iNdEx := 0 999 for iNdEx < l { 1000 preIndex := iNdEx 1001 var wire uint64 1002 for shift := uint(0); ; shift += 7 { 1003 if shift >= 64 { 1004 return ErrIntOverflowRaft 1005 } 1006 if iNdEx >= l { 1007 return io.ErrUnexpectedEOF 1008 } 1009 b := dAtA[iNdEx] 1010 iNdEx++ 1011 wire |= (uint64(b) & 0x7F) << shift 1012 if b < 0x80 { 1013 break 1014 } 1015 } 1016 fieldNum := int32(wire >> 3) 1017 wireType := int(wire & 0x7) 1018 if wireType == 4 { 1019 return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") 1020 } 1021 if fieldNum <= 0 { 1022 return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) 1023 } 1024 switch fieldNum { 1025 case 1: 1026 if wireType != 2 { 1027 return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) 1028 } 1029 var byteLen int 1030 for shift := uint(0); ; shift += 7 { 1031 if shift >= 64 { 1032 return ErrIntOverflowRaft 1033 } 1034 if iNdEx >= l { 1035 return io.ErrUnexpectedEOF 1036 } 1037 b := dAtA[iNdEx] 1038 iNdEx++ 1039 byteLen |= (int(b) & 0x7F) << shift 1040 if b < 0x80 { 1041 break 1042 } 1043 } 1044 if byteLen < 0 { 1045 return ErrInvalidLengthRaft 1046 } 1047 postIndex := iNdEx + byteLen 1048 if postIndex > l { 1049 return io.ErrUnexpectedEOF 1050 } 1051 m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) 1052 if m.Data == nil { 1053 m.Data = []byte{} 1054 } 1055 iNdEx = postIndex 1056 case 2: 1057 if wireType != 2 { 1058 return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) 1059 } 1060 var msglen int 1061 for shift := uint(0); ; shift += 7 { 1062 if shift >= 64 { 1063 return ErrIntOverflowRaft 1064 } 1065 if iNdEx >= l { 1066 return io.ErrUnexpectedEOF 1067 } 1068 b := dAtA[iNdEx] 1069 iNdEx++ 1070 msglen |= (int(b) & 0x7F) << shift 1071 if b < 0x80 { 1072 break 1073 } 1074 } 1075 if msglen < 0 { 1076 return ErrInvalidLengthRaft 1077 } 1078 postIndex := iNdEx + msglen 1079 if postIndex > l { 1080 return io.ErrUnexpectedEOF 1081 } 1082 if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1083 return err 1084 } 1085 iNdEx = postIndex 1086 default: 1087 iNdEx = preIndex 1088 skippy, err := skipRaft(dAtA[iNdEx:]) 1089 if err != nil { 1090 return err 1091 } 1092 if skippy < 0 { 1093 return ErrInvalidLengthRaft 1094 } 1095 if (iNdEx + skippy) > l { 1096 return io.ErrUnexpectedEOF 1097 } 1098 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 1099 iNdEx += skippy 1100 } 1101 } 1102 1103 if iNdEx > l { 1104 return io.ErrUnexpectedEOF 1105 } 1106 return nil 1107} 1108func (m *Message) Unmarshal(dAtA []byte) error { 1109 l := len(dAtA) 1110 iNdEx := 0 1111 for iNdEx < l { 1112 preIndex := iNdEx 1113 var wire uint64 1114 for shift := uint(0); ; shift += 7 { 1115 if shift >= 64 { 1116 return ErrIntOverflowRaft 1117 } 1118 if iNdEx >= l { 1119 return io.ErrUnexpectedEOF 1120 } 1121 b := dAtA[iNdEx] 1122 iNdEx++ 1123 wire |= (uint64(b) & 0x7F) << shift 1124 if b < 0x80 { 1125 break 1126 } 1127 } 1128 fieldNum := int32(wire >> 3) 1129 wireType := int(wire & 0x7) 1130 if wireType == 4 { 1131 return fmt.Errorf("proto: Message: wiretype end group for non-group") 1132 } 1133 if fieldNum <= 0 { 1134 return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) 1135 } 1136 switch fieldNum { 1137 case 1: 1138 if wireType != 0 { 1139 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) 1140 } 1141 m.Type = 0 1142 for shift := uint(0); ; shift += 7 { 1143 if shift >= 64 { 1144 return ErrIntOverflowRaft 1145 } 1146 if iNdEx >= l { 1147 return io.ErrUnexpectedEOF 1148 } 1149 b := dAtA[iNdEx] 1150 iNdEx++ 1151 m.Type |= (MessageType(b) & 0x7F) << shift 1152 if b < 0x80 { 1153 break 1154 } 1155 } 1156 case 2: 1157 if wireType != 0 { 1158 return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) 1159 } 1160 m.To = 0 1161 for shift := uint(0); ; shift += 7 { 1162 if shift >= 64 { 1163 return ErrIntOverflowRaft 1164 } 1165 if iNdEx >= l { 1166 return io.ErrUnexpectedEOF 1167 } 1168 b := dAtA[iNdEx] 1169 iNdEx++ 1170 m.To |= (uint64(b) & 0x7F) << shift 1171 if b < 0x80 { 1172 break 1173 } 1174 } 1175 case 3: 1176 if wireType != 0 { 1177 return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) 1178 } 1179 m.From = 0 1180 for shift := uint(0); ; shift += 7 { 1181 if shift >= 64 { 1182 return ErrIntOverflowRaft 1183 } 1184 if iNdEx >= l { 1185 return io.ErrUnexpectedEOF 1186 } 1187 b := dAtA[iNdEx] 1188 iNdEx++ 1189 m.From |= (uint64(b) & 0x7F) << shift 1190 if b < 0x80 { 1191 break 1192 } 1193 } 1194 case 4: 1195 if wireType != 0 { 1196 return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) 1197 } 1198 m.Term = 0 1199 for shift := uint(0); ; shift += 7 { 1200 if shift >= 64 { 1201 return ErrIntOverflowRaft 1202 } 1203 if iNdEx >= l { 1204 return io.ErrUnexpectedEOF 1205 } 1206 b := dAtA[iNdEx] 1207 iNdEx++ 1208 m.Term |= (uint64(b) & 0x7F) << shift 1209 if b < 0x80 { 1210 break 1211 } 1212 } 1213 case 5: 1214 if wireType != 0 { 1215 return fmt.Errorf("proto: wrong wireType = %d for field LogTerm", wireType) 1216 } 1217 m.LogTerm = 0 1218 for shift := uint(0); ; shift += 7 { 1219 if shift >= 64 { 1220 return ErrIntOverflowRaft 1221 } 1222 if iNdEx >= l { 1223 return io.ErrUnexpectedEOF 1224 } 1225 b := dAtA[iNdEx] 1226 iNdEx++ 1227 m.LogTerm |= (uint64(b) & 0x7F) << shift 1228 if b < 0x80 { 1229 break 1230 } 1231 } 1232 case 6: 1233 if wireType != 0 { 1234 return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) 1235 } 1236 m.Index = 0 1237 for shift := uint(0); ; shift += 7 { 1238 if shift >= 64 { 1239 return ErrIntOverflowRaft 1240 } 1241 if iNdEx >= l { 1242 return io.ErrUnexpectedEOF 1243 } 1244 b := dAtA[iNdEx] 1245 iNdEx++ 1246 m.Index |= (uint64(b) & 0x7F) << shift 1247 if b < 0x80 { 1248 break 1249 } 1250 } 1251 case 7: 1252 if wireType != 2 { 1253 return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) 1254 } 1255 var msglen int 1256 for shift := uint(0); ; shift += 7 { 1257 if shift >= 64 { 1258 return ErrIntOverflowRaft 1259 } 1260 if iNdEx >= l { 1261 return io.ErrUnexpectedEOF 1262 } 1263 b := dAtA[iNdEx] 1264 iNdEx++ 1265 msglen |= (int(b) & 0x7F) << shift 1266 if b < 0x80 { 1267 break 1268 } 1269 } 1270 if msglen < 0 { 1271 return ErrInvalidLengthRaft 1272 } 1273 postIndex := iNdEx + msglen 1274 if postIndex > l { 1275 return io.ErrUnexpectedEOF 1276 } 1277 m.Entries = append(m.Entries, Entry{}) 1278 if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1279 return err 1280 } 1281 iNdEx = postIndex 1282 case 8: 1283 if wireType != 0 { 1284 return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) 1285 } 1286 m.Commit = 0 1287 for shift := uint(0); ; shift += 7 { 1288 if shift >= 64 { 1289 return ErrIntOverflowRaft 1290 } 1291 if iNdEx >= l { 1292 return io.ErrUnexpectedEOF 1293 } 1294 b := dAtA[iNdEx] 1295 iNdEx++ 1296 m.Commit |= (uint64(b) & 0x7F) << shift 1297 if b < 0x80 { 1298 break 1299 } 1300 } 1301 case 9: 1302 if wireType != 2 { 1303 return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) 1304 } 1305 var msglen int 1306 for shift := uint(0); ; shift += 7 { 1307 if shift >= 64 { 1308 return ErrIntOverflowRaft 1309 } 1310 if iNdEx >= l { 1311 return io.ErrUnexpectedEOF 1312 } 1313 b := dAtA[iNdEx] 1314 iNdEx++ 1315 msglen |= (int(b) & 0x7F) << shift 1316 if b < 0x80 { 1317 break 1318 } 1319 } 1320 if msglen < 0 { 1321 return ErrInvalidLengthRaft 1322 } 1323 postIndex := iNdEx + msglen 1324 if postIndex > l { 1325 return io.ErrUnexpectedEOF 1326 } 1327 if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1328 return err 1329 } 1330 iNdEx = postIndex 1331 case 10: 1332 if wireType != 0 { 1333 return fmt.Errorf("proto: wrong wireType = %d for field Reject", wireType) 1334 } 1335 var v int 1336 for shift := uint(0); ; shift += 7 { 1337 if shift >= 64 { 1338 return ErrIntOverflowRaft 1339 } 1340 if iNdEx >= l { 1341 return io.ErrUnexpectedEOF 1342 } 1343 b := dAtA[iNdEx] 1344 iNdEx++ 1345 v |= (int(b) & 0x7F) << shift 1346 if b < 0x80 { 1347 break 1348 } 1349 } 1350 m.Reject = bool(v != 0) 1351 case 11: 1352 if wireType != 0 { 1353 return fmt.Errorf("proto: wrong wireType = %d for field RejectHint", wireType) 1354 } 1355 m.RejectHint = 0 1356 for shift := uint(0); ; shift += 7 { 1357 if shift >= 64 { 1358 return ErrIntOverflowRaft 1359 } 1360 if iNdEx >= l { 1361 return io.ErrUnexpectedEOF 1362 } 1363 b := dAtA[iNdEx] 1364 iNdEx++ 1365 m.RejectHint |= (uint64(b) & 0x7F) << shift 1366 if b < 0x80 { 1367 break 1368 } 1369 } 1370 case 12: 1371 if wireType != 2 { 1372 return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) 1373 } 1374 var byteLen int 1375 for shift := uint(0); ; shift += 7 { 1376 if shift >= 64 { 1377 return ErrIntOverflowRaft 1378 } 1379 if iNdEx >= l { 1380 return io.ErrUnexpectedEOF 1381 } 1382 b := dAtA[iNdEx] 1383 iNdEx++ 1384 byteLen |= (int(b) & 0x7F) << shift 1385 if b < 0x80 { 1386 break 1387 } 1388 } 1389 if byteLen < 0 { 1390 return ErrInvalidLengthRaft 1391 } 1392 postIndex := iNdEx + byteLen 1393 if postIndex > l { 1394 return io.ErrUnexpectedEOF 1395 } 1396 m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) 1397 if m.Context == nil { 1398 m.Context = []byte{} 1399 } 1400 iNdEx = postIndex 1401 default: 1402 iNdEx = preIndex 1403 skippy, err := skipRaft(dAtA[iNdEx:]) 1404 if err != nil { 1405 return err 1406 } 1407 if skippy < 0 { 1408 return ErrInvalidLengthRaft 1409 } 1410 if (iNdEx + skippy) > l { 1411 return io.ErrUnexpectedEOF 1412 } 1413 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 1414 iNdEx += skippy 1415 } 1416 } 1417 1418 if iNdEx > l { 1419 return io.ErrUnexpectedEOF 1420 } 1421 return nil 1422} 1423func (m *HardState) Unmarshal(dAtA []byte) error { 1424 l := len(dAtA) 1425 iNdEx := 0 1426 for iNdEx < l { 1427 preIndex := iNdEx 1428 var wire uint64 1429 for shift := uint(0); ; shift += 7 { 1430 if shift >= 64 { 1431 return ErrIntOverflowRaft 1432 } 1433 if iNdEx >= l { 1434 return io.ErrUnexpectedEOF 1435 } 1436 b := dAtA[iNdEx] 1437 iNdEx++ 1438 wire |= (uint64(b) & 0x7F) << shift 1439 if b < 0x80 { 1440 break 1441 } 1442 } 1443 fieldNum := int32(wire >> 3) 1444 wireType := int(wire & 0x7) 1445 if wireType == 4 { 1446 return fmt.Errorf("proto: HardState: wiretype end group for non-group") 1447 } 1448 if fieldNum <= 0 { 1449 return fmt.Errorf("proto: HardState: illegal tag %d (wire type %d)", fieldNum, wire) 1450 } 1451 switch fieldNum { 1452 case 1: 1453 if wireType != 0 { 1454 return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) 1455 } 1456 m.Term = 0 1457 for shift := uint(0); ; shift += 7 { 1458 if shift >= 64 { 1459 return ErrIntOverflowRaft 1460 } 1461 if iNdEx >= l { 1462 return io.ErrUnexpectedEOF 1463 } 1464 b := dAtA[iNdEx] 1465 iNdEx++ 1466 m.Term |= (uint64(b) & 0x7F) << shift 1467 if b < 0x80 { 1468 break 1469 } 1470 } 1471 case 2: 1472 if wireType != 0 { 1473 return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) 1474 } 1475 m.Vote = 0 1476 for shift := uint(0); ; shift += 7 { 1477 if shift >= 64 { 1478 return ErrIntOverflowRaft 1479 } 1480 if iNdEx >= l { 1481 return io.ErrUnexpectedEOF 1482 } 1483 b := dAtA[iNdEx] 1484 iNdEx++ 1485 m.Vote |= (uint64(b) & 0x7F) << shift 1486 if b < 0x80 { 1487 break 1488 } 1489 } 1490 case 3: 1491 if wireType != 0 { 1492 return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) 1493 } 1494 m.Commit = 0 1495 for shift := uint(0); ; shift += 7 { 1496 if shift >= 64 { 1497 return ErrIntOverflowRaft 1498 } 1499 if iNdEx >= l { 1500 return io.ErrUnexpectedEOF 1501 } 1502 b := dAtA[iNdEx] 1503 iNdEx++ 1504 m.Commit |= (uint64(b) & 0x7F) << shift 1505 if b < 0x80 { 1506 break 1507 } 1508 } 1509 default: 1510 iNdEx = preIndex 1511 skippy, err := skipRaft(dAtA[iNdEx:]) 1512 if err != nil { 1513 return err 1514 } 1515 if skippy < 0 { 1516 return ErrInvalidLengthRaft 1517 } 1518 if (iNdEx + skippy) > l { 1519 return io.ErrUnexpectedEOF 1520 } 1521 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 1522 iNdEx += skippy 1523 } 1524 } 1525 1526 if iNdEx > l { 1527 return io.ErrUnexpectedEOF 1528 } 1529 return nil 1530} 1531func (m *ConfState) Unmarshal(dAtA []byte) error { 1532 l := len(dAtA) 1533 iNdEx := 0 1534 for iNdEx < l { 1535 preIndex := iNdEx 1536 var wire uint64 1537 for shift := uint(0); ; shift += 7 { 1538 if shift >= 64 { 1539 return ErrIntOverflowRaft 1540 } 1541 if iNdEx >= l { 1542 return io.ErrUnexpectedEOF 1543 } 1544 b := dAtA[iNdEx] 1545 iNdEx++ 1546 wire |= (uint64(b) & 0x7F) << shift 1547 if b < 0x80 { 1548 break 1549 } 1550 } 1551 fieldNum := int32(wire >> 3) 1552 wireType := int(wire & 0x7) 1553 if wireType == 4 { 1554 return fmt.Errorf("proto: ConfState: wiretype end group for non-group") 1555 } 1556 if fieldNum <= 0 { 1557 return fmt.Errorf("proto: ConfState: illegal tag %d (wire type %d)", fieldNum, wire) 1558 } 1559 switch fieldNum { 1560 case 1: 1561 if wireType != 0 { 1562 return fmt.Errorf("proto: wrong wireType = %d for field Nodes", wireType) 1563 } 1564 var v uint64 1565 for shift := uint(0); ; shift += 7 { 1566 if shift >= 64 { 1567 return ErrIntOverflowRaft 1568 } 1569 if iNdEx >= l { 1570 return io.ErrUnexpectedEOF 1571 } 1572 b := dAtA[iNdEx] 1573 iNdEx++ 1574 v |= (uint64(b) & 0x7F) << shift 1575 if b < 0x80 { 1576 break 1577 } 1578 } 1579 m.Nodes = append(m.Nodes, v) 1580 default: 1581 iNdEx = preIndex 1582 skippy, err := skipRaft(dAtA[iNdEx:]) 1583 if err != nil { 1584 return err 1585 } 1586 if skippy < 0 { 1587 return ErrInvalidLengthRaft 1588 } 1589 if (iNdEx + skippy) > l { 1590 return io.ErrUnexpectedEOF 1591 } 1592 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 1593 iNdEx += skippy 1594 } 1595 } 1596 1597 if iNdEx > l { 1598 return io.ErrUnexpectedEOF 1599 } 1600 return nil 1601} 1602func (m *ConfChange) Unmarshal(dAtA []byte) error { 1603 l := len(dAtA) 1604 iNdEx := 0 1605 for iNdEx < l { 1606 preIndex := iNdEx 1607 var wire uint64 1608 for shift := uint(0); ; shift += 7 { 1609 if shift >= 64 { 1610 return ErrIntOverflowRaft 1611 } 1612 if iNdEx >= l { 1613 return io.ErrUnexpectedEOF 1614 } 1615 b := dAtA[iNdEx] 1616 iNdEx++ 1617 wire |= (uint64(b) & 0x7F) << shift 1618 if b < 0x80 { 1619 break 1620 } 1621 } 1622 fieldNum := int32(wire >> 3) 1623 wireType := int(wire & 0x7) 1624 if wireType == 4 { 1625 return fmt.Errorf("proto: ConfChange: wiretype end group for non-group") 1626 } 1627 if fieldNum <= 0 { 1628 return fmt.Errorf("proto: ConfChange: illegal tag %d (wire type %d)", fieldNum, wire) 1629 } 1630 switch fieldNum { 1631 case 1: 1632 if wireType != 0 { 1633 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 1634 } 1635 m.ID = 0 1636 for shift := uint(0); ; shift += 7 { 1637 if shift >= 64 { 1638 return ErrIntOverflowRaft 1639 } 1640 if iNdEx >= l { 1641 return io.ErrUnexpectedEOF 1642 } 1643 b := dAtA[iNdEx] 1644 iNdEx++ 1645 m.ID |= (uint64(b) & 0x7F) << shift 1646 if b < 0x80 { 1647 break 1648 } 1649 } 1650 case 2: 1651 if wireType != 0 { 1652 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) 1653 } 1654 m.Type = 0 1655 for shift := uint(0); ; shift += 7 { 1656 if shift >= 64 { 1657 return ErrIntOverflowRaft 1658 } 1659 if iNdEx >= l { 1660 return io.ErrUnexpectedEOF 1661 } 1662 b := dAtA[iNdEx] 1663 iNdEx++ 1664 m.Type |= (ConfChangeType(b) & 0x7F) << shift 1665 if b < 0x80 { 1666 break 1667 } 1668 } 1669 case 3: 1670 if wireType != 0 { 1671 return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) 1672 } 1673 m.NodeID = 0 1674 for shift := uint(0); ; shift += 7 { 1675 if shift >= 64 { 1676 return ErrIntOverflowRaft 1677 } 1678 if iNdEx >= l { 1679 return io.ErrUnexpectedEOF 1680 } 1681 b := dAtA[iNdEx] 1682 iNdEx++ 1683 m.NodeID |= (uint64(b) & 0x7F) << shift 1684 if b < 0x80 { 1685 break 1686 } 1687 } 1688 case 4: 1689 if wireType != 2 { 1690 return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) 1691 } 1692 var byteLen int 1693 for shift := uint(0); ; shift += 7 { 1694 if shift >= 64 { 1695 return ErrIntOverflowRaft 1696 } 1697 if iNdEx >= l { 1698 return io.ErrUnexpectedEOF 1699 } 1700 b := dAtA[iNdEx] 1701 iNdEx++ 1702 byteLen |= (int(b) & 0x7F) << shift 1703 if b < 0x80 { 1704 break 1705 } 1706 } 1707 if byteLen < 0 { 1708 return ErrInvalidLengthRaft 1709 } 1710 postIndex := iNdEx + byteLen 1711 if postIndex > l { 1712 return io.ErrUnexpectedEOF 1713 } 1714 m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) 1715 if m.Context == nil { 1716 m.Context = []byte{} 1717 } 1718 iNdEx = postIndex 1719 default: 1720 iNdEx = preIndex 1721 skippy, err := skipRaft(dAtA[iNdEx:]) 1722 if err != nil { 1723 return err 1724 } 1725 if skippy < 0 { 1726 return ErrInvalidLengthRaft 1727 } 1728 if (iNdEx + skippy) > l { 1729 return io.ErrUnexpectedEOF 1730 } 1731 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 1732 iNdEx += skippy 1733 } 1734 } 1735 1736 if iNdEx > l { 1737 return io.ErrUnexpectedEOF 1738 } 1739 return nil 1740} 1741func skipRaft(dAtA []byte) (n int, err error) { 1742 l := len(dAtA) 1743 iNdEx := 0 1744 for iNdEx < l { 1745 var wire uint64 1746 for shift := uint(0); ; shift += 7 { 1747 if shift >= 64 { 1748 return 0, ErrIntOverflowRaft 1749 } 1750 if iNdEx >= l { 1751 return 0, io.ErrUnexpectedEOF 1752 } 1753 b := dAtA[iNdEx] 1754 iNdEx++ 1755 wire |= (uint64(b) & 0x7F) << shift 1756 if b < 0x80 { 1757 break 1758 } 1759 } 1760 wireType := int(wire & 0x7) 1761 switch wireType { 1762 case 0: 1763 for shift := uint(0); ; shift += 7 { 1764 if shift >= 64 { 1765 return 0, ErrIntOverflowRaft 1766 } 1767 if iNdEx >= l { 1768 return 0, io.ErrUnexpectedEOF 1769 } 1770 iNdEx++ 1771 if dAtA[iNdEx-1] < 0x80 { 1772 break 1773 } 1774 } 1775 return iNdEx, nil 1776 case 1: 1777 iNdEx += 8 1778 return iNdEx, nil 1779 case 2: 1780 var length int 1781 for shift := uint(0); ; shift += 7 { 1782 if shift >= 64 { 1783 return 0, ErrIntOverflowRaft 1784 } 1785 if iNdEx >= l { 1786 return 0, io.ErrUnexpectedEOF 1787 } 1788 b := dAtA[iNdEx] 1789 iNdEx++ 1790 length |= (int(b) & 0x7F) << shift 1791 if b < 0x80 { 1792 break 1793 } 1794 } 1795 iNdEx += length 1796 if length < 0 { 1797 return 0, ErrInvalidLengthRaft 1798 } 1799 return iNdEx, nil 1800 case 3: 1801 for { 1802 var innerWire uint64 1803 var start int = iNdEx 1804 for shift := uint(0); ; shift += 7 { 1805 if shift >= 64 { 1806 return 0, ErrIntOverflowRaft 1807 } 1808 if iNdEx >= l { 1809 return 0, io.ErrUnexpectedEOF 1810 } 1811 b := dAtA[iNdEx] 1812 iNdEx++ 1813 innerWire |= (uint64(b) & 0x7F) << shift 1814 if b < 0x80 { 1815 break 1816 } 1817 } 1818 innerWireType := int(innerWire & 0x7) 1819 if innerWireType == 4 { 1820 break 1821 } 1822 next, err := skipRaft(dAtA[start:]) 1823 if err != nil { 1824 return 0, err 1825 } 1826 iNdEx = start + next 1827 } 1828 return iNdEx, nil 1829 case 4: 1830 return iNdEx, nil 1831 case 5: 1832 iNdEx += 4 1833 return iNdEx, nil 1834 default: 1835 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 1836 } 1837 } 1838 panic("unreachable") 1839} 1840 1841var ( 1842 ErrInvalidLengthRaft = fmt.Errorf("proto: negative length found during unmarshaling") 1843 ErrIntOverflowRaft = fmt.Errorf("proto: integer overflow") 1844) 1845 1846func init() { proto.RegisterFile("raft.proto", fileDescriptorRaft) } 1847 1848var fileDescriptorRaft = []byte{ 1849 // 790 bytes of a gzipped FileDescriptorProto 1850 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x54, 0xcd, 0x6e, 0xdb, 0x46, 1851 0x10, 0x16, 0x29, 0xea, 0x6f, 0x28, 0xcb, 0xab, 0xb5, 0x5a, 0x2c, 0x0c, 0x43, 0x55, 0x85, 0x1e, 1852 0x04, 0x17, 0x76, 0x5b, 0x1d, 0x7a, 0xe8, 0xcd, 0x96, 0x0a, 0x58, 0x40, 0x65, 0xb8, 0xb2, 0xdc, 1853 0x43, 0x83, 0x20, 0x58, 0x8b, 0x2b, 0x4a, 0x89, 0xc9, 0x25, 0x96, 0x2b, 0xc7, 0xbe, 0x04, 0x79, 1854 0x80, 0x3c, 0x40, 0x2e, 0x79, 0x1f, 0x1f, 0x0d, 0xe4, 0x1e, 0xc4, 0xce, 0x8b, 0x04, 0xbb, 0x5c, 1855 0x4a, 0x94, 0x74, 0xdb, 0xf9, 0xbe, 0xe1, 0xcc, 0x37, 0xdf, 0xce, 0x12, 0x40, 0xd0, 0xa9, 0x3c, 1856 0x8e, 0x04, 0x97, 0x1c, 0x17, 0xd5, 0x39, 0xba, 0xde, 0x6f, 0xf8, 0xdc, 0xe7, 0x1a, 0xfa, 0x4d, 1857 0x9d, 0x12, 0xb6, 0xfd, 0x0e, 0x0a, 0x7f, 0x87, 0x52, 0xdc, 0xe3, 0x5f, 0xc1, 0x19, 0xdf, 0x47, 1858 0x8c, 0x58, 0x2d, 0xab, 0x53, 0xeb, 0xd6, 0x8f, 0x93, 0xaf, 0x8e, 0x35, 0xa9, 0x88, 0x53, 0xe7, 1859 0xe1, 0xcb, 0x4f, 0xb9, 0x91, 0x4e, 0xc2, 0x04, 0x9c, 0x31, 0x13, 0x01, 0xb1, 0x5b, 0x56, 0xc7, 1860 0x59, 0x32, 0x4c, 0x04, 0x78, 0x1f, 0x0a, 0x83, 0xd0, 0x63, 0x77, 0x24, 0x9f, 0xa1, 0x12, 0x08, 1861 0x63, 0x70, 0xfa, 0x54, 0x52, 0xe2, 0xb4, 0xac, 0x4e, 0x75, 0xa4, 0xcf, 0xed, 0xf7, 0x16, 0xa0, 1862 0xcb, 0x90, 0x46, 0xf1, 0x8c, 0xcb, 0x21, 0x93, 0xd4, 0xa3, 0x92, 0xe2, 0x3f, 0x01, 0x26, 0x3c, 1863 0x9c, 0xbe, 0x8a, 0x25, 0x95, 0x89, 0x22, 0x77, 0xa5, 0xa8, 0xc7, 0xc3, 0xe9, 0xa5, 0x22, 0x4c, 1864 0xf1, 0xca, 0x24, 0x05, 0x54, 0xf3, 0xb9, 0x6e, 0x9e, 0xd5, 0x95, 0x40, 0x4a, 0xb2, 0x54, 0x92, 1865 0xb3, 0xba, 0x34, 0xd2, 0xfe, 0x1f, 0xca, 0xa9, 0x02, 0x25, 0x51, 0x29, 0xd0, 0x3d, 0xab, 0x23, 1866 0x7d, 0xc6, 0x7f, 0x41, 0x39, 0x30, 0xca, 0x74, 0x61, 0xb7, 0x4b, 0x52, 0x2d, 0x9b, 0xca, 0x4d, 1867 0xdd, 0x65, 0x7e, 0xfb, 0x53, 0x1e, 0x4a, 0x43, 0x16, 0xc7, 0xd4, 0x67, 0xf8, 0x08, 0x1c, 0xb9, 1868 0x72, 0x78, 0x2f, 0xad, 0x61, 0xe8, 0xac, 0xc7, 0x2a, 0x0d, 0x37, 0xc0, 0x96, 0x7c, 0x6d, 0x12, 1869 0x5b, 0x72, 0x35, 0xc6, 0x54, 0xf0, 0x8d, 0x31, 0x14, 0xb2, 0x1c, 0xd0, 0xd9, 0x1c, 0x10, 0x37, 1870 0xa1, 0x74, 0xc3, 0x7d, 0x7d, 0x61, 0x85, 0x0c, 0x99, 0x82, 0x2b, 0xdb, 0x8a, 0xdb, 0xb6, 0x1d, 1871 0x41, 0x89, 0x85, 0x52, 0xcc, 0x59, 0x4c, 0x4a, 0xad, 0x7c, 0xc7, 0xed, 0xee, 0xac, 0x6d, 0x46, 1872 0x5a, 0xca, 0xe4, 0xe0, 0x03, 0x28, 0x4e, 0x78, 0x10, 0xcc, 0x25, 0x29, 0x67, 0x6a, 0x19, 0x0c, 1873 0x77, 0xa1, 0x1c, 0x1b, 0xc7, 0x48, 0x45, 0x3b, 0x89, 0x36, 0x9d, 0x4c, 0x1d, 0x4c, 0xf3, 0x54, 1874 0x45, 0xc1, 0x5e, 0xb3, 0x89, 0x24, 0xd0, 0xb2, 0x3a, 0xe5, 0xb4, 0x62, 0x82, 0xe1, 0x5f, 0x00, 1875 0x92, 0xd3, 0xd9, 0x3c, 0x94, 0xc4, 0xcd, 0xf4, 0xcc, 0xe0, 0x98, 0x40, 0x69, 0xc2, 0x43, 0xc9, 1876 0xee, 0x24, 0xa9, 0xea, 0x8b, 0x4d, 0xc3, 0xf6, 0x4b, 0xa8, 0x9c, 0x51, 0xe1, 0x25, 0xeb, 0x93, 1877 0x3a, 0x68, 0x6d, 0x39, 0x48, 0xc0, 0xb9, 0xe5, 0x92, 0xad, 0xef, 0xbb, 0x42, 0x32, 0x03, 0xe7, 1878 0xb7, 0x07, 0x6e, 0xff, 0x0c, 0x95, 0xe5, 0xba, 0xe2, 0x06, 0x14, 0x42, 0xee, 0xb1, 0x98, 0x58, 1879 0xad, 0x7c, 0xc7, 0x19, 0x25, 0x41, 0xfb, 0x83, 0x05, 0xa0, 0x72, 0x7a, 0x33, 0x1a, 0xfa, 0xfa, 1880 0xd6, 0x07, 0xfd, 0x35, 0x05, 0xf6, 0xa0, 0x8f, 0x7f, 0x37, 0x8f, 0xd3, 0xd6, 0xab, 0xf3, 0x63, 1881 0xf6, 0x29, 0x24, 0xdf, 0x6d, 0xbd, 0xd0, 0x03, 0x28, 0x9e, 0x73, 0x8f, 0x0d, 0xfa, 0xeb, 0xba, 1882 0x12, 0x4c, 0x19, 0xd2, 0x33, 0x86, 0x24, 0x8f, 0x31, 0x0d, 0x0f, 0xff, 0x80, 0xca, 0xf2, 0xc9, 1883 0xe3, 0x5d, 0x70, 0x75, 0x70, 0xce, 0x45, 0x40, 0x6f, 0x50, 0x0e, 0xef, 0xc1, 0xae, 0x06, 0x56, 1884 0x8d, 0x91, 0x75, 0xf8, 0xd9, 0x06, 0x37, 0xb3, 0xc4, 0x18, 0xa0, 0x38, 0x8c, 0xfd, 0xb3, 0x45, 1885 0x84, 0x72, 0xd8, 0x85, 0xd2, 0x30, 0xf6, 0x4f, 0x19, 0x95, 0xc8, 0x32, 0xc1, 0x85, 0xe0, 0x11, 1886 0xb2, 0x4d, 0xd6, 0x49, 0x14, 0xa1, 0x3c, 0xae, 0x01, 0x24, 0xe7, 0x11, 0x8b, 0x23, 0xe4, 0x98, 1887 0xc4, 0xff, 0xb8, 0x64, 0xa8, 0xa0, 0x44, 0x98, 0x40, 0xb3, 0x45, 0xc3, 0xaa, 0x85, 0x41, 0x25, 1888 0x8c, 0xa0, 0xaa, 0x9a, 0x31, 0x2a, 0xe4, 0xb5, 0xea, 0x52, 0xc6, 0x0d, 0x40, 0x59, 0x44, 0x7f, 1889 0x54, 0xc1, 0x18, 0x6a, 0xc3, 0xd8, 0xbf, 0x0a, 0x05, 0xa3, 0x93, 0x19, 0xbd, 0xbe, 0x61, 0x08, 1890 0x70, 0x1d, 0x76, 0x4c, 0x21, 0x75, 0x41, 0x8b, 0x18, 0xb9, 0x26, 0xad, 0x37, 0x63, 0x93, 0x37, 1891 0xff, 0x2e, 0xb8, 0x58, 0x04, 0xa8, 0x8a, 0x7f, 0x80, 0xfa, 0x30, 0xf6, 0xc7, 0x82, 0x86, 0xf1, 1892 0x94, 0x89, 0x7f, 0x18, 0xf5, 0x98, 0x40, 0x3b, 0xe6, 0xeb, 0xf1, 0x3c, 0x60, 0x7c, 0x21, 0xcf, 1893 0xf9, 0x5b, 0x54, 0x33, 0x62, 0x46, 0x8c, 0x7a, 0xfa, 0x87, 0x87, 0x76, 0x8d, 0x98, 0x25, 0xa2, 1894 0xc5, 0x20, 0x33, 0xef, 0x85, 0x60, 0x7a, 0xc4, 0xba, 0xe9, 0x6a, 0x62, 0x9d, 0x83, 0x0f, 0x5f, 1895 0x40, 0x6d, 0xfd, 0x7a, 0x95, 0x8e, 0x15, 0x72, 0xe2, 0x79, 0xea, 0x2e, 0x51, 0x0e, 0x13, 0x68, 1896 0xac, 0xe0, 0x11, 0x0b, 0xf8, 0x2d, 0xd3, 0x8c, 0xb5, 0xce, 0x5c, 0x45, 0x1e, 0x95, 0x09, 0x63, 1897 0x9f, 0x92, 0x87, 0xa7, 0x66, 0xee, 0xf1, 0xa9, 0x99, 0x7b, 0x78, 0x6e, 0x5a, 0x8f, 0xcf, 0x4d, 1898 0xeb, 0xeb, 0x73, 0xd3, 0xfa, 0xf8, 0xad, 0x99, 0xfb, 0x1e, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x30, 1899 0x01, 0x41, 0x3a, 0x06, 0x00, 0x00, 1900} 1901