| Abhay Kumar | a2ae599 | 2025-11-10 14:02:24 +0000 | [diff] [blame^] | 1 | // Code generated by protoc-gen-gogo. DO NOT EDIT. |
| 2 | // source: raft.proto |
| 3 | |
| 4 | package raftpb |
| 5 | |
| 6 | import ( |
| 7 | fmt "fmt" |
| 8 | io "io" |
| 9 | math "math" |
| 10 | math_bits "math/bits" |
| 11 | |
| 12 | _ "github.com/gogo/protobuf/gogoproto" |
| 13 | proto "github.com/golang/protobuf/proto" |
| 14 | ) |
| 15 | |
| 16 | // Reference imports to suppress errors if they are not otherwise used. |
| 17 | var _ = proto.Marshal |
| 18 | var _ = fmt.Errorf |
| 19 | var _ = math.Inf |
| 20 | |
| 21 | // This is a compile-time assertion to ensure that this generated file |
| 22 | // is compatible with the proto package it is being compiled against. |
| 23 | // A compilation error at this line likely means your copy of the |
| 24 | // proto package needs to be updated. |
| 25 | const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package |
| 26 | |
| 27 | type EntryType int32 |
| 28 | |
| 29 | const ( |
| 30 | EntryNormal EntryType = 0 |
| 31 | EntryConfChange EntryType = 1 |
| 32 | EntryConfChangeV2 EntryType = 2 |
| 33 | ) |
| 34 | |
| 35 | var EntryType_name = map[int32]string{ |
| 36 | 0: "EntryNormal", |
| 37 | 1: "EntryConfChange", |
| 38 | 2: "EntryConfChangeV2", |
| 39 | } |
| 40 | |
| 41 | var EntryType_value = map[string]int32{ |
| 42 | "EntryNormal": 0, |
| 43 | "EntryConfChange": 1, |
| 44 | "EntryConfChangeV2": 2, |
| 45 | } |
| 46 | |
| 47 | func (x EntryType) Enum() *EntryType { |
| 48 | p := new(EntryType) |
| 49 | *p = x |
| 50 | return p |
| 51 | } |
| 52 | |
| 53 | func (x EntryType) String() string { |
| 54 | return proto.EnumName(EntryType_name, int32(x)) |
| 55 | } |
| 56 | |
| 57 | func (x *EntryType) UnmarshalJSON(data []byte) error { |
| 58 | value, err := proto.UnmarshalJSONEnum(EntryType_value, data, "EntryType") |
| 59 | if err != nil { |
| 60 | return err |
| 61 | } |
| 62 | *x = EntryType(value) |
| 63 | return nil |
| 64 | } |
| 65 | |
| 66 | func (EntryType) EnumDescriptor() ([]byte, []int) { |
| 67 | return fileDescriptor_b042552c306ae59b, []int{0} |
| 68 | } |
| 69 | |
| 70 | // For description of different message types, see: |
| 71 | // https://pkg.go.dev/go.etcd.io/raft/v3#hdr-MessageType |
| 72 | type MessageType int32 |
| 73 | |
| 74 | const ( |
| 75 | MsgHup MessageType = 0 |
| 76 | MsgBeat MessageType = 1 |
| 77 | MsgProp MessageType = 2 |
| 78 | MsgApp MessageType = 3 |
| 79 | MsgAppResp MessageType = 4 |
| 80 | MsgVote MessageType = 5 |
| 81 | MsgVoteResp MessageType = 6 |
| 82 | MsgSnap MessageType = 7 |
| 83 | MsgHeartbeat MessageType = 8 |
| 84 | MsgHeartbeatResp MessageType = 9 |
| 85 | MsgUnreachable MessageType = 10 |
| 86 | MsgSnapStatus MessageType = 11 |
| 87 | MsgCheckQuorum MessageType = 12 |
| 88 | MsgTransferLeader MessageType = 13 |
| 89 | MsgTimeoutNow MessageType = 14 |
| 90 | MsgReadIndex MessageType = 15 |
| 91 | MsgReadIndexResp MessageType = 16 |
| 92 | MsgPreVote MessageType = 17 |
| 93 | MsgPreVoteResp MessageType = 18 |
| 94 | MsgStorageAppend MessageType = 19 |
| 95 | MsgStorageAppendResp MessageType = 20 |
| 96 | MsgStorageApply MessageType = 21 |
| 97 | MsgStorageApplyResp MessageType = 22 |
| 98 | MsgForgetLeader MessageType = 23 |
| 99 | ) |
| 100 | |
| 101 | var 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 | 19: "MsgStorageAppend", |
| 122 | 20: "MsgStorageAppendResp", |
| 123 | 21: "MsgStorageApply", |
| 124 | 22: "MsgStorageApplyResp", |
| 125 | 23: "MsgForgetLeader", |
| 126 | } |
| 127 | |
| 128 | var MessageType_value = map[string]int32{ |
| 129 | "MsgHup": 0, |
| 130 | "MsgBeat": 1, |
| 131 | "MsgProp": 2, |
| 132 | "MsgApp": 3, |
| 133 | "MsgAppResp": 4, |
| 134 | "MsgVote": 5, |
| 135 | "MsgVoteResp": 6, |
| 136 | "MsgSnap": 7, |
| 137 | "MsgHeartbeat": 8, |
| 138 | "MsgHeartbeatResp": 9, |
| 139 | "MsgUnreachable": 10, |
| 140 | "MsgSnapStatus": 11, |
| 141 | "MsgCheckQuorum": 12, |
| 142 | "MsgTransferLeader": 13, |
| 143 | "MsgTimeoutNow": 14, |
| 144 | "MsgReadIndex": 15, |
| 145 | "MsgReadIndexResp": 16, |
| 146 | "MsgPreVote": 17, |
| 147 | "MsgPreVoteResp": 18, |
| 148 | "MsgStorageAppend": 19, |
| 149 | "MsgStorageAppendResp": 20, |
| 150 | "MsgStorageApply": 21, |
| 151 | "MsgStorageApplyResp": 22, |
| 152 | "MsgForgetLeader": 23, |
| 153 | } |
| 154 | |
| 155 | func (x MessageType) Enum() *MessageType { |
| 156 | p := new(MessageType) |
| 157 | *p = x |
| 158 | return p |
| 159 | } |
| 160 | |
| 161 | func (x MessageType) String() string { |
| 162 | return proto.EnumName(MessageType_name, int32(x)) |
| 163 | } |
| 164 | |
| 165 | func (x *MessageType) UnmarshalJSON(data []byte) error { |
| 166 | value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType") |
| 167 | if err != nil { |
| 168 | return err |
| 169 | } |
| 170 | *x = MessageType(value) |
| 171 | return nil |
| 172 | } |
| 173 | |
| 174 | func (MessageType) EnumDescriptor() ([]byte, []int) { |
| 175 | return fileDescriptor_b042552c306ae59b, []int{1} |
| 176 | } |
| 177 | |
| 178 | // ConfChangeTransition specifies the behavior of a configuration change with |
| 179 | // respect to joint consensus. |
| 180 | type ConfChangeTransition int32 |
| 181 | |
| 182 | const ( |
| 183 | // Automatically use the simple protocol if possible, otherwise fall back |
| 184 | // to ConfChangeJointImplicit. Most applications will want to use this. |
| 185 | ConfChangeTransitionAuto ConfChangeTransition = 0 |
| 186 | // Use joint consensus unconditionally, and transition out of them |
| 187 | // automatically (by proposing a zero configuration change). |
| 188 | // |
| 189 | // This option is suitable for applications that want to minimize the time |
| 190 | // spent in the joint configuration and do not store the joint configuration |
| 191 | // in the state machine (outside of InitialState). |
| 192 | ConfChangeTransitionJointImplicit ConfChangeTransition = 1 |
| 193 | // Use joint consensus and remain in the joint configuration until the |
| 194 | // application proposes a no-op configuration change. This is suitable for |
| 195 | // applications that want to explicitly control the transitions, for example |
| 196 | // to use a custom payload (via the Context field). |
| 197 | ConfChangeTransitionJointExplicit ConfChangeTransition = 2 |
| 198 | ) |
| 199 | |
| 200 | var ConfChangeTransition_name = map[int32]string{ |
| 201 | 0: "ConfChangeTransitionAuto", |
| 202 | 1: "ConfChangeTransitionJointImplicit", |
| 203 | 2: "ConfChangeTransitionJointExplicit", |
| 204 | } |
| 205 | |
| 206 | var ConfChangeTransition_value = map[string]int32{ |
| 207 | "ConfChangeTransitionAuto": 0, |
| 208 | "ConfChangeTransitionJointImplicit": 1, |
| 209 | "ConfChangeTransitionJointExplicit": 2, |
| 210 | } |
| 211 | |
| 212 | func (x ConfChangeTransition) Enum() *ConfChangeTransition { |
| 213 | p := new(ConfChangeTransition) |
| 214 | *p = x |
| 215 | return p |
| 216 | } |
| 217 | |
| 218 | func (x ConfChangeTransition) String() string { |
| 219 | return proto.EnumName(ConfChangeTransition_name, int32(x)) |
| 220 | } |
| 221 | |
| 222 | func (x *ConfChangeTransition) UnmarshalJSON(data []byte) error { |
| 223 | value, err := proto.UnmarshalJSONEnum(ConfChangeTransition_value, data, "ConfChangeTransition") |
| 224 | if err != nil { |
| 225 | return err |
| 226 | } |
| 227 | *x = ConfChangeTransition(value) |
| 228 | return nil |
| 229 | } |
| 230 | |
| 231 | func (ConfChangeTransition) EnumDescriptor() ([]byte, []int) { |
| 232 | return fileDescriptor_b042552c306ae59b, []int{2} |
| 233 | } |
| 234 | |
| 235 | type ConfChangeType int32 |
| 236 | |
| 237 | const ( |
| 238 | ConfChangeAddNode ConfChangeType = 0 |
| 239 | ConfChangeRemoveNode ConfChangeType = 1 |
| 240 | ConfChangeUpdateNode ConfChangeType = 2 |
| 241 | ConfChangeAddLearnerNode ConfChangeType = 3 |
| 242 | ) |
| 243 | |
| 244 | var ConfChangeType_name = map[int32]string{ |
| 245 | 0: "ConfChangeAddNode", |
| 246 | 1: "ConfChangeRemoveNode", |
| 247 | 2: "ConfChangeUpdateNode", |
| 248 | 3: "ConfChangeAddLearnerNode", |
| 249 | } |
| 250 | |
| 251 | var ConfChangeType_value = map[string]int32{ |
| 252 | "ConfChangeAddNode": 0, |
| 253 | "ConfChangeRemoveNode": 1, |
| 254 | "ConfChangeUpdateNode": 2, |
| 255 | "ConfChangeAddLearnerNode": 3, |
| 256 | } |
| 257 | |
| 258 | func (x ConfChangeType) Enum() *ConfChangeType { |
| 259 | p := new(ConfChangeType) |
| 260 | *p = x |
| 261 | return p |
| 262 | } |
| 263 | |
| 264 | func (x ConfChangeType) String() string { |
| 265 | return proto.EnumName(ConfChangeType_name, int32(x)) |
| 266 | } |
| 267 | |
| 268 | func (x *ConfChangeType) UnmarshalJSON(data []byte) error { |
| 269 | value, err := proto.UnmarshalJSONEnum(ConfChangeType_value, data, "ConfChangeType") |
| 270 | if err != nil { |
| 271 | return err |
| 272 | } |
| 273 | *x = ConfChangeType(value) |
| 274 | return nil |
| 275 | } |
| 276 | |
| 277 | func (ConfChangeType) EnumDescriptor() ([]byte, []int) { |
| 278 | return fileDescriptor_b042552c306ae59b, []int{3} |
| 279 | } |
| 280 | |
| 281 | type Entry struct { |
| 282 | Term uint64 `protobuf:"varint,2,opt,name=Term" json:"Term"` |
| 283 | Index uint64 `protobuf:"varint,3,opt,name=Index" json:"Index"` |
| 284 | Type EntryType `protobuf:"varint,1,opt,name=Type,enum=raftpb.EntryType" json:"Type"` |
| 285 | Data []byte `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"` |
| 286 | } |
| 287 | |
| 288 | func (m *Entry) Reset() { *m = Entry{} } |
| 289 | func (m *Entry) String() string { return proto.CompactTextString(m) } |
| 290 | func (*Entry) ProtoMessage() {} |
| 291 | func (*Entry) Descriptor() ([]byte, []int) { |
| 292 | return fileDescriptor_b042552c306ae59b, []int{0} |
| 293 | } |
| 294 | func (m *Entry) XXX_Unmarshal(b []byte) error { |
| 295 | return m.Unmarshal(b) |
| 296 | } |
| 297 | func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 298 | if deterministic { |
| 299 | return xxx_messageInfo_Entry.Marshal(b, m, deterministic) |
| 300 | } else { |
| 301 | b = b[:cap(b)] |
| 302 | n, err := m.MarshalToSizedBuffer(b) |
| 303 | if err != nil { |
| 304 | return nil, err |
| 305 | } |
| 306 | return b[:n], nil |
| 307 | } |
| 308 | } |
| 309 | func (m *Entry) XXX_Merge(src proto.Message) { |
| 310 | xxx_messageInfo_Entry.Merge(m, src) |
| 311 | } |
| 312 | func (m *Entry) XXX_Size() int { |
| 313 | return m.Size() |
| 314 | } |
| 315 | func (m *Entry) XXX_DiscardUnknown() { |
| 316 | xxx_messageInfo_Entry.DiscardUnknown(m) |
| 317 | } |
| 318 | |
| 319 | var xxx_messageInfo_Entry proto.InternalMessageInfo |
| 320 | |
| 321 | type SnapshotMetadata struct { |
| 322 | ConfState ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state"` |
| 323 | Index uint64 `protobuf:"varint,2,opt,name=index" json:"index"` |
| 324 | Term uint64 `protobuf:"varint,3,opt,name=term" json:"term"` |
| 325 | } |
| 326 | |
| 327 | func (m *SnapshotMetadata) Reset() { *m = SnapshotMetadata{} } |
| 328 | func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) } |
| 329 | func (*SnapshotMetadata) ProtoMessage() {} |
| 330 | func (*SnapshotMetadata) Descriptor() ([]byte, []int) { |
| 331 | return fileDescriptor_b042552c306ae59b, []int{1} |
| 332 | } |
| 333 | func (m *SnapshotMetadata) XXX_Unmarshal(b []byte) error { |
| 334 | return m.Unmarshal(b) |
| 335 | } |
| 336 | func (m *SnapshotMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 337 | if deterministic { |
| 338 | return xxx_messageInfo_SnapshotMetadata.Marshal(b, m, deterministic) |
| 339 | } else { |
| 340 | b = b[:cap(b)] |
| 341 | n, err := m.MarshalToSizedBuffer(b) |
| 342 | if err != nil { |
| 343 | return nil, err |
| 344 | } |
| 345 | return b[:n], nil |
| 346 | } |
| 347 | } |
| 348 | func (m *SnapshotMetadata) XXX_Merge(src proto.Message) { |
| 349 | xxx_messageInfo_SnapshotMetadata.Merge(m, src) |
| 350 | } |
| 351 | func (m *SnapshotMetadata) XXX_Size() int { |
| 352 | return m.Size() |
| 353 | } |
| 354 | func (m *SnapshotMetadata) XXX_DiscardUnknown() { |
| 355 | xxx_messageInfo_SnapshotMetadata.DiscardUnknown(m) |
| 356 | } |
| 357 | |
| 358 | var xxx_messageInfo_SnapshotMetadata proto.InternalMessageInfo |
| 359 | |
| 360 | type Snapshot struct { |
| 361 | Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` |
| 362 | Metadata SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata"` |
| 363 | } |
| 364 | |
| 365 | func (m *Snapshot) Reset() { *m = Snapshot{} } |
| 366 | func (m *Snapshot) String() string { return proto.CompactTextString(m) } |
| 367 | func (*Snapshot) ProtoMessage() {} |
| 368 | func (*Snapshot) Descriptor() ([]byte, []int) { |
| 369 | return fileDescriptor_b042552c306ae59b, []int{2} |
| 370 | } |
| 371 | func (m *Snapshot) XXX_Unmarshal(b []byte) error { |
| 372 | return m.Unmarshal(b) |
| 373 | } |
| 374 | func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 375 | if deterministic { |
| 376 | return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic) |
| 377 | } else { |
| 378 | b = b[:cap(b)] |
| 379 | n, err := m.MarshalToSizedBuffer(b) |
| 380 | if err != nil { |
| 381 | return nil, err |
| 382 | } |
| 383 | return b[:n], nil |
| 384 | } |
| 385 | } |
| 386 | func (m *Snapshot) XXX_Merge(src proto.Message) { |
| 387 | xxx_messageInfo_Snapshot.Merge(m, src) |
| 388 | } |
| 389 | func (m *Snapshot) XXX_Size() int { |
| 390 | return m.Size() |
| 391 | } |
| 392 | func (m *Snapshot) XXX_DiscardUnknown() { |
| 393 | xxx_messageInfo_Snapshot.DiscardUnknown(m) |
| 394 | } |
| 395 | |
| 396 | var xxx_messageInfo_Snapshot proto.InternalMessageInfo |
| 397 | |
| 398 | type Message struct { |
| 399 | Type MessageType `protobuf:"varint,1,opt,name=type,enum=raftpb.MessageType" json:"type"` |
| 400 | To uint64 `protobuf:"varint,2,opt,name=to" json:"to"` |
| 401 | From uint64 `protobuf:"varint,3,opt,name=from" json:"from"` |
| 402 | Term uint64 `protobuf:"varint,4,opt,name=term" json:"term"` |
| 403 | // logTerm is generally used for appending Raft logs to followers. For example, |
| 404 | // (type=MsgApp,index=100,logTerm=5) means the leader appends entries starting |
| 405 | // at index=101, and the term of the entry at index 100 is 5. |
| 406 | // (type=MsgAppResp,reject=true,index=100,logTerm=5) means follower rejects some |
| 407 | // entries from its leader as it already has an entry with term 5 at index 100. |
| 408 | // (type=MsgStorageAppendResp,index=100,logTerm=5) means the local node wrote |
| 409 | // entries up to index=100 in stable storage, and the term of the entry at index |
| 410 | // 100 was 5. This doesn't always mean that the corresponding MsgStorageAppend |
| 411 | // message was the one that carried these entries, just that those entries were |
| 412 | // stable at the time of processing the corresponding MsgStorageAppend. |
| 413 | LogTerm uint64 `protobuf:"varint,5,opt,name=logTerm" json:"logTerm"` |
| 414 | Index uint64 `protobuf:"varint,6,opt,name=index" json:"index"` |
| 415 | Entries []Entry `protobuf:"bytes,7,rep,name=entries" json:"entries"` |
| 416 | Commit uint64 `protobuf:"varint,8,opt,name=commit" json:"commit"` |
| 417 | // (type=MsgStorageAppend,vote=5,term=10) means the local node is voting for |
| 418 | // peer 5 in term 10. For MsgStorageAppends, the term, vote, and commit fields |
| 419 | // will either all be set (to facilitate the construction of a HardState) if |
| 420 | // any of the fields have changed or will all be unset if none of the fields |
| 421 | // have changed. |
| 422 | Vote uint64 `protobuf:"varint,13,opt,name=vote" json:"vote"` |
| 423 | // snapshot is non-nil and non-empty for MsgSnap messages and nil for all other |
| 424 | // message types. However, peer nodes running older binary versions may send a |
| 425 | // non-nil, empty value for the snapshot field of non-MsgSnap messages. Code |
| 426 | // should be prepared to handle such messages. |
| 427 | Snapshot *Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot,omitempty"` |
| 428 | Reject bool `protobuf:"varint,10,opt,name=reject" json:"reject"` |
| 429 | RejectHint uint64 `protobuf:"varint,11,opt,name=rejectHint" json:"rejectHint"` |
| 430 | Context []byte `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"` |
| 431 | // responses are populated by a raft node to instruct storage threads on how |
| 432 | // to respond and who to respond to when the work associated with a message |
| 433 | // is complete. Populated for MsgStorageAppend and MsgStorageApply messages. |
| 434 | Responses []Message `protobuf:"bytes,14,rep,name=responses" json:"responses"` |
| 435 | } |
| 436 | |
| 437 | func (m *Message) Reset() { *m = Message{} } |
| 438 | func (m *Message) String() string { return proto.CompactTextString(m) } |
| 439 | func (*Message) ProtoMessage() {} |
| 440 | func (*Message) Descriptor() ([]byte, []int) { |
| 441 | return fileDescriptor_b042552c306ae59b, []int{3} |
| 442 | } |
| 443 | func (m *Message) XXX_Unmarshal(b []byte) error { |
| 444 | return m.Unmarshal(b) |
| 445 | } |
| 446 | func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 447 | if deterministic { |
| 448 | return xxx_messageInfo_Message.Marshal(b, m, deterministic) |
| 449 | } else { |
| 450 | b = b[:cap(b)] |
| 451 | n, err := m.MarshalToSizedBuffer(b) |
| 452 | if err != nil { |
| 453 | return nil, err |
| 454 | } |
| 455 | return b[:n], nil |
| 456 | } |
| 457 | } |
| 458 | func (m *Message) XXX_Merge(src proto.Message) { |
| 459 | xxx_messageInfo_Message.Merge(m, src) |
| 460 | } |
| 461 | func (m *Message) XXX_Size() int { |
| 462 | return m.Size() |
| 463 | } |
| 464 | func (m *Message) XXX_DiscardUnknown() { |
| 465 | xxx_messageInfo_Message.DiscardUnknown(m) |
| 466 | } |
| 467 | |
| 468 | var xxx_messageInfo_Message proto.InternalMessageInfo |
| 469 | |
| 470 | type HardState struct { |
| 471 | Term uint64 `protobuf:"varint,1,opt,name=term" json:"term"` |
| 472 | Vote uint64 `protobuf:"varint,2,opt,name=vote" json:"vote"` |
| 473 | Commit uint64 `protobuf:"varint,3,opt,name=commit" json:"commit"` |
| 474 | } |
| 475 | |
| 476 | func (m *HardState) Reset() { *m = HardState{} } |
| 477 | func (m *HardState) String() string { return proto.CompactTextString(m) } |
| 478 | func (*HardState) ProtoMessage() {} |
| 479 | func (*HardState) Descriptor() ([]byte, []int) { |
| 480 | return fileDescriptor_b042552c306ae59b, []int{4} |
| 481 | } |
| 482 | func (m *HardState) XXX_Unmarshal(b []byte) error { |
| 483 | return m.Unmarshal(b) |
| 484 | } |
| 485 | func (m *HardState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 486 | if deterministic { |
| 487 | return xxx_messageInfo_HardState.Marshal(b, m, deterministic) |
| 488 | } else { |
| 489 | b = b[:cap(b)] |
| 490 | n, err := m.MarshalToSizedBuffer(b) |
| 491 | if err != nil { |
| 492 | return nil, err |
| 493 | } |
| 494 | return b[:n], nil |
| 495 | } |
| 496 | } |
| 497 | func (m *HardState) XXX_Merge(src proto.Message) { |
| 498 | xxx_messageInfo_HardState.Merge(m, src) |
| 499 | } |
| 500 | func (m *HardState) XXX_Size() int { |
| 501 | return m.Size() |
| 502 | } |
| 503 | func (m *HardState) XXX_DiscardUnknown() { |
| 504 | xxx_messageInfo_HardState.DiscardUnknown(m) |
| 505 | } |
| 506 | |
| 507 | var xxx_messageInfo_HardState proto.InternalMessageInfo |
| 508 | |
| 509 | type ConfState struct { |
| 510 | // The voters in the incoming config. (If the configuration is not joint, |
| 511 | // then the outgoing config is empty). |
| 512 | Voters []uint64 `protobuf:"varint,1,rep,name=voters" json:"voters,omitempty"` |
| 513 | // The learners in the incoming config. |
| 514 | Learners []uint64 `protobuf:"varint,2,rep,name=learners" json:"learners,omitempty"` |
| 515 | // The voters in the outgoing config. |
| 516 | VotersOutgoing []uint64 `protobuf:"varint,3,rep,name=voters_outgoing,json=votersOutgoing" json:"voters_outgoing,omitempty"` |
| 517 | // The nodes that will become learners when the outgoing config is removed. |
| 518 | // These nodes are necessarily currently in nodes_joint (or they would have |
| 519 | // been added to the incoming config right away). |
| 520 | LearnersNext []uint64 `protobuf:"varint,4,rep,name=learners_next,json=learnersNext" json:"learners_next,omitempty"` |
| 521 | // If set, the config is joint and Raft will automatically transition into |
| 522 | // the final config (i.e. remove the outgoing config) when this is safe. |
| 523 | AutoLeave bool `protobuf:"varint,5,opt,name=auto_leave,json=autoLeave" json:"auto_leave"` |
| 524 | } |
| 525 | |
| 526 | func (m *ConfState) Reset() { *m = ConfState{} } |
| 527 | func (m *ConfState) String() string { return proto.CompactTextString(m) } |
| 528 | func (*ConfState) ProtoMessage() {} |
| 529 | func (*ConfState) Descriptor() ([]byte, []int) { |
| 530 | return fileDescriptor_b042552c306ae59b, []int{5} |
| 531 | } |
| 532 | func (m *ConfState) XXX_Unmarshal(b []byte) error { |
| 533 | return m.Unmarshal(b) |
| 534 | } |
| 535 | func (m *ConfState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 536 | if deterministic { |
| 537 | return xxx_messageInfo_ConfState.Marshal(b, m, deterministic) |
| 538 | } else { |
| 539 | b = b[:cap(b)] |
| 540 | n, err := m.MarshalToSizedBuffer(b) |
| 541 | if err != nil { |
| 542 | return nil, err |
| 543 | } |
| 544 | return b[:n], nil |
| 545 | } |
| 546 | } |
| 547 | func (m *ConfState) XXX_Merge(src proto.Message) { |
| 548 | xxx_messageInfo_ConfState.Merge(m, src) |
| 549 | } |
| 550 | func (m *ConfState) XXX_Size() int { |
| 551 | return m.Size() |
| 552 | } |
| 553 | func (m *ConfState) XXX_DiscardUnknown() { |
| 554 | xxx_messageInfo_ConfState.DiscardUnknown(m) |
| 555 | } |
| 556 | |
| 557 | var xxx_messageInfo_ConfState proto.InternalMessageInfo |
| 558 | |
| 559 | type ConfChange struct { |
| 560 | Type ConfChangeType `protobuf:"varint,2,opt,name=type,enum=raftpb.ConfChangeType" json:"type"` |
| 561 | NodeID uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId" json:"node_id"` |
| 562 | Context []byte `protobuf:"bytes,4,opt,name=context" json:"context,omitempty"` |
| 563 | // NB: this is used only by etcd to thread through a unique identifier. |
| 564 | // Ideally it should really use the Context instead. No counterpart to |
| 565 | // this field exists in ConfChangeV2. |
| 566 | ID uint64 `protobuf:"varint,1,opt,name=id" json:"id"` |
| 567 | } |
| 568 | |
| 569 | func (m *ConfChange) Reset() { *m = ConfChange{} } |
| 570 | func (m *ConfChange) String() string { return proto.CompactTextString(m) } |
| 571 | func (*ConfChange) ProtoMessage() {} |
| 572 | func (*ConfChange) Descriptor() ([]byte, []int) { |
| 573 | return fileDescriptor_b042552c306ae59b, []int{6} |
| 574 | } |
| 575 | func (m *ConfChange) XXX_Unmarshal(b []byte) error { |
| 576 | return m.Unmarshal(b) |
| 577 | } |
| 578 | func (m *ConfChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 579 | if deterministic { |
| 580 | return xxx_messageInfo_ConfChange.Marshal(b, m, deterministic) |
| 581 | } else { |
| 582 | b = b[:cap(b)] |
| 583 | n, err := m.MarshalToSizedBuffer(b) |
| 584 | if err != nil { |
| 585 | return nil, err |
| 586 | } |
| 587 | return b[:n], nil |
| 588 | } |
| 589 | } |
| 590 | func (m *ConfChange) XXX_Merge(src proto.Message) { |
| 591 | xxx_messageInfo_ConfChange.Merge(m, src) |
| 592 | } |
| 593 | func (m *ConfChange) XXX_Size() int { |
| 594 | return m.Size() |
| 595 | } |
| 596 | func (m *ConfChange) XXX_DiscardUnknown() { |
| 597 | xxx_messageInfo_ConfChange.DiscardUnknown(m) |
| 598 | } |
| 599 | |
| 600 | var xxx_messageInfo_ConfChange proto.InternalMessageInfo |
| 601 | |
| 602 | // ConfChangeSingle is an individual configuration change operation. Multiple |
| 603 | // such operations can be carried out atomically via a ConfChangeV2. |
| 604 | type ConfChangeSingle struct { |
| 605 | Type ConfChangeType `protobuf:"varint,1,opt,name=type,enum=raftpb.ConfChangeType" json:"type"` |
| 606 | NodeID uint64 `protobuf:"varint,2,opt,name=node_id,json=nodeId" json:"node_id"` |
| 607 | } |
| 608 | |
| 609 | func (m *ConfChangeSingle) Reset() { *m = ConfChangeSingle{} } |
| 610 | func (m *ConfChangeSingle) String() string { return proto.CompactTextString(m) } |
| 611 | func (*ConfChangeSingle) ProtoMessage() {} |
| 612 | func (*ConfChangeSingle) Descriptor() ([]byte, []int) { |
| 613 | return fileDescriptor_b042552c306ae59b, []int{7} |
| 614 | } |
| 615 | func (m *ConfChangeSingle) XXX_Unmarshal(b []byte) error { |
| 616 | return m.Unmarshal(b) |
| 617 | } |
| 618 | func (m *ConfChangeSingle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 619 | if deterministic { |
| 620 | return xxx_messageInfo_ConfChangeSingle.Marshal(b, m, deterministic) |
| 621 | } else { |
| 622 | b = b[:cap(b)] |
| 623 | n, err := m.MarshalToSizedBuffer(b) |
| 624 | if err != nil { |
| 625 | return nil, err |
| 626 | } |
| 627 | return b[:n], nil |
| 628 | } |
| 629 | } |
| 630 | func (m *ConfChangeSingle) XXX_Merge(src proto.Message) { |
| 631 | xxx_messageInfo_ConfChangeSingle.Merge(m, src) |
| 632 | } |
| 633 | func (m *ConfChangeSingle) XXX_Size() int { |
| 634 | return m.Size() |
| 635 | } |
| 636 | func (m *ConfChangeSingle) XXX_DiscardUnknown() { |
| 637 | xxx_messageInfo_ConfChangeSingle.DiscardUnknown(m) |
| 638 | } |
| 639 | |
| 640 | var xxx_messageInfo_ConfChangeSingle proto.InternalMessageInfo |
| 641 | |
| 642 | // ConfChangeV2 messages initiate configuration changes. They support both the |
| 643 | // simple "one at a time" membership change protocol and full Joint Consensus |
| 644 | // allowing for arbitrary changes in membership. |
| 645 | // |
| 646 | // The supplied context is treated as an opaque payload and can be used to |
| 647 | // attach an action on the state machine to the application of the config change |
| 648 | // proposal. Note that contrary to Joint Consensus as outlined in the Raft |
| 649 | // paper[1], configuration changes become active when they are *applied* to the |
| 650 | // state machine (not when they are appended to the log). |
| 651 | // |
| 652 | // The simple protocol can be used whenever only a single change is made. |
| 653 | // |
| 654 | // Non-simple changes require the use of Joint Consensus, for which two |
| 655 | // configuration changes are run. The first configuration change specifies the |
| 656 | // desired changes and transitions the Raft group into the joint configuration, |
| 657 | // in which quorum requires a majority of both the pre-changes and post-changes |
| 658 | // configuration. Joint Consensus avoids entering fragile intermediate |
| 659 | // configurations that could compromise survivability. For example, without the |
| 660 | // use of Joint Consensus and running across three availability zones with a |
| 661 | // replication factor of three, it is not possible to replace a voter without |
| 662 | // entering an intermediate configuration that does not survive the outage of |
| 663 | // one availability zone. |
| 664 | // |
| 665 | // The provided ConfChangeTransition specifies how (and whether) Joint Consensus |
| 666 | // is used, and assigns the task of leaving the joint configuration either to |
| 667 | // Raft or the application. Leaving the joint configuration is accomplished by |
| 668 | // proposing a ConfChangeV2 with only and optionally the Context field |
| 669 | // populated. |
| 670 | // |
| 671 | // For details on Raft membership changes, see: |
| 672 | // |
| 673 | // [1]: https://github.com/ongardie/dissertation/blob/master/online-trim.pdf |
| 674 | type ConfChangeV2 struct { |
| 675 | Transition ConfChangeTransition `protobuf:"varint,1,opt,name=transition,enum=raftpb.ConfChangeTransition" json:"transition"` |
| 676 | Changes []ConfChangeSingle `protobuf:"bytes,2,rep,name=changes" json:"changes"` |
| 677 | Context []byte `protobuf:"bytes,3,opt,name=context" json:"context,omitempty"` |
| 678 | } |
| 679 | |
| 680 | func (m *ConfChangeV2) Reset() { *m = ConfChangeV2{} } |
| 681 | func (m *ConfChangeV2) String() string { return proto.CompactTextString(m) } |
| 682 | func (*ConfChangeV2) ProtoMessage() {} |
| 683 | func (*ConfChangeV2) Descriptor() ([]byte, []int) { |
| 684 | return fileDescriptor_b042552c306ae59b, []int{8} |
| 685 | } |
| 686 | func (m *ConfChangeV2) XXX_Unmarshal(b []byte) error { |
| 687 | return m.Unmarshal(b) |
| 688 | } |
| 689 | func (m *ConfChangeV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| 690 | if deterministic { |
| 691 | return xxx_messageInfo_ConfChangeV2.Marshal(b, m, deterministic) |
| 692 | } else { |
| 693 | b = b[:cap(b)] |
| 694 | n, err := m.MarshalToSizedBuffer(b) |
| 695 | if err != nil { |
| 696 | return nil, err |
| 697 | } |
| 698 | return b[:n], nil |
| 699 | } |
| 700 | } |
| 701 | func (m *ConfChangeV2) XXX_Merge(src proto.Message) { |
| 702 | xxx_messageInfo_ConfChangeV2.Merge(m, src) |
| 703 | } |
| 704 | func (m *ConfChangeV2) XXX_Size() int { |
| 705 | return m.Size() |
| 706 | } |
| 707 | func (m *ConfChangeV2) XXX_DiscardUnknown() { |
| 708 | xxx_messageInfo_ConfChangeV2.DiscardUnknown(m) |
| 709 | } |
| 710 | |
| 711 | var xxx_messageInfo_ConfChangeV2 proto.InternalMessageInfo |
| 712 | |
| 713 | func init() { |
| 714 | proto.RegisterEnum("raftpb.EntryType", EntryType_name, EntryType_value) |
| 715 | proto.RegisterEnum("raftpb.MessageType", MessageType_name, MessageType_value) |
| 716 | proto.RegisterEnum("raftpb.ConfChangeTransition", ConfChangeTransition_name, ConfChangeTransition_value) |
| 717 | proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) |
| 718 | proto.RegisterType((*Entry)(nil), "raftpb.Entry") |
| 719 | proto.RegisterType((*SnapshotMetadata)(nil), "raftpb.SnapshotMetadata") |
| 720 | proto.RegisterType((*Snapshot)(nil), "raftpb.Snapshot") |
| 721 | proto.RegisterType((*Message)(nil), "raftpb.Message") |
| 722 | proto.RegisterType((*HardState)(nil), "raftpb.HardState") |
| 723 | proto.RegisterType((*ConfState)(nil), "raftpb.ConfState") |
| 724 | proto.RegisterType((*ConfChange)(nil), "raftpb.ConfChange") |
| 725 | proto.RegisterType((*ConfChangeSingle)(nil), "raftpb.ConfChangeSingle") |
| 726 | proto.RegisterType((*ConfChangeV2)(nil), "raftpb.ConfChangeV2") |
| 727 | } |
| 728 | |
| 729 | func init() { proto.RegisterFile("raft.proto", fileDescriptor_b042552c306ae59b) } |
| 730 | |
| 731 | var fileDescriptor_b042552c306ae59b = []byte{ |
| 732 | // 1102 bytes of a gzipped FileDescriptorProto |
| 733 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0x23, 0x45, |
| 734 | 0x14, 0xed, 0x6e, 0x77, 0xfc, 0xb8, 0x76, 0x9c, 0x4a, 0xc5, 0x33, 0xd3, 0x8a, 0x22, 0x8f, 0xf1, |
| 735 | 0x0c, 0x1a, 0x2b, 0x68, 0x02, 0x32, 0x12, 0x42, 0xec, 0xf2, 0x18, 0x94, 0xa0, 0x38, 0x0c, 0x4e, |
| 736 | 0x26, 0x0b, 0x24, 0x14, 0x55, 0xdc, 0x95, 0x4e, 0x83, 0x5d, 0xd5, 0xaa, 0x2e, 0x87, 0x64, 0x83, |
| 737 | 0x10, 0x5f, 0xc0, 0x92, 0x0d, 0x5b, 0x3e, 0x80, 0x8f, 0x40, 0x59, 0x66, 0xc9, 0x6a, 0xc4, 0x24, |
| 738 | 0x7f, 0xc0, 0x17, 0xa0, 0xaa, 0xae, 0x7e, 0xd8, 0x89, 0x66, 0xc1, 0xae, 0xea, 0xdc, 0x53, 0xf7, |
| 739 | 0x9e, 0x7b, 0x6e, 0x57, 0x35, 0x80, 0x20, 0x67, 0x72, 0x23, 0x12, 0x5c, 0x72, 0x5c, 0x56, 0xeb, |
| 740 | 0xe8, 0x74, 0xb5, 0x15, 0xf0, 0x80, 0x6b, 0xe8, 0x63, 0xb5, 0x4a, 0xa2, 0xdd, 0x9f, 0x60, 0xe1, |
| 741 | 0x15, 0x93, 0xe2, 0x0a, 0x7b, 0xe0, 0x1e, 0x51, 0x31, 0xf1, 0x9c, 0x8e, 0xdd, 0x73, 0xb7, 0xdc, |
| 742 | 0xeb, 0xb7, 0x4f, 0xad, 0xa1, 0x46, 0xf0, 0x2a, 0x2c, 0xec, 0x31, 0x9f, 0x5e, 0x7a, 0xa5, 0x42, |
| 743 | 0x28, 0x81, 0xf0, 0x47, 0xe0, 0x1e, 0x5d, 0x45, 0xd4, 0xb3, 0x3b, 0x76, 0xaf, 0xd9, 0x5f, 0xde, |
| 744 | 0x48, 0x6a, 0x6d, 0xe8, 0x94, 0x2a, 0x90, 0x25, 0xba, 0x8a, 0x28, 0xc6, 0xe0, 0xee, 0x10, 0x49, |
| 745 | 0x3c, 0xb7, 0x63, 0xf7, 0x1a, 0x43, 0xbd, 0xee, 0xfe, 0x6c, 0x03, 0x3a, 0x64, 0x24, 0x8a, 0xcf, |
| 746 | 0xb9, 0x1c, 0x50, 0x49, 0x7c, 0x22, 0x09, 0xfe, 0x0c, 0x60, 0xc4, 0xd9, 0xd9, 0x49, 0x2c, 0x89, |
| 747 | 0x4c, 0x72, 0xd7, 0xf3, 0xdc, 0xdb, 0x9c, 0x9d, 0x1d, 0xaa, 0x80, 0xc9, 0x5d, 0x1b, 0xa5, 0x80, |
| 748 | 0x52, 0x1a, 0x6a, 0xa5, 0xc5, 0x26, 0x12, 0x48, 0xf5, 0x27, 0x55, 0x7f, 0xc5, 0x26, 0x34, 0xd2, |
| 749 | 0xfd, 0x16, 0xaa, 0xa9, 0x02, 0x25, 0x51, 0x29, 0xd0, 0x35, 0x1b, 0x43, 0xbd, 0xc6, 0x5f, 0x40, |
| 750 | 0x75, 0x62, 0x94, 0xe9, 0xc4, 0xf5, 0xbe, 0x97, 0x6a, 0x99, 0x57, 0x6e, 0xf2, 0x66, 0xfc, 0xee, |
| 751 | 0xbf, 0x25, 0xa8, 0x0c, 0x68, 0x1c, 0x93, 0x80, 0xe2, 0x97, 0xe0, 0xca, 0xdc, 0xab, 0x95, 0x34, |
| 752 | 0x87, 0x09, 0x17, 0xdd, 0x52, 0x34, 0xdc, 0x02, 0x47, 0xf2, 0x99, 0x4e, 0x1c, 0xc9, 0x55, 0x1b, |
| 753 | 0x67, 0x82, 0xcf, 0xb5, 0xa1, 0x90, 0xac, 0x41, 0x77, 0xbe, 0x41, 0xdc, 0x86, 0xca, 0x98, 0x07, |
| 754 | 0x7a, 0xba, 0x0b, 0x85, 0x60, 0x0a, 0xe6, 0xb6, 0x95, 0xef, 0xdb, 0xf6, 0x12, 0x2a, 0x94, 0x49, |
| 755 | 0x11, 0xd2, 0xd8, 0xab, 0x74, 0x4a, 0xbd, 0x7a, 0x7f, 0x71, 0x66, 0xc6, 0x69, 0x2a, 0xc3, 0xc1, |
| 756 | 0x6b, 0x50, 0x1e, 0xf1, 0xc9, 0x24, 0x94, 0x5e, 0xb5, 0x90, 0xcb, 0x60, 0x4a, 0xe2, 0x05, 0x97, |
| 757 | 0xd4, 0x5b, 0x2c, 0x4a, 0x54, 0x08, 0xee, 0x43, 0x35, 0x36, 0x5e, 0x7a, 0x35, 0xed, 0x31, 0x9a, |
| 758 | 0xf7, 0x58, 0xf3, 0xed, 0x61, 0xc6, 0x53, 0xb5, 0x04, 0xfd, 0x9e, 0x8e, 0xa4, 0x07, 0x1d, 0xbb, |
| 759 | 0x57, 0x4d, 0x6b, 0x25, 0x18, 0x7e, 0x0e, 0x90, 0xac, 0x76, 0x43, 0x26, 0xbd, 0x7a, 0xa1, 0x62, |
| 760 | 0x01, 0x57, 0xd6, 0x8c, 0x38, 0x93, 0xf4, 0x52, 0x7a, 0x0d, 0x35, 0x72, 0x53, 0x24, 0x05, 0xf1, |
| 761 | 0xa7, 0x50, 0x13, 0x34, 0x8e, 0x38, 0x8b, 0x69, 0xec, 0x35, 0xb5, 0x01, 0x4b, 0x73, 0x83, 0x4b, |
| 762 | 0x3f, 0xc3, 0x8c, 0xd7, 0xfd, 0x0e, 0x6a, 0xbb, 0x44, 0xf8, 0xc9, 0x37, 0x99, 0x8e, 0xc5, 0xbe, |
| 763 | 0x37, 0x96, 0xd4, 0x0d, 0xe7, 0x9e, 0x1b, 0xb9, 0x8b, 0xa5, 0xfb, 0x2e, 0x76, 0xff, 0xb4, 0xa1, |
| 764 | 0x96, 0x5d, 0x02, 0xfc, 0x18, 0xca, 0xea, 0x8c, 0x88, 0x3d, 0xbb, 0x53, 0xea, 0xb9, 0x43, 0xb3, |
| 765 | 0xc3, 0xab, 0x50, 0x1d, 0x53, 0x22, 0x98, 0x8a, 0x38, 0x3a, 0x92, 0xed, 0xf1, 0x0b, 0x58, 0x4a, |
| 766 | 0x58, 0x27, 0x7c, 0x2a, 0x03, 0x1e, 0xb2, 0xc0, 0x2b, 0x69, 0x4a, 0x33, 0x81, 0xbf, 0x36, 0x28, |
| 767 | 0x7e, 0x06, 0x8b, 0xe9, 0xa1, 0x13, 0xa6, 0x4c, 0x72, 0x35, 0xad, 0x91, 0x82, 0x07, 0xca, 0xa3, |
| 768 | 0x67, 0x00, 0x64, 0x2a, 0xf9, 0xc9, 0x98, 0x92, 0x0b, 0xaa, 0xbf, 0xb0, 0x74, 0x16, 0x35, 0x85, |
| 769 | 0xef, 0x2b, 0xb8, 0xfb, 0xbb, 0x0d, 0xa0, 0x44, 0x6f, 0x9f, 0x13, 0x16, 0x50, 0xfc, 0x89, 0xb9, |
| 770 | 0x0b, 0x8e, 0xbe, 0x0b, 0x8f, 0x8b, 0x77, 0x3b, 0x61, 0xdc, 0xbb, 0x0e, 0x2f, 0xa0, 0xc2, 0xb8, |
| 771 | 0x4f, 0x4f, 0x42, 0xdf, 0x98, 0xd2, 0x54, 0xc1, 0xdb, 0xb7, 0x4f, 0xcb, 0x07, 0xdc, 0xa7, 0x7b, |
| 772 | 0x3b, 0xc3, 0xb2, 0x0a, 0xef, 0xf9, 0xd8, 0xcb, 0x47, 0x9a, 0x3c, 0x34, 0xd9, 0x30, 0x57, 0xc1, |
| 773 | 0x09, 0x7d, 0x33, 0x08, 0x30, 0xa7, 0x9d, 0xbd, 0x9d, 0xa1, 0x13, 0xfa, 0xdd, 0x09, 0xa0, 0xbc, |
| 774 | 0xf8, 0x61, 0xc8, 0x82, 0x71, 0x2e, 0xd2, 0xfe, 0x3f, 0x22, 0x9d, 0xf7, 0x89, 0xec, 0xfe, 0x61, |
| 775 | 0x43, 0x23, 0xcf, 0x73, 0xdc, 0xc7, 0x5b, 0x00, 0x52, 0x10, 0x16, 0x87, 0x32, 0xe4, 0xcc, 0x54, |
| 776 | 0x5c, 0x7b, 0xa0, 0x62, 0xc6, 0x49, 0x3f, 0xe6, 0xfc, 0x14, 0xfe, 0x1c, 0x2a, 0x23, 0xcd, 0x4a, |
| 777 | 0x26, 0x5e, 0x78, 0xa7, 0xe6, 0x5b, 0x4b, 0xaf, 0xad, 0xa1, 0x17, 0x3d, 0x2b, 0xcd, 0x78, 0xb6, |
| 778 | 0xbe, 0x0b, 0xb5, 0xec, 0x31, 0xc7, 0x4b, 0x50, 0xd7, 0x9b, 0x03, 0x2e, 0x26, 0x64, 0x8c, 0x2c, |
| 779 | 0xbc, 0x02, 0x4b, 0x1a, 0xc8, 0xf3, 0x23, 0x1b, 0x3f, 0x82, 0xe5, 0x39, 0xf0, 0xb8, 0x8f, 0x9c, |
| 780 | 0xf5, 0xbf, 0x4a, 0x50, 0x2f, 0xbc, 0x75, 0x18, 0xa0, 0x3c, 0x88, 0x83, 0xdd, 0x69, 0x84, 0x2c, |
| 781 | 0x5c, 0x87, 0xca, 0x20, 0x0e, 0xb6, 0x28, 0x91, 0xc8, 0x36, 0x9b, 0xd7, 0x82, 0x47, 0xc8, 0x31, |
| 782 | 0xac, 0xcd, 0x28, 0x42, 0x25, 0xdc, 0x04, 0x48, 0xd6, 0x43, 0x1a, 0x47, 0xc8, 0x35, 0xc4, 0x63, |
| 783 | 0x2e, 0x29, 0x5a, 0x50, 0xda, 0xcc, 0x46, 0x47, 0xcb, 0x26, 0xaa, 0x5e, 0x0f, 0x54, 0xc1, 0x08, |
| 784 | 0x1a, 0xaa, 0x18, 0x25, 0x42, 0x9e, 0xaa, 0x2a, 0x55, 0xdc, 0x02, 0x54, 0x44, 0xf4, 0xa1, 0x1a, |
| 785 | 0xc6, 0xd0, 0x1c, 0xc4, 0xc1, 0x1b, 0x26, 0x28, 0x19, 0x9d, 0x93, 0xd3, 0x31, 0x45, 0x80, 0x97, |
| 786 | 0x61, 0xd1, 0x24, 0x52, 0x37, 0x6e, 0x1a, 0xa3, 0xba, 0xa1, 0x6d, 0x9f, 0xd3, 0xd1, 0x0f, 0xdf, |
| 787 | 0x4c, 0xb9, 0x98, 0x4e, 0x50, 0x43, 0xb5, 0x3d, 0x88, 0x03, 0x3d, 0xa0, 0x33, 0x2a, 0xf6, 0x29, |
| 788 | 0xf1, 0xa9, 0x40, 0x8b, 0xe6, 0xf4, 0x51, 0x38, 0xa1, 0x7c, 0x2a, 0x0f, 0xf8, 0x8f, 0xa8, 0x69, |
| 789 | 0xc4, 0x0c, 0x29, 0xf1, 0xf5, 0x4f, 0x14, 0x2d, 0x19, 0x31, 0x19, 0xa2, 0xc5, 0x20, 0xd3, 0xef, |
| 790 | 0x6b, 0x41, 0x75, 0x8b, 0xcb, 0xa6, 0xaa, 0xd9, 0x6b, 0x0e, 0x36, 0x27, 0x0f, 0x25, 0x17, 0x24, |
| 791 | 0xa0, 0x9b, 0x51, 0x44, 0x99, 0x8f, 0x56, 0xb0, 0x07, 0xad, 0x79, 0x54, 0xf3, 0x5b, 0x6a, 0x62, |
| 792 | 0x33, 0x91, 0xf1, 0x15, 0x7a, 0x84, 0x9f, 0xc0, 0xca, 0x1c, 0xa8, 0xd9, 0x8f, 0x0d, 0xfb, 0x4b, |
| 793 | 0x2e, 0x02, 0x2a, 0x4d, 0x47, 0x4f, 0xd6, 0x7f, 0xb1, 0xa1, 0xf5, 0xd0, 0x17, 0x89, 0xd7, 0xc0, |
| 794 | 0x7b, 0x08, 0xdf, 0x9c, 0x4a, 0x8e, 0x2c, 0xfc, 0x21, 0x7c, 0xf0, 0x50, 0xf4, 0x2b, 0x1e, 0x32, |
| 795 | 0xb9, 0x37, 0x89, 0xc6, 0xe1, 0x28, 0x54, 0xd3, 0x7f, 0x1f, 0xed, 0xd5, 0xa5, 0xa1, 0x39, 0xeb, |
| 796 | 0x57, 0xd0, 0x9c, 0xbd, 0x87, 0xca, 0xff, 0x1c, 0xd9, 0xf4, 0x7d, 0x75, 0xe3, 0x90, 0xa5, 0xac, |
| 797 | 0xc8, 0xe1, 0x21, 0x9d, 0xf0, 0x0b, 0xaa, 0x23, 0xf6, 0x6c, 0xe4, 0x4d, 0xe4, 0x13, 0x99, 0x44, |
| 798 | 0x9c, 0xd9, 0x46, 0x36, 0x7d, 0x7f, 0x3f, 0x79, 0xee, 0x74, 0xb4, 0xb4, 0xf5, 0xfc, 0xfa, 0x5d, |
| 799 | 0xdb, 0xba, 0x79, 0xd7, 0xb6, 0xae, 0x6f, 0xdb, 0xf6, 0xcd, 0x6d, 0xdb, 0xfe, 0xe7, 0xb6, 0x6d, |
| 800 | 0xff, 0x7a, 0xd7, 0xb6, 0x7e, 0xbb, 0x6b, 0x5b, 0x37, 0x77, 0x6d, 0xeb, 0xef, 0xbb, 0xb6, 0xf5, |
| 801 | 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x67, 0x2b, 0x47, 0x0c, 0x83, 0x09, 0x00, 0x00, |
| 802 | } |
| 803 | |
| 804 | func (m *Entry) Marshal() (dAtA []byte, err error) { |
| 805 | size := m.Size() |
| 806 | dAtA = make([]byte, size) |
| 807 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 808 | if err != nil { |
| 809 | return nil, err |
| 810 | } |
| 811 | return dAtA[:n], nil |
| 812 | } |
| 813 | |
| 814 | func (m *Entry) MarshalTo(dAtA []byte) (int, error) { |
| 815 | size := m.Size() |
| 816 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 817 | } |
| 818 | |
| 819 | func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 820 | i := len(dAtA) |
| 821 | _ = i |
| 822 | var l int |
| 823 | _ = l |
| 824 | if m.Data != nil { |
| 825 | i -= len(m.Data) |
| 826 | copy(dAtA[i:], m.Data) |
| 827 | i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) |
| 828 | i-- |
| 829 | dAtA[i] = 0x22 |
| 830 | } |
| 831 | i = encodeVarintRaft(dAtA, i, uint64(m.Index)) |
| 832 | i-- |
| 833 | dAtA[i] = 0x18 |
| 834 | i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| 835 | i-- |
| 836 | dAtA[i] = 0x10 |
| 837 | i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| 838 | i-- |
| 839 | dAtA[i] = 0x8 |
| 840 | return len(dAtA) - i, nil |
| 841 | } |
| 842 | |
| 843 | func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error) { |
| 844 | size := m.Size() |
| 845 | dAtA = make([]byte, size) |
| 846 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 847 | if err != nil { |
| 848 | return nil, err |
| 849 | } |
| 850 | return dAtA[:n], nil |
| 851 | } |
| 852 | |
| 853 | func (m *SnapshotMetadata) MarshalTo(dAtA []byte) (int, error) { |
| 854 | size := m.Size() |
| 855 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 856 | } |
| 857 | |
| 858 | func (m *SnapshotMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 859 | i := len(dAtA) |
| 860 | _ = i |
| 861 | var l int |
| 862 | _ = l |
| 863 | i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| 864 | i-- |
| 865 | dAtA[i] = 0x18 |
| 866 | i = encodeVarintRaft(dAtA, i, uint64(m.Index)) |
| 867 | i-- |
| 868 | dAtA[i] = 0x10 |
| 869 | { |
| 870 | size, err := m.ConfState.MarshalToSizedBuffer(dAtA[:i]) |
| 871 | if err != nil { |
| 872 | return 0, err |
| 873 | } |
| 874 | i -= size |
| 875 | i = encodeVarintRaft(dAtA, i, uint64(size)) |
| 876 | } |
| 877 | i-- |
| 878 | dAtA[i] = 0xa |
| 879 | return len(dAtA) - i, nil |
| 880 | } |
| 881 | |
| 882 | func (m *Snapshot) Marshal() (dAtA []byte, err error) { |
| 883 | size := m.Size() |
| 884 | dAtA = make([]byte, size) |
| 885 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 886 | if err != nil { |
| 887 | return nil, err |
| 888 | } |
| 889 | return dAtA[:n], nil |
| 890 | } |
| 891 | |
| 892 | func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { |
| 893 | size := m.Size() |
| 894 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 895 | } |
| 896 | |
| 897 | func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 898 | i := len(dAtA) |
| 899 | _ = i |
| 900 | var l int |
| 901 | _ = l |
| 902 | { |
| 903 | size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) |
| 904 | if err != nil { |
| 905 | return 0, err |
| 906 | } |
| 907 | i -= size |
| 908 | i = encodeVarintRaft(dAtA, i, uint64(size)) |
| 909 | } |
| 910 | i-- |
| 911 | dAtA[i] = 0x12 |
| 912 | if m.Data != nil { |
| 913 | i -= len(m.Data) |
| 914 | copy(dAtA[i:], m.Data) |
| 915 | i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) |
| 916 | i-- |
| 917 | dAtA[i] = 0xa |
| 918 | } |
| 919 | return len(dAtA) - i, nil |
| 920 | } |
| 921 | |
| 922 | func (m *Message) Marshal() (dAtA []byte, err error) { |
| 923 | size := m.Size() |
| 924 | dAtA = make([]byte, size) |
| 925 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 926 | if err != nil { |
| 927 | return nil, err |
| 928 | } |
| 929 | return dAtA[:n], nil |
| 930 | } |
| 931 | |
| 932 | func (m *Message) MarshalTo(dAtA []byte) (int, error) { |
| 933 | size := m.Size() |
| 934 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 935 | } |
| 936 | |
| 937 | func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 938 | i := len(dAtA) |
| 939 | _ = i |
| 940 | var l int |
| 941 | _ = l |
| 942 | if len(m.Responses) > 0 { |
| 943 | for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { |
| 944 | { |
| 945 | size, err := m.Responses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) |
| 946 | if err != nil { |
| 947 | return 0, err |
| 948 | } |
| 949 | i -= size |
| 950 | i = encodeVarintRaft(dAtA, i, uint64(size)) |
| 951 | } |
| 952 | i-- |
| 953 | dAtA[i] = 0x72 |
| 954 | } |
| 955 | } |
| 956 | i = encodeVarintRaft(dAtA, i, uint64(m.Vote)) |
| 957 | i-- |
| 958 | dAtA[i] = 0x68 |
| 959 | if m.Context != nil { |
| 960 | i -= len(m.Context) |
| 961 | copy(dAtA[i:], m.Context) |
| 962 | i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) |
| 963 | i-- |
| 964 | dAtA[i] = 0x62 |
| 965 | } |
| 966 | i = encodeVarintRaft(dAtA, i, uint64(m.RejectHint)) |
| 967 | i-- |
| 968 | dAtA[i] = 0x58 |
| 969 | i-- |
| 970 | if m.Reject { |
| 971 | dAtA[i] = 1 |
| 972 | } else { |
| 973 | dAtA[i] = 0 |
| 974 | } |
| 975 | i-- |
| 976 | dAtA[i] = 0x50 |
| 977 | if m.Snapshot != nil { |
| 978 | { |
| 979 | size, err := m.Snapshot.MarshalToSizedBuffer(dAtA[:i]) |
| 980 | if err != nil { |
| 981 | return 0, err |
| 982 | } |
| 983 | i -= size |
| 984 | i = encodeVarintRaft(dAtA, i, uint64(size)) |
| 985 | } |
| 986 | i-- |
| 987 | dAtA[i] = 0x4a |
| 988 | } |
| 989 | i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) |
| 990 | i-- |
| 991 | dAtA[i] = 0x40 |
| 992 | if len(m.Entries) > 0 { |
| 993 | for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { |
| 994 | { |
| 995 | size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) |
| 996 | if err != nil { |
| 997 | return 0, err |
| 998 | } |
| 999 | i -= size |
| 1000 | i = encodeVarintRaft(dAtA, i, uint64(size)) |
| 1001 | } |
| 1002 | i-- |
| 1003 | dAtA[i] = 0x3a |
| 1004 | } |
| 1005 | } |
| 1006 | i = encodeVarintRaft(dAtA, i, uint64(m.Index)) |
| 1007 | i-- |
| 1008 | dAtA[i] = 0x30 |
| 1009 | i = encodeVarintRaft(dAtA, i, uint64(m.LogTerm)) |
| 1010 | i-- |
| 1011 | dAtA[i] = 0x28 |
| 1012 | i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| 1013 | i-- |
| 1014 | dAtA[i] = 0x20 |
| 1015 | i = encodeVarintRaft(dAtA, i, uint64(m.From)) |
| 1016 | i-- |
| 1017 | dAtA[i] = 0x18 |
| 1018 | i = encodeVarintRaft(dAtA, i, uint64(m.To)) |
| 1019 | i-- |
| 1020 | dAtA[i] = 0x10 |
| 1021 | i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| 1022 | i-- |
| 1023 | dAtA[i] = 0x8 |
| 1024 | return len(dAtA) - i, nil |
| 1025 | } |
| 1026 | |
| 1027 | func (m *HardState) Marshal() (dAtA []byte, err error) { |
| 1028 | size := m.Size() |
| 1029 | dAtA = make([]byte, size) |
| 1030 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 1031 | if err != nil { |
| 1032 | return nil, err |
| 1033 | } |
| 1034 | return dAtA[:n], nil |
| 1035 | } |
| 1036 | |
| 1037 | func (m *HardState) MarshalTo(dAtA []byte) (int, error) { |
| 1038 | size := m.Size() |
| 1039 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 1040 | } |
| 1041 | |
| 1042 | func (m *HardState) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 1043 | i := len(dAtA) |
| 1044 | _ = i |
| 1045 | var l int |
| 1046 | _ = l |
| 1047 | i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) |
| 1048 | i-- |
| 1049 | dAtA[i] = 0x18 |
| 1050 | i = encodeVarintRaft(dAtA, i, uint64(m.Vote)) |
| 1051 | i-- |
| 1052 | dAtA[i] = 0x10 |
| 1053 | i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| 1054 | i-- |
| 1055 | dAtA[i] = 0x8 |
| 1056 | return len(dAtA) - i, nil |
| 1057 | } |
| 1058 | |
| 1059 | func (m *ConfState) Marshal() (dAtA []byte, err error) { |
| 1060 | size := m.Size() |
| 1061 | dAtA = make([]byte, size) |
| 1062 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 1063 | if err != nil { |
| 1064 | return nil, err |
| 1065 | } |
| 1066 | return dAtA[:n], nil |
| 1067 | } |
| 1068 | |
| 1069 | func (m *ConfState) MarshalTo(dAtA []byte) (int, error) { |
| 1070 | size := m.Size() |
| 1071 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 1072 | } |
| 1073 | |
| 1074 | func (m *ConfState) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 1075 | i := len(dAtA) |
| 1076 | _ = i |
| 1077 | var l int |
| 1078 | _ = l |
| 1079 | i-- |
| 1080 | if m.AutoLeave { |
| 1081 | dAtA[i] = 1 |
| 1082 | } else { |
| 1083 | dAtA[i] = 0 |
| 1084 | } |
| 1085 | i-- |
| 1086 | dAtA[i] = 0x28 |
| 1087 | if len(m.LearnersNext) > 0 { |
| 1088 | for iNdEx := len(m.LearnersNext) - 1; iNdEx >= 0; iNdEx-- { |
| 1089 | i = encodeVarintRaft(dAtA, i, uint64(m.LearnersNext[iNdEx])) |
| 1090 | i-- |
| 1091 | dAtA[i] = 0x20 |
| 1092 | } |
| 1093 | } |
| 1094 | if len(m.VotersOutgoing) > 0 { |
| 1095 | for iNdEx := len(m.VotersOutgoing) - 1; iNdEx >= 0; iNdEx-- { |
| 1096 | i = encodeVarintRaft(dAtA, i, uint64(m.VotersOutgoing[iNdEx])) |
| 1097 | i-- |
| 1098 | dAtA[i] = 0x18 |
| 1099 | } |
| 1100 | } |
| 1101 | if len(m.Learners) > 0 { |
| 1102 | for iNdEx := len(m.Learners) - 1; iNdEx >= 0; iNdEx-- { |
| 1103 | i = encodeVarintRaft(dAtA, i, uint64(m.Learners[iNdEx])) |
| 1104 | i-- |
| 1105 | dAtA[i] = 0x10 |
| 1106 | } |
| 1107 | } |
| 1108 | if len(m.Voters) > 0 { |
| 1109 | for iNdEx := len(m.Voters) - 1; iNdEx >= 0; iNdEx-- { |
| 1110 | i = encodeVarintRaft(dAtA, i, uint64(m.Voters[iNdEx])) |
| 1111 | i-- |
| 1112 | dAtA[i] = 0x8 |
| 1113 | } |
| 1114 | } |
| 1115 | return len(dAtA) - i, nil |
| 1116 | } |
| 1117 | |
| 1118 | func (m *ConfChange) Marshal() (dAtA []byte, err error) { |
| 1119 | size := m.Size() |
| 1120 | dAtA = make([]byte, size) |
| 1121 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 1122 | if err != nil { |
| 1123 | return nil, err |
| 1124 | } |
| 1125 | return dAtA[:n], nil |
| 1126 | } |
| 1127 | |
| 1128 | func (m *ConfChange) MarshalTo(dAtA []byte) (int, error) { |
| 1129 | size := m.Size() |
| 1130 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 1131 | } |
| 1132 | |
| 1133 | func (m *ConfChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 1134 | i := len(dAtA) |
| 1135 | _ = i |
| 1136 | var l int |
| 1137 | _ = l |
| 1138 | if m.Context != nil { |
| 1139 | i -= len(m.Context) |
| 1140 | copy(dAtA[i:], m.Context) |
| 1141 | i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) |
| 1142 | i-- |
| 1143 | dAtA[i] = 0x22 |
| 1144 | } |
| 1145 | i = encodeVarintRaft(dAtA, i, uint64(m.NodeID)) |
| 1146 | i-- |
| 1147 | dAtA[i] = 0x18 |
| 1148 | i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| 1149 | i-- |
| 1150 | dAtA[i] = 0x10 |
| 1151 | i = encodeVarintRaft(dAtA, i, uint64(m.ID)) |
| 1152 | i-- |
| 1153 | dAtA[i] = 0x8 |
| 1154 | return len(dAtA) - i, nil |
| 1155 | } |
| 1156 | |
| 1157 | func (m *ConfChangeSingle) Marshal() (dAtA []byte, err error) { |
| 1158 | size := m.Size() |
| 1159 | dAtA = make([]byte, size) |
| 1160 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 1161 | if err != nil { |
| 1162 | return nil, err |
| 1163 | } |
| 1164 | return dAtA[:n], nil |
| 1165 | } |
| 1166 | |
| 1167 | func (m *ConfChangeSingle) MarshalTo(dAtA []byte) (int, error) { |
| 1168 | size := m.Size() |
| 1169 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 1170 | } |
| 1171 | |
| 1172 | func (m *ConfChangeSingle) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 1173 | i := len(dAtA) |
| 1174 | _ = i |
| 1175 | var l int |
| 1176 | _ = l |
| 1177 | i = encodeVarintRaft(dAtA, i, uint64(m.NodeID)) |
| 1178 | i-- |
| 1179 | dAtA[i] = 0x10 |
| 1180 | i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| 1181 | i-- |
| 1182 | dAtA[i] = 0x8 |
| 1183 | return len(dAtA) - i, nil |
| 1184 | } |
| 1185 | |
| 1186 | func (m *ConfChangeV2) Marshal() (dAtA []byte, err error) { |
| 1187 | size := m.Size() |
| 1188 | dAtA = make([]byte, size) |
| 1189 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| 1190 | if err != nil { |
| 1191 | return nil, err |
| 1192 | } |
| 1193 | return dAtA[:n], nil |
| 1194 | } |
| 1195 | |
| 1196 | func (m *ConfChangeV2) MarshalTo(dAtA []byte) (int, error) { |
| 1197 | size := m.Size() |
| 1198 | return m.MarshalToSizedBuffer(dAtA[:size]) |
| 1199 | } |
| 1200 | |
| 1201 | func (m *ConfChangeV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| 1202 | i := len(dAtA) |
| 1203 | _ = i |
| 1204 | var l int |
| 1205 | _ = l |
| 1206 | if m.Context != nil { |
| 1207 | i -= len(m.Context) |
| 1208 | copy(dAtA[i:], m.Context) |
| 1209 | i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) |
| 1210 | i-- |
| 1211 | dAtA[i] = 0x1a |
| 1212 | } |
| 1213 | if len(m.Changes) > 0 { |
| 1214 | for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { |
| 1215 | { |
| 1216 | size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) |
| 1217 | if err != nil { |
| 1218 | return 0, err |
| 1219 | } |
| 1220 | i -= size |
| 1221 | i = encodeVarintRaft(dAtA, i, uint64(size)) |
| 1222 | } |
| 1223 | i-- |
| 1224 | dAtA[i] = 0x12 |
| 1225 | } |
| 1226 | } |
| 1227 | i = encodeVarintRaft(dAtA, i, uint64(m.Transition)) |
| 1228 | i-- |
| 1229 | dAtA[i] = 0x8 |
| 1230 | return len(dAtA) - i, nil |
| 1231 | } |
| 1232 | |
| 1233 | func encodeVarintRaft(dAtA []byte, offset int, v uint64) int { |
| 1234 | offset -= sovRaft(v) |
| 1235 | base := offset |
| 1236 | for v >= 1<<7 { |
| 1237 | dAtA[offset] = uint8(v&0x7f | 0x80) |
| 1238 | v >>= 7 |
| 1239 | offset++ |
| 1240 | } |
| 1241 | dAtA[offset] = uint8(v) |
| 1242 | return base |
| 1243 | } |
| 1244 | func (m *Entry) Size() (n int) { |
| 1245 | if m == nil { |
| 1246 | return 0 |
| 1247 | } |
| 1248 | var l int |
| 1249 | _ = l |
| 1250 | n += 1 + sovRaft(uint64(m.Type)) |
| 1251 | n += 1 + sovRaft(uint64(m.Term)) |
| 1252 | n += 1 + sovRaft(uint64(m.Index)) |
| 1253 | if m.Data != nil { |
| 1254 | l = len(m.Data) |
| 1255 | n += 1 + l + sovRaft(uint64(l)) |
| 1256 | } |
| 1257 | return n |
| 1258 | } |
| 1259 | |
| 1260 | func (m *SnapshotMetadata) Size() (n int) { |
| 1261 | if m == nil { |
| 1262 | return 0 |
| 1263 | } |
| 1264 | var l int |
| 1265 | _ = l |
| 1266 | l = m.ConfState.Size() |
| 1267 | n += 1 + l + sovRaft(uint64(l)) |
| 1268 | n += 1 + sovRaft(uint64(m.Index)) |
| 1269 | n += 1 + sovRaft(uint64(m.Term)) |
| 1270 | return n |
| 1271 | } |
| 1272 | |
| 1273 | func (m *Snapshot) Size() (n int) { |
| 1274 | if m == nil { |
| 1275 | return 0 |
| 1276 | } |
| 1277 | var l int |
| 1278 | _ = l |
| 1279 | if m.Data != nil { |
| 1280 | l = len(m.Data) |
| 1281 | n += 1 + l + sovRaft(uint64(l)) |
| 1282 | } |
| 1283 | l = m.Metadata.Size() |
| 1284 | n += 1 + l + sovRaft(uint64(l)) |
| 1285 | return n |
| 1286 | } |
| 1287 | |
| 1288 | func (m *Message) Size() (n int) { |
| 1289 | if m == nil { |
| 1290 | return 0 |
| 1291 | } |
| 1292 | var l int |
| 1293 | _ = l |
| 1294 | n += 1 + sovRaft(uint64(m.Type)) |
| 1295 | n += 1 + sovRaft(uint64(m.To)) |
| 1296 | n += 1 + sovRaft(uint64(m.From)) |
| 1297 | n += 1 + sovRaft(uint64(m.Term)) |
| 1298 | n += 1 + sovRaft(uint64(m.LogTerm)) |
| 1299 | n += 1 + sovRaft(uint64(m.Index)) |
| 1300 | if len(m.Entries) > 0 { |
| 1301 | for _, e := range m.Entries { |
| 1302 | l = e.Size() |
| 1303 | n += 1 + l + sovRaft(uint64(l)) |
| 1304 | } |
| 1305 | } |
| 1306 | n += 1 + sovRaft(uint64(m.Commit)) |
| 1307 | if m.Snapshot != nil { |
| 1308 | l = m.Snapshot.Size() |
| 1309 | n += 1 + l + sovRaft(uint64(l)) |
| 1310 | } |
| 1311 | n += 2 |
| 1312 | n += 1 + sovRaft(uint64(m.RejectHint)) |
| 1313 | if m.Context != nil { |
| 1314 | l = len(m.Context) |
| 1315 | n += 1 + l + sovRaft(uint64(l)) |
| 1316 | } |
| 1317 | n += 1 + sovRaft(uint64(m.Vote)) |
| 1318 | if len(m.Responses) > 0 { |
| 1319 | for _, e := range m.Responses { |
| 1320 | l = e.Size() |
| 1321 | n += 1 + l + sovRaft(uint64(l)) |
| 1322 | } |
| 1323 | } |
| 1324 | return n |
| 1325 | } |
| 1326 | |
| 1327 | func (m *HardState) Size() (n int) { |
| 1328 | if m == nil { |
| 1329 | return 0 |
| 1330 | } |
| 1331 | var l int |
| 1332 | _ = l |
| 1333 | n += 1 + sovRaft(uint64(m.Term)) |
| 1334 | n += 1 + sovRaft(uint64(m.Vote)) |
| 1335 | n += 1 + sovRaft(uint64(m.Commit)) |
| 1336 | return n |
| 1337 | } |
| 1338 | |
| 1339 | func (m *ConfState) Size() (n int) { |
| 1340 | if m == nil { |
| 1341 | return 0 |
| 1342 | } |
| 1343 | var l int |
| 1344 | _ = l |
| 1345 | if len(m.Voters) > 0 { |
| 1346 | for _, e := range m.Voters { |
| 1347 | n += 1 + sovRaft(uint64(e)) |
| 1348 | } |
| 1349 | } |
| 1350 | if len(m.Learners) > 0 { |
| 1351 | for _, e := range m.Learners { |
| 1352 | n += 1 + sovRaft(uint64(e)) |
| 1353 | } |
| 1354 | } |
| 1355 | if len(m.VotersOutgoing) > 0 { |
| 1356 | for _, e := range m.VotersOutgoing { |
| 1357 | n += 1 + sovRaft(uint64(e)) |
| 1358 | } |
| 1359 | } |
| 1360 | if len(m.LearnersNext) > 0 { |
| 1361 | for _, e := range m.LearnersNext { |
| 1362 | n += 1 + sovRaft(uint64(e)) |
| 1363 | } |
| 1364 | } |
| 1365 | n += 2 |
| 1366 | return n |
| 1367 | } |
| 1368 | |
| 1369 | func (m *ConfChange) Size() (n int) { |
| 1370 | if m == nil { |
| 1371 | return 0 |
| 1372 | } |
| 1373 | var l int |
| 1374 | _ = l |
| 1375 | n += 1 + sovRaft(uint64(m.ID)) |
| 1376 | n += 1 + sovRaft(uint64(m.Type)) |
| 1377 | n += 1 + sovRaft(uint64(m.NodeID)) |
| 1378 | if m.Context != nil { |
| 1379 | l = len(m.Context) |
| 1380 | n += 1 + l + sovRaft(uint64(l)) |
| 1381 | } |
| 1382 | return n |
| 1383 | } |
| 1384 | |
| 1385 | func (m *ConfChangeSingle) Size() (n int) { |
| 1386 | if m == nil { |
| 1387 | return 0 |
| 1388 | } |
| 1389 | var l int |
| 1390 | _ = l |
| 1391 | n += 1 + sovRaft(uint64(m.Type)) |
| 1392 | n += 1 + sovRaft(uint64(m.NodeID)) |
| 1393 | return n |
| 1394 | } |
| 1395 | |
| 1396 | func (m *ConfChangeV2) Size() (n int) { |
| 1397 | if m == nil { |
| 1398 | return 0 |
| 1399 | } |
| 1400 | var l int |
| 1401 | _ = l |
| 1402 | n += 1 + sovRaft(uint64(m.Transition)) |
| 1403 | if len(m.Changes) > 0 { |
| 1404 | for _, e := range m.Changes { |
| 1405 | l = e.Size() |
| 1406 | n += 1 + l + sovRaft(uint64(l)) |
| 1407 | } |
| 1408 | } |
| 1409 | if m.Context != nil { |
| 1410 | l = len(m.Context) |
| 1411 | n += 1 + l + sovRaft(uint64(l)) |
| 1412 | } |
| 1413 | return n |
| 1414 | } |
| 1415 | |
| 1416 | func sovRaft(x uint64) (n int) { |
| 1417 | return (math_bits.Len64(x|1) + 6) / 7 |
| 1418 | } |
| 1419 | func sozRaft(x uint64) (n int) { |
| 1420 | return sovRaft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) |
| 1421 | } |
| 1422 | func (m *Entry) Unmarshal(dAtA []byte) error { |
| 1423 | l := len(dAtA) |
| 1424 | iNdEx := 0 |
| 1425 | for iNdEx < l { |
| 1426 | preIndex := iNdEx |
| 1427 | var wire uint64 |
| 1428 | for shift := uint(0); ; shift += 7 { |
| 1429 | if shift >= 64 { |
| 1430 | return ErrIntOverflowRaft |
| 1431 | } |
| 1432 | if iNdEx >= l { |
| 1433 | return io.ErrUnexpectedEOF |
| 1434 | } |
| 1435 | b := dAtA[iNdEx] |
| 1436 | iNdEx++ |
| 1437 | wire |= uint64(b&0x7F) << shift |
| 1438 | if b < 0x80 { |
| 1439 | break |
| 1440 | } |
| 1441 | } |
| 1442 | fieldNum := int32(wire >> 3) |
| 1443 | wireType := int(wire & 0x7) |
| 1444 | if wireType == 4 { |
| 1445 | return fmt.Errorf("proto: Entry: wiretype end group for non-group") |
| 1446 | } |
| 1447 | if fieldNum <= 0 { |
| 1448 | return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) |
| 1449 | } |
| 1450 | switch fieldNum { |
| 1451 | case 1: |
| 1452 | if wireType != 0 { |
| 1453 | return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| 1454 | } |
| 1455 | m.Type = 0 |
| 1456 | for shift := uint(0); ; shift += 7 { |
| 1457 | if shift >= 64 { |
| 1458 | return ErrIntOverflowRaft |
| 1459 | } |
| 1460 | if iNdEx >= l { |
| 1461 | return io.ErrUnexpectedEOF |
| 1462 | } |
| 1463 | b := dAtA[iNdEx] |
| 1464 | iNdEx++ |
| 1465 | m.Type |= EntryType(b&0x7F) << shift |
| 1466 | if b < 0x80 { |
| 1467 | break |
| 1468 | } |
| 1469 | } |
| 1470 | case 2: |
| 1471 | if wireType != 0 { |
| 1472 | return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| 1473 | } |
| 1474 | m.Term = 0 |
| 1475 | for shift := uint(0); ; shift += 7 { |
| 1476 | if shift >= 64 { |
| 1477 | return ErrIntOverflowRaft |
| 1478 | } |
| 1479 | if iNdEx >= l { |
| 1480 | return io.ErrUnexpectedEOF |
| 1481 | } |
| 1482 | b := dAtA[iNdEx] |
| 1483 | iNdEx++ |
| 1484 | m.Term |= uint64(b&0x7F) << shift |
| 1485 | if b < 0x80 { |
| 1486 | break |
| 1487 | } |
| 1488 | } |
| 1489 | case 3: |
| 1490 | if wireType != 0 { |
| 1491 | return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) |
| 1492 | } |
| 1493 | m.Index = 0 |
| 1494 | for shift := uint(0); ; shift += 7 { |
| 1495 | if shift >= 64 { |
| 1496 | return ErrIntOverflowRaft |
| 1497 | } |
| 1498 | if iNdEx >= l { |
| 1499 | return io.ErrUnexpectedEOF |
| 1500 | } |
| 1501 | b := dAtA[iNdEx] |
| 1502 | iNdEx++ |
| 1503 | m.Index |= uint64(b&0x7F) << shift |
| 1504 | if b < 0x80 { |
| 1505 | break |
| 1506 | } |
| 1507 | } |
| 1508 | case 4: |
| 1509 | if wireType != 2 { |
| 1510 | return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) |
| 1511 | } |
| 1512 | var byteLen int |
| 1513 | for shift := uint(0); ; shift += 7 { |
| 1514 | if shift >= 64 { |
| 1515 | return ErrIntOverflowRaft |
| 1516 | } |
| 1517 | if iNdEx >= l { |
| 1518 | return io.ErrUnexpectedEOF |
| 1519 | } |
| 1520 | b := dAtA[iNdEx] |
| 1521 | iNdEx++ |
| 1522 | byteLen |= int(b&0x7F) << shift |
| 1523 | if b < 0x80 { |
| 1524 | break |
| 1525 | } |
| 1526 | } |
| 1527 | if byteLen < 0 { |
| 1528 | return ErrInvalidLengthRaft |
| 1529 | } |
| 1530 | postIndex := iNdEx + byteLen |
| 1531 | if postIndex < 0 { |
| 1532 | return ErrInvalidLengthRaft |
| 1533 | } |
| 1534 | if postIndex > l { |
| 1535 | return io.ErrUnexpectedEOF |
| 1536 | } |
| 1537 | m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) |
| 1538 | if m.Data == nil { |
| 1539 | m.Data = []byte{} |
| 1540 | } |
| 1541 | iNdEx = postIndex |
| 1542 | default: |
| 1543 | iNdEx = preIndex |
| 1544 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 1545 | if err != nil { |
| 1546 | return err |
| 1547 | } |
| 1548 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 1549 | return ErrInvalidLengthRaft |
| 1550 | } |
| 1551 | if (iNdEx + skippy) > l { |
| 1552 | return io.ErrUnexpectedEOF |
| 1553 | } |
| 1554 | iNdEx += skippy |
| 1555 | } |
| 1556 | } |
| 1557 | |
| 1558 | if iNdEx > l { |
| 1559 | return io.ErrUnexpectedEOF |
| 1560 | } |
| 1561 | return nil |
| 1562 | } |
| 1563 | func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { |
| 1564 | l := len(dAtA) |
| 1565 | iNdEx := 0 |
| 1566 | for iNdEx < l { |
| 1567 | preIndex := iNdEx |
| 1568 | var wire uint64 |
| 1569 | for shift := uint(0); ; shift += 7 { |
| 1570 | if shift >= 64 { |
| 1571 | return ErrIntOverflowRaft |
| 1572 | } |
| 1573 | if iNdEx >= l { |
| 1574 | return io.ErrUnexpectedEOF |
| 1575 | } |
| 1576 | b := dAtA[iNdEx] |
| 1577 | iNdEx++ |
| 1578 | wire |= uint64(b&0x7F) << shift |
| 1579 | if b < 0x80 { |
| 1580 | break |
| 1581 | } |
| 1582 | } |
| 1583 | fieldNum := int32(wire >> 3) |
| 1584 | wireType := int(wire & 0x7) |
| 1585 | if wireType == 4 { |
| 1586 | return fmt.Errorf("proto: SnapshotMetadata: wiretype end group for non-group") |
| 1587 | } |
| 1588 | if fieldNum <= 0 { |
| 1589 | return fmt.Errorf("proto: SnapshotMetadata: illegal tag %d (wire type %d)", fieldNum, wire) |
| 1590 | } |
| 1591 | switch fieldNum { |
| 1592 | case 1: |
| 1593 | if wireType != 2 { |
| 1594 | return fmt.Errorf("proto: wrong wireType = %d for field ConfState", wireType) |
| 1595 | } |
| 1596 | var msglen int |
| 1597 | for shift := uint(0); ; shift += 7 { |
| 1598 | if shift >= 64 { |
| 1599 | return ErrIntOverflowRaft |
| 1600 | } |
| 1601 | if iNdEx >= l { |
| 1602 | return io.ErrUnexpectedEOF |
| 1603 | } |
| 1604 | b := dAtA[iNdEx] |
| 1605 | iNdEx++ |
| 1606 | msglen |= int(b&0x7F) << shift |
| 1607 | if b < 0x80 { |
| 1608 | break |
| 1609 | } |
| 1610 | } |
| 1611 | if msglen < 0 { |
| 1612 | return ErrInvalidLengthRaft |
| 1613 | } |
| 1614 | postIndex := iNdEx + msglen |
| 1615 | if postIndex < 0 { |
| 1616 | return ErrInvalidLengthRaft |
| 1617 | } |
| 1618 | if postIndex > l { |
| 1619 | return io.ErrUnexpectedEOF |
| 1620 | } |
| 1621 | if err := m.ConfState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| 1622 | return err |
| 1623 | } |
| 1624 | iNdEx = postIndex |
| 1625 | case 2: |
| 1626 | if wireType != 0 { |
| 1627 | return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) |
| 1628 | } |
| 1629 | m.Index = 0 |
| 1630 | for shift := uint(0); ; shift += 7 { |
| 1631 | if shift >= 64 { |
| 1632 | return ErrIntOverflowRaft |
| 1633 | } |
| 1634 | if iNdEx >= l { |
| 1635 | return io.ErrUnexpectedEOF |
| 1636 | } |
| 1637 | b := dAtA[iNdEx] |
| 1638 | iNdEx++ |
| 1639 | m.Index |= uint64(b&0x7F) << shift |
| 1640 | if b < 0x80 { |
| 1641 | break |
| 1642 | } |
| 1643 | } |
| 1644 | case 3: |
| 1645 | if wireType != 0 { |
| 1646 | return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| 1647 | } |
| 1648 | m.Term = 0 |
| 1649 | for shift := uint(0); ; shift += 7 { |
| 1650 | if shift >= 64 { |
| 1651 | return ErrIntOverflowRaft |
| 1652 | } |
| 1653 | if iNdEx >= l { |
| 1654 | return io.ErrUnexpectedEOF |
| 1655 | } |
| 1656 | b := dAtA[iNdEx] |
| 1657 | iNdEx++ |
| 1658 | m.Term |= uint64(b&0x7F) << shift |
| 1659 | if b < 0x80 { |
| 1660 | break |
| 1661 | } |
| 1662 | } |
| 1663 | default: |
| 1664 | iNdEx = preIndex |
| 1665 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 1666 | if err != nil { |
| 1667 | return err |
| 1668 | } |
| 1669 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 1670 | return ErrInvalidLengthRaft |
| 1671 | } |
| 1672 | if (iNdEx + skippy) > l { |
| 1673 | return io.ErrUnexpectedEOF |
| 1674 | } |
| 1675 | iNdEx += skippy |
| 1676 | } |
| 1677 | } |
| 1678 | |
| 1679 | if iNdEx > l { |
| 1680 | return io.ErrUnexpectedEOF |
| 1681 | } |
| 1682 | return nil |
| 1683 | } |
| 1684 | func (m *Snapshot) Unmarshal(dAtA []byte) error { |
| 1685 | l := len(dAtA) |
| 1686 | iNdEx := 0 |
| 1687 | for iNdEx < l { |
| 1688 | preIndex := iNdEx |
| 1689 | var wire uint64 |
| 1690 | for shift := uint(0); ; shift += 7 { |
| 1691 | if shift >= 64 { |
| 1692 | return ErrIntOverflowRaft |
| 1693 | } |
| 1694 | if iNdEx >= l { |
| 1695 | return io.ErrUnexpectedEOF |
| 1696 | } |
| 1697 | b := dAtA[iNdEx] |
| 1698 | iNdEx++ |
| 1699 | wire |= uint64(b&0x7F) << shift |
| 1700 | if b < 0x80 { |
| 1701 | break |
| 1702 | } |
| 1703 | } |
| 1704 | fieldNum := int32(wire >> 3) |
| 1705 | wireType := int(wire & 0x7) |
| 1706 | if wireType == 4 { |
| 1707 | return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") |
| 1708 | } |
| 1709 | if fieldNum <= 0 { |
| 1710 | return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) |
| 1711 | } |
| 1712 | switch fieldNum { |
| 1713 | case 1: |
| 1714 | if wireType != 2 { |
| 1715 | return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) |
| 1716 | } |
| 1717 | var byteLen int |
| 1718 | for shift := uint(0); ; shift += 7 { |
| 1719 | if shift >= 64 { |
| 1720 | return ErrIntOverflowRaft |
| 1721 | } |
| 1722 | if iNdEx >= l { |
| 1723 | return io.ErrUnexpectedEOF |
| 1724 | } |
| 1725 | b := dAtA[iNdEx] |
| 1726 | iNdEx++ |
| 1727 | byteLen |= int(b&0x7F) << shift |
| 1728 | if b < 0x80 { |
| 1729 | break |
| 1730 | } |
| 1731 | } |
| 1732 | if byteLen < 0 { |
| 1733 | return ErrInvalidLengthRaft |
| 1734 | } |
| 1735 | postIndex := iNdEx + byteLen |
| 1736 | if postIndex < 0 { |
| 1737 | return ErrInvalidLengthRaft |
| 1738 | } |
| 1739 | if postIndex > l { |
| 1740 | return io.ErrUnexpectedEOF |
| 1741 | } |
| 1742 | m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) |
| 1743 | if m.Data == nil { |
| 1744 | m.Data = []byte{} |
| 1745 | } |
| 1746 | iNdEx = postIndex |
| 1747 | case 2: |
| 1748 | if wireType != 2 { |
| 1749 | return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) |
| 1750 | } |
| 1751 | var msglen int |
| 1752 | for shift := uint(0); ; shift += 7 { |
| 1753 | if shift >= 64 { |
| 1754 | return ErrIntOverflowRaft |
| 1755 | } |
| 1756 | if iNdEx >= l { |
| 1757 | return io.ErrUnexpectedEOF |
| 1758 | } |
| 1759 | b := dAtA[iNdEx] |
| 1760 | iNdEx++ |
| 1761 | msglen |= int(b&0x7F) << shift |
| 1762 | if b < 0x80 { |
| 1763 | break |
| 1764 | } |
| 1765 | } |
| 1766 | if msglen < 0 { |
| 1767 | return ErrInvalidLengthRaft |
| 1768 | } |
| 1769 | postIndex := iNdEx + msglen |
| 1770 | if postIndex < 0 { |
| 1771 | return ErrInvalidLengthRaft |
| 1772 | } |
| 1773 | if postIndex > l { |
| 1774 | return io.ErrUnexpectedEOF |
| 1775 | } |
| 1776 | if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| 1777 | return err |
| 1778 | } |
| 1779 | iNdEx = postIndex |
| 1780 | default: |
| 1781 | iNdEx = preIndex |
| 1782 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 1783 | if err != nil { |
| 1784 | return err |
| 1785 | } |
| 1786 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 1787 | return ErrInvalidLengthRaft |
| 1788 | } |
| 1789 | if (iNdEx + skippy) > l { |
| 1790 | return io.ErrUnexpectedEOF |
| 1791 | } |
| 1792 | iNdEx += skippy |
| 1793 | } |
| 1794 | } |
| 1795 | |
| 1796 | if iNdEx > l { |
| 1797 | return io.ErrUnexpectedEOF |
| 1798 | } |
| 1799 | return nil |
| 1800 | } |
| 1801 | func (m *Message) Unmarshal(dAtA []byte) error { |
| 1802 | l := len(dAtA) |
| 1803 | iNdEx := 0 |
| 1804 | for iNdEx < l { |
| 1805 | preIndex := iNdEx |
| 1806 | var wire uint64 |
| 1807 | for shift := uint(0); ; shift += 7 { |
| 1808 | if shift >= 64 { |
| 1809 | return ErrIntOverflowRaft |
| 1810 | } |
| 1811 | if iNdEx >= l { |
| 1812 | return io.ErrUnexpectedEOF |
| 1813 | } |
| 1814 | b := dAtA[iNdEx] |
| 1815 | iNdEx++ |
| 1816 | wire |= uint64(b&0x7F) << shift |
| 1817 | if b < 0x80 { |
| 1818 | break |
| 1819 | } |
| 1820 | } |
| 1821 | fieldNum := int32(wire >> 3) |
| 1822 | wireType := int(wire & 0x7) |
| 1823 | if wireType == 4 { |
| 1824 | return fmt.Errorf("proto: Message: wiretype end group for non-group") |
| 1825 | } |
| 1826 | if fieldNum <= 0 { |
| 1827 | return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) |
| 1828 | } |
| 1829 | switch fieldNum { |
| 1830 | case 1: |
| 1831 | if wireType != 0 { |
| 1832 | return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| 1833 | } |
| 1834 | m.Type = 0 |
| 1835 | for shift := uint(0); ; shift += 7 { |
| 1836 | if shift >= 64 { |
| 1837 | return ErrIntOverflowRaft |
| 1838 | } |
| 1839 | if iNdEx >= l { |
| 1840 | return io.ErrUnexpectedEOF |
| 1841 | } |
| 1842 | b := dAtA[iNdEx] |
| 1843 | iNdEx++ |
| 1844 | m.Type |= MessageType(b&0x7F) << shift |
| 1845 | if b < 0x80 { |
| 1846 | break |
| 1847 | } |
| 1848 | } |
| 1849 | case 2: |
| 1850 | if wireType != 0 { |
| 1851 | return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) |
| 1852 | } |
| 1853 | m.To = 0 |
| 1854 | for shift := uint(0); ; shift += 7 { |
| 1855 | if shift >= 64 { |
| 1856 | return ErrIntOverflowRaft |
| 1857 | } |
| 1858 | if iNdEx >= l { |
| 1859 | return io.ErrUnexpectedEOF |
| 1860 | } |
| 1861 | b := dAtA[iNdEx] |
| 1862 | iNdEx++ |
| 1863 | m.To |= uint64(b&0x7F) << shift |
| 1864 | if b < 0x80 { |
| 1865 | break |
| 1866 | } |
| 1867 | } |
| 1868 | case 3: |
| 1869 | if wireType != 0 { |
| 1870 | return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) |
| 1871 | } |
| 1872 | m.From = 0 |
| 1873 | for shift := uint(0); ; shift += 7 { |
| 1874 | if shift >= 64 { |
| 1875 | return ErrIntOverflowRaft |
| 1876 | } |
| 1877 | if iNdEx >= l { |
| 1878 | return io.ErrUnexpectedEOF |
| 1879 | } |
| 1880 | b := dAtA[iNdEx] |
| 1881 | iNdEx++ |
| 1882 | m.From |= uint64(b&0x7F) << shift |
| 1883 | if b < 0x80 { |
| 1884 | break |
| 1885 | } |
| 1886 | } |
| 1887 | case 4: |
| 1888 | if wireType != 0 { |
| 1889 | return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| 1890 | } |
| 1891 | m.Term = 0 |
| 1892 | for shift := uint(0); ; shift += 7 { |
| 1893 | if shift >= 64 { |
| 1894 | return ErrIntOverflowRaft |
| 1895 | } |
| 1896 | if iNdEx >= l { |
| 1897 | return io.ErrUnexpectedEOF |
| 1898 | } |
| 1899 | b := dAtA[iNdEx] |
| 1900 | iNdEx++ |
| 1901 | m.Term |= uint64(b&0x7F) << shift |
| 1902 | if b < 0x80 { |
| 1903 | break |
| 1904 | } |
| 1905 | } |
| 1906 | case 5: |
| 1907 | if wireType != 0 { |
| 1908 | return fmt.Errorf("proto: wrong wireType = %d for field LogTerm", wireType) |
| 1909 | } |
| 1910 | m.LogTerm = 0 |
| 1911 | for shift := uint(0); ; shift += 7 { |
| 1912 | if shift >= 64 { |
| 1913 | return ErrIntOverflowRaft |
| 1914 | } |
| 1915 | if iNdEx >= l { |
| 1916 | return io.ErrUnexpectedEOF |
| 1917 | } |
| 1918 | b := dAtA[iNdEx] |
| 1919 | iNdEx++ |
| 1920 | m.LogTerm |= uint64(b&0x7F) << shift |
| 1921 | if b < 0x80 { |
| 1922 | break |
| 1923 | } |
| 1924 | } |
| 1925 | case 6: |
| 1926 | if wireType != 0 { |
| 1927 | return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) |
| 1928 | } |
| 1929 | m.Index = 0 |
| 1930 | for shift := uint(0); ; shift += 7 { |
| 1931 | if shift >= 64 { |
| 1932 | return ErrIntOverflowRaft |
| 1933 | } |
| 1934 | if iNdEx >= l { |
| 1935 | return io.ErrUnexpectedEOF |
| 1936 | } |
| 1937 | b := dAtA[iNdEx] |
| 1938 | iNdEx++ |
| 1939 | m.Index |= uint64(b&0x7F) << shift |
| 1940 | if b < 0x80 { |
| 1941 | break |
| 1942 | } |
| 1943 | } |
| 1944 | case 7: |
| 1945 | if wireType != 2 { |
| 1946 | return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) |
| 1947 | } |
| 1948 | var msglen int |
| 1949 | for shift := uint(0); ; shift += 7 { |
| 1950 | if shift >= 64 { |
| 1951 | return ErrIntOverflowRaft |
| 1952 | } |
| 1953 | if iNdEx >= l { |
| 1954 | return io.ErrUnexpectedEOF |
| 1955 | } |
| 1956 | b := dAtA[iNdEx] |
| 1957 | iNdEx++ |
| 1958 | msglen |= int(b&0x7F) << shift |
| 1959 | if b < 0x80 { |
| 1960 | break |
| 1961 | } |
| 1962 | } |
| 1963 | if msglen < 0 { |
| 1964 | return ErrInvalidLengthRaft |
| 1965 | } |
| 1966 | postIndex := iNdEx + msglen |
| 1967 | if postIndex < 0 { |
| 1968 | return ErrInvalidLengthRaft |
| 1969 | } |
| 1970 | if postIndex > l { |
| 1971 | return io.ErrUnexpectedEOF |
| 1972 | } |
| 1973 | m.Entries = append(m.Entries, Entry{}) |
| 1974 | if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| 1975 | return err |
| 1976 | } |
| 1977 | iNdEx = postIndex |
| 1978 | case 8: |
| 1979 | if wireType != 0 { |
| 1980 | return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) |
| 1981 | } |
| 1982 | m.Commit = 0 |
| 1983 | for shift := uint(0); ; shift += 7 { |
| 1984 | if shift >= 64 { |
| 1985 | return ErrIntOverflowRaft |
| 1986 | } |
| 1987 | if iNdEx >= l { |
| 1988 | return io.ErrUnexpectedEOF |
| 1989 | } |
| 1990 | b := dAtA[iNdEx] |
| 1991 | iNdEx++ |
| 1992 | m.Commit |= uint64(b&0x7F) << shift |
| 1993 | if b < 0x80 { |
| 1994 | break |
| 1995 | } |
| 1996 | } |
| 1997 | case 9: |
| 1998 | if wireType != 2 { |
| 1999 | return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) |
| 2000 | } |
| 2001 | var msglen int |
| 2002 | for shift := uint(0); ; shift += 7 { |
| 2003 | if shift >= 64 { |
| 2004 | return ErrIntOverflowRaft |
| 2005 | } |
| 2006 | if iNdEx >= l { |
| 2007 | return io.ErrUnexpectedEOF |
| 2008 | } |
| 2009 | b := dAtA[iNdEx] |
| 2010 | iNdEx++ |
| 2011 | msglen |= int(b&0x7F) << shift |
| 2012 | if b < 0x80 { |
| 2013 | break |
| 2014 | } |
| 2015 | } |
| 2016 | if msglen < 0 { |
| 2017 | return ErrInvalidLengthRaft |
| 2018 | } |
| 2019 | postIndex := iNdEx + msglen |
| 2020 | if postIndex < 0 { |
| 2021 | return ErrInvalidLengthRaft |
| 2022 | } |
| 2023 | if postIndex > l { |
| 2024 | return io.ErrUnexpectedEOF |
| 2025 | } |
| 2026 | if m.Snapshot == nil { |
| 2027 | m.Snapshot = &Snapshot{} |
| 2028 | } |
| 2029 | if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| 2030 | return err |
| 2031 | } |
| 2032 | iNdEx = postIndex |
| 2033 | case 10: |
| 2034 | if wireType != 0 { |
| 2035 | return fmt.Errorf("proto: wrong wireType = %d for field Reject", wireType) |
| 2036 | } |
| 2037 | var v int |
| 2038 | for shift := uint(0); ; shift += 7 { |
| 2039 | if shift >= 64 { |
| 2040 | return ErrIntOverflowRaft |
| 2041 | } |
| 2042 | if iNdEx >= l { |
| 2043 | return io.ErrUnexpectedEOF |
| 2044 | } |
| 2045 | b := dAtA[iNdEx] |
| 2046 | iNdEx++ |
| 2047 | v |= int(b&0x7F) << shift |
| 2048 | if b < 0x80 { |
| 2049 | break |
| 2050 | } |
| 2051 | } |
| 2052 | m.Reject = bool(v != 0) |
| 2053 | case 11: |
| 2054 | if wireType != 0 { |
| 2055 | return fmt.Errorf("proto: wrong wireType = %d for field RejectHint", wireType) |
| 2056 | } |
| 2057 | m.RejectHint = 0 |
| 2058 | for shift := uint(0); ; shift += 7 { |
| 2059 | if shift >= 64 { |
| 2060 | return ErrIntOverflowRaft |
| 2061 | } |
| 2062 | if iNdEx >= l { |
| 2063 | return io.ErrUnexpectedEOF |
| 2064 | } |
| 2065 | b := dAtA[iNdEx] |
| 2066 | iNdEx++ |
| 2067 | m.RejectHint |= uint64(b&0x7F) << shift |
| 2068 | if b < 0x80 { |
| 2069 | break |
| 2070 | } |
| 2071 | } |
| 2072 | case 12: |
| 2073 | if wireType != 2 { |
| 2074 | return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) |
| 2075 | } |
| 2076 | var byteLen int |
| 2077 | for shift := uint(0); ; shift += 7 { |
| 2078 | if shift >= 64 { |
| 2079 | return ErrIntOverflowRaft |
| 2080 | } |
| 2081 | if iNdEx >= l { |
| 2082 | return io.ErrUnexpectedEOF |
| 2083 | } |
| 2084 | b := dAtA[iNdEx] |
| 2085 | iNdEx++ |
| 2086 | byteLen |= int(b&0x7F) << shift |
| 2087 | if b < 0x80 { |
| 2088 | break |
| 2089 | } |
| 2090 | } |
| 2091 | if byteLen < 0 { |
| 2092 | return ErrInvalidLengthRaft |
| 2093 | } |
| 2094 | postIndex := iNdEx + byteLen |
| 2095 | if postIndex < 0 { |
| 2096 | return ErrInvalidLengthRaft |
| 2097 | } |
| 2098 | if postIndex > l { |
| 2099 | return io.ErrUnexpectedEOF |
| 2100 | } |
| 2101 | m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) |
| 2102 | if m.Context == nil { |
| 2103 | m.Context = []byte{} |
| 2104 | } |
| 2105 | iNdEx = postIndex |
| 2106 | case 13: |
| 2107 | if wireType != 0 { |
| 2108 | return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) |
| 2109 | } |
| 2110 | m.Vote = 0 |
| 2111 | for shift := uint(0); ; shift += 7 { |
| 2112 | if shift >= 64 { |
| 2113 | return ErrIntOverflowRaft |
| 2114 | } |
| 2115 | if iNdEx >= l { |
| 2116 | return io.ErrUnexpectedEOF |
| 2117 | } |
| 2118 | b := dAtA[iNdEx] |
| 2119 | iNdEx++ |
| 2120 | m.Vote |= uint64(b&0x7F) << shift |
| 2121 | if b < 0x80 { |
| 2122 | break |
| 2123 | } |
| 2124 | } |
| 2125 | case 14: |
| 2126 | if wireType != 2 { |
| 2127 | return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType) |
| 2128 | } |
| 2129 | var msglen int |
| 2130 | for shift := uint(0); ; shift += 7 { |
| 2131 | if shift >= 64 { |
| 2132 | return ErrIntOverflowRaft |
| 2133 | } |
| 2134 | if iNdEx >= l { |
| 2135 | return io.ErrUnexpectedEOF |
| 2136 | } |
| 2137 | b := dAtA[iNdEx] |
| 2138 | iNdEx++ |
| 2139 | msglen |= int(b&0x7F) << shift |
| 2140 | if b < 0x80 { |
| 2141 | break |
| 2142 | } |
| 2143 | } |
| 2144 | if msglen < 0 { |
| 2145 | return ErrInvalidLengthRaft |
| 2146 | } |
| 2147 | postIndex := iNdEx + msglen |
| 2148 | if postIndex < 0 { |
| 2149 | return ErrInvalidLengthRaft |
| 2150 | } |
| 2151 | if postIndex > l { |
| 2152 | return io.ErrUnexpectedEOF |
| 2153 | } |
| 2154 | m.Responses = append(m.Responses, Message{}) |
| 2155 | if err := m.Responses[len(m.Responses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| 2156 | return err |
| 2157 | } |
| 2158 | iNdEx = postIndex |
| 2159 | default: |
| 2160 | iNdEx = preIndex |
| 2161 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 2162 | if err != nil { |
| 2163 | return err |
| 2164 | } |
| 2165 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 2166 | return ErrInvalidLengthRaft |
| 2167 | } |
| 2168 | if (iNdEx + skippy) > l { |
| 2169 | return io.ErrUnexpectedEOF |
| 2170 | } |
| 2171 | iNdEx += skippy |
| 2172 | } |
| 2173 | } |
| 2174 | |
| 2175 | if iNdEx > l { |
| 2176 | return io.ErrUnexpectedEOF |
| 2177 | } |
| 2178 | return nil |
| 2179 | } |
| 2180 | func (m *HardState) Unmarshal(dAtA []byte) error { |
| 2181 | l := len(dAtA) |
| 2182 | iNdEx := 0 |
| 2183 | for iNdEx < l { |
| 2184 | preIndex := iNdEx |
| 2185 | var wire uint64 |
| 2186 | for shift := uint(0); ; shift += 7 { |
| 2187 | if shift >= 64 { |
| 2188 | return ErrIntOverflowRaft |
| 2189 | } |
| 2190 | if iNdEx >= l { |
| 2191 | return io.ErrUnexpectedEOF |
| 2192 | } |
| 2193 | b := dAtA[iNdEx] |
| 2194 | iNdEx++ |
| 2195 | wire |= uint64(b&0x7F) << shift |
| 2196 | if b < 0x80 { |
| 2197 | break |
| 2198 | } |
| 2199 | } |
| 2200 | fieldNum := int32(wire >> 3) |
| 2201 | wireType := int(wire & 0x7) |
| 2202 | if wireType == 4 { |
| 2203 | return fmt.Errorf("proto: HardState: wiretype end group for non-group") |
| 2204 | } |
| 2205 | if fieldNum <= 0 { |
| 2206 | return fmt.Errorf("proto: HardState: illegal tag %d (wire type %d)", fieldNum, wire) |
| 2207 | } |
| 2208 | switch fieldNum { |
| 2209 | case 1: |
| 2210 | if wireType != 0 { |
| 2211 | return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| 2212 | } |
| 2213 | m.Term = 0 |
| 2214 | for shift := uint(0); ; shift += 7 { |
| 2215 | if shift >= 64 { |
| 2216 | return ErrIntOverflowRaft |
| 2217 | } |
| 2218 | if iNdEx >= l { |
| 2219 | return io.ErrUnexpectedEOF |
| 2220 | } |
| 2221 | b := dAtA[iNdEx] |
| 2222 | iNdEx++ |
| 2223 | m.Term |= uint64(b&0x7F) << shift |
| 2224 | if b < 0x80 { |
| 2225 | break |
| 2226 | } |
| 2227 | } |
| 2228 | case 2: |
| 2229 | if wireType != 0 { |
| 2230 | return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) |
| 2231 | } |
| 2232 | m.Vote = 0 |
| 2233 | for shift := uint(0); ; shift += 7 { |
| 2234 | if shift >= 64 { |
| 2235 | return ErrIntOverflowRaft |
| 2236 | } |
| 2237 | if iNdEx >= l { |
| 2238 | return io.ErrUnexpectedEOF |
| 2239 | } |
| 2240 | b := dAtA[iNdEx] |
| 2241 | iNdEx++ |
| 2242 | m.Vote |= uint64(b&0x7F) << shift |
| 2243 | if b < 0x80 { |
| 2244 | break |
| 2245 | } |
| 2246 | } |
| 2247 | case 3: |
| 2248 | if wireType != 0 { |
| 2249 | return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) |
| 2250 | } |
| 2251 | m.Commit = 0 |
| 2252 | for shift := uint(0); ; shift += 7 { |
| 2253 | if shift >= 64 { |
| 2254 | return ErrIntOverflowRaft |
| 2255 | } |
| 2256 | if iNdEx >= l { |
| 2257 | return io.ErrUnexpectedEOF |
| 2258 | } |
| 2259 | b := dAtA[iNdEx] |
| 2260 | iNdEx++ |
| 2261 | m.Commit |= uint64(b&0x7F) << shift |
| 2262 | if b < 0x80 { |
| 2263 | break |
| 2264 | } |
| 2265 | } |
| 2266 | default: |
| 2267 | iNdEx = preIndex |
| 2268 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 2269 | if err != nil { |
| 2270 | return err |
| 2271 | } |
| 2272 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 2273 | return ErrInvalidLengthRaft |
| 2274 | } |
| 2275 | if (iNdEx + skippy) > l { |
| 2276 | return io.ErrUnexpectedEOF |
| 2277 | } |
| 2278 | iNdEx += skippy |
| 2279 | } |
| 2280 | } |
| 2281 | |
| 2282 | if iNdEx > l { |
| 2283 | return io.ErrUnexpectedEOF |
| 2284 | } |
| 2285 | return nil |
| 2286 | } |
| 2287 | func (m *ConfState) Unmarshal(dAtA []byte) error { |
| 2288 | l := len(dAtA) |
| 2289 | iNdEx := 0 |
| 2290 | for iNdEx < l { |
| 2291 | preIndex := iNdEx |
| 2292 | var wire uint64 |
| 2293 | for shift := uint(0); ; shift += 7 { |
| 2294 | if shift >= 64 { |
| 2295 | return ErrIntOverflowRaft |
| 2296 | } |
| 2297 | if iNdEx >= l { |
| 2298 | return io.ErrUnexpectedEOF |
| 2299 | } |
| 2300 | b := dAtA[iNdEx] |
| 2301 | iNdEx++ |
| 2302 | wire |= uint64(b&0x7F) << shift |
| 2303 | if b < 0x80 { |
| 2304 | break |
| 2305 | } |
| 2306 | } |
| 2307 | fieldNum := int32(wire >> 3) |
| 2308 | wireType := int(wire & 0x7) |
| 2309 | if wireType == 4 { |
| 2310 | return fmt.Errorf("proto: ConfState: wiretype end group for non-group") |
| 2311 | } |
| 2312 | if fieldNum <= 0 { |
| 2313 | return fmt.Errorf("proto: ConfState: illegal tag %d (wire type %d)", fieldNum, wire) |
| 2314 | } |
| 2315 | switch fieldNum { |
| 2316 | case 1: |
| 2317 | if wireType == 0 { |
| 2318 | var v uint64 |
| 2319 | for shift := uint(0); ; shift += 7 { |
| 2320 | if shift >= 64 { |
| 2321 | return ErrIntOverflowRaft |
| 2322 | } |
| 2323 | if iNdEx >= l { |
| 2324 | return io.ErrUnexpectedEOF |
| 2325 | } |
| 2326 | b := dAtA[iNdEx] |
| 2327 | iNdEx++ |
| 2328 | v |= uint64(b&0x7F) << shift |
| 2329 | if b < 0x80 { |
| 2330 | break |
| 2331 | } |
| 2332 | } |
| 2333 | m.Voters = append(m.Voters, v) |
| 2334 | } else if wireType == 2 { |
| 2335 | var packedLen int |
| 2336 | for shift := uint(0); ; shift += 7 { |
| 2337 | if shift >= 64 { |
| 2338 | return ErrIntOverflowRaft |
| 2339 | } |
| 2340 | if iNdEx >= l { |
| 2341 | return io.ErrUnexpectedEOF |
| 2342 | } |
| 2343 | b := dAtA[iNdEx] |
| 2344 | iNdEx++ |
| 2345 | packedLen |= int(b&0x7F) << shift |
| 2346 | if b < 0x80 { |
| 2347 | break |
| 2348 | } |
| 2349 | } |
| 2350 | if packedLen < 0 { |
| 2351 | return ErrInvalidLengthRaft |
| 2352 | } |
| 2353 | postIndex := iNdEx + packedLen |
| 2354 | if postIndex < 0 { |
| 2355 | return ErrInvalidLengthRaft |
| 2356 | } |
| 2357 | if postIndex > l { |
| 2358 | return io.ErrUnexpectedEOF |
| 2359 | } |
| 2360 | var elementCount int |
| 2361 | var count int |
| 2362 | for _, integer := range dAtA[iNdEx:postIndex] { |
| 2363 | if integer < 128 { |
| 2364 | count++ |
| 2365 | } |
| 2366 | } |
| 2367 | elementCount = count |
| 2368 | if elementCount != 0 && len(m.Voters) == 0 { |
| 2369 | m.Voters = make([]uint64, 0, elementCount) |
| 2370 | } |
| 2371 | for iNdEx < postIndex { |
| 2372 | var v uint64 |
| 2373 | for shift := uint(0); ; shift += 7 { |
| 2374 | if shift >= 64 { |
| 2375 | return ErrIntOverflowRaft |
| 2376 | } |
| 2377 | if iNdEx >= l { |
| 2378 | return io.ErrUnexpectedEOF |
| 2379 | } |
| 2380 | b := dAtA[iNdEx] |
| 2381 | iNdEx++ |
| 2382 | v |= uint64(b&0x7F) << shift |
| 2383 | if b < 0x80 { |
| 2384 | break |
| 2385 | } |
| 2386 | } |
| 2387 | m.Voters = append(m.Voters, v) |
| 2388 | } |
| 2389 | } else { |
| 2390 | return fmt.Errorf("proto: wrong wireType = %d for field Voters", wireType) |
| 2391 | } |
| 2392 | case 2: |
| 2393 | if wireType == 0 { |
| 2394 | var v uint64 |
| 2395 | for shift := uint(0); ; shift += 7 { |
| 2396 | if shift >= 64 { |
| 2397 | return ErrIntOverflowRaft |
| 2398 | } |
| 2399 | if iNdEx >= l { |
| 2400 | return io.ErrUnexpectedEOF |
| 2401 | } |
| 2402 | b := dAtA[iNdEx] |
| 2403 | iNdEx++ |
| 2404 | v |= uint64(b&0x7F) << shift |
| 2405 | if b < 0x80 { |
| 2406 | break |
| 2407 | } |
| 2408 | } |
| 2409 | m.Learners = append(m.Learners, v) |
| 2410 | } else if wireType == 2 { |
| 2411 | var packedLen int |
| 2412 | for shift := uint(0); ; shift += 7 { |
| 2413 | if shift >= 64 { |
| 2414 | return ErrIntOverflowRaft |
| 2415 | } |
| 2416 | if iNdEx >= l { |
| 2417 | return io.ErrUnexpectedEOF |
| 2418 | } |
| 2419 | b := dAtA[iNdEx] |
| 2420 | iNdEx++ |
| 2421 | packedLen |= int(b&0x7F) << shift |
| 2422 | if b < 0x80 { |
| 2423 | break |
| 2424 | } |
| 2425 | } |
| 2426 | if packedLen < 0 { |
| 2427 | return ErrInvalidLengthRaft |
| 2428 | } |
| 2429 | postIndex := iNdEx + packedLen |
| 2430 | if postIndex < 0 { |
| 2431 | return ErrInvalidLengthRaft |
| 2432 | } |
| 2433 | if postIndex > l { |
| 2434 | return io.ErrUnexpectedEOF |
| 2435 | } |
| 2436 | var elementCount int |
| 2437 | var count int |
| 2438 | for _, integer := range dAtA[iNdEx:postIndex] { |
| 2439 | if integer < 128 { |
| 2440 | count++ |
| 2441 | } |
| 2442 | } |
| 2443 | elementCount = count |
| 2444 | if elementCount != 0 && len(m.Learners) == 0 { |
| 2445 | m.Learners = make([]uint64, 0, elementCount) |
| 2446 | } |
| 2447 | for iNdEx < postIndex { |
| 2448 | var v uint64 |
| 2449 | for shift := uint(0); ; shift += 7 { |
| 2450 | if shift >= 64 { |
| 2451 | return ErrIntOverflowRaft |
| 2452 | } |
| 2453 | if iNdEx >= l { |
| 2454 | return io.ErrUnexpectedEOF |
| 2455 | } |
| 2456 | b := dAtA[iNdEx] |
| 2457 | iNdEx++ |
| 2458 | v |= uint64(b&0x7F) << shift |
| 2459 | if b < 0x80 { |
| 2460 | break |
| 2461 | } |
| 2462 | } |
| 2463 | m.Learners = append(m.Learners, v) |
| 2464 | } |
| 2465 | } else { |
| 2466 | return fmt.Errorf("proto: wrong wireType = %d for field Learners", wireType) |
| 2467 | } |
| 2468 | case 3: |
| 2469 | if wireType == 0 { |
| 2470 | var v uint64 |
| 2471 | for shift := uint(0); ; shift += 7 { |
| 2472 | if shift >= 64 { |
| 2473 | return ErrIntOverflowRaft |
| 2474 | } |
| 2475 | if iNdEx >= l { |
| 2476 | return io.ErrUnexpectedEOF |
| 2477 | } |
| 2478 | b := dAtA[iNdEx] |
| 2479 | iNdEx++ |
| 2480 | v |= uint64(b&0x7F) << shift |
| 2481 | if b < 0x80 { |
| 2482 | break |
| 2483 | } |
| 2484 | } |
| 2485 | m.VotersOutgoing = append(m.VotersOutgoing, v) |
| 2486 | } else if wireType == 2 { |
| 2487 | var packedLen int |
| 2488 | for shift := uint(0); ; shift += 7 { |
| 2489 | if shift >= 64 { |
| 2490 | return ErrIntOverflowRaft |
| 2491 | } |
| 2492 | if iNdEx >= l { |
| 2493 | return io.ErrUnexpectedEOF |
| 2494 | } |
| 2495 | b := dAtA[iNdEx] |
| 2496 | iNdEx++ |
| 2497 | packedLen |= int(b&0x7F) << shift |
| 2498 | if b < 0x80 { |
| 2499 | break |
| 2500 | } |
| 2501 | } |
| 2502 | if packedLen < 0 { |
| 2503 | return ErrInvalidLengthRaft |
| 2504 | } |
| 2505 | postIndex := iNdEx + packedLen |
| 2506 | if postIndex < 0 { |
| 2507 | return ErrInvalidLengthRaft |
| 2508 | } |
| 2509 | if postIndex > l { |
| 2510 | return io.ErrUnexpectedEOF |
| 2511 | } |
| 2512 | var elementCount int |
| 2513 | var count int |
| 2514 | for _, integer := range dAtA[iNdEx:postIndex] { |
| 2515 | if integer < 128 { |
| 2516 | count++ |
| 2517 | } |
| 2518 | } |
| 2519 | elementCount = count |
| 2520 | if elementCount != 0 && len(m.VotersOutgoing) == 0 { |
| 2521 | m.VotersOutgoing = make([]uint64, 0, elementCount) |
| 2522 | } |
| 2523 | for iNdEx < postIndex { |
| 2524 | var v uint64 |
| 2525 | for shift := uint(0); ; shift += 7 { |
| 2526 | if shift >= 64 { |
| 2527 | return ErrIntOverflowRaft |
| 2528 | } |
| 2529 | if iNdEx >= l { |
| 2530 | return io.ErrUnexpectedEOF |
| 2531 | } |
| 2532 | b := dAtA[iNdEx] |
| 2533 | iNdEx++ |
| 2534 | v |= uint64(b&0x7F) << shift |
| 2535 | if b < 0x80 { |
| 2536 | break |
| 2537 | } |
| 2538 | } |
| 2539 | m.VotersOutgoing = append(m.VotersOutgoing, v) |
| 2540 | } |
| 2541 | } else { |
| 2542 | return fmt.Errorf("proto: wrong wireType = %d for field VotersOutgoing", wireType) |
| 2543 | } |
| 2544 | case 4: |
| 2545 | if wireType == 0 { |
| 2546 | var v uint64 |
| 2547 | for shift := uint(0); ; shift += 7 { |
| 2548 | if shift >= 64 { |
| 2549 | return ErrIntOverflowRaft |
| 2550 | } |
| 2551 | if iNdEx >= l { |
| 2552 | return io.ErrUnexpectedEOF |
| 2553 | } |
| 2554 | b := dAtA[iNdEx] |
| 2555 | iNdEx++ |
| 2556 | v |= uint64(b&0x7F) << shift |
| 2557 | if b < 0x80 { |
| 2558 | break |
| 2559 | } |
| 2560 | } |
| 2561 | m.LearnersNext = append(m.LearnersNext, v) |
| 2562 | } else if wireType == 2 { |
| 2563 | var packedLen int |
| 2564 | for shift := uint(0); ; shift += 7 { |
| 2565 | if shift >= 64 { |
| 2566 | return ErrIntOverflowRaft |
| 2567 | } |
| 2568 | if iNdEx >= l { |
| 2569 | return io.ErrUnexpectedEOF |
| 2570 | } |
| 2571 | b := dAtA[iNdEx] |
| 2572 | iNdEx++ |
| 2573 | packedLen |= int(b&0x7F) << shift |
| 2574 | if b < 0x80 { |
| 2575 | break |
| 2576 | } |
| 2577 | } |
| 2578 | if packedLen < 0 { |
| 2579 | return ErrInvalidLengthRaft |
| 2580 | } |
| 2581 | postIndex := iNdEx + packedLen |
| 2582 | if postIndex < 0 { |
| 2583 | return ErrInvalidLengthRaft |
| 2584 | } |
| 2585 | if postIndex > l { |
| 2586 | return io.ErrUnexpectedEOF |
| 2587 | } |
| 2588 | var elementCount int |
| 2589 | var count int |
| 2590 | for _, integer := range dAtA[iNdEx:postIndex] { |
| 2591 | if integer < 128 { |
| 2592 | count++ |
| 2593 | } |
| 2594 | } |
| 2595 | elementCount = count |
| 2596 | if elementCount != 0 && len(m.LearnersNext) == 0 { |
| 2597 | m.LearnersNext = make([]uint64, 0, elementCount) |
| 2598 | } |
| 2599 | for iNdEx < postIndex { |
| 2600 | var v uint64 |
| 2601 | for shift := uint(0); ; shift += 7 { |
| 2602 | if shift >= 64 { |
| 2603 | return ErrIntOverflowRaft |
| 2604 | } |
| 2605 | if iNdEx >= l { |
| 2606 | return io.ErrUnexpectedEOF |
| 2607 | } |
| 2608 | b := dAtA[iNdEx] |
| 2609 | iNdEx++ |
| 2610 | v |= uint64(b&0x7F) << shift |
| 2611 | if b < 0x80 { |
| 2612 | break |
| 2613 | } |
| 2614 | } |
| 2615 | m.LearnersNext = append(m.LearnersNext, v) |
| 2616 | } |
| 2617 | } else { |
| 2618 | return fmt.Errorf("proto: wrong wireType = %d for field LearnersNext", wireType) |
| 2619 | } |
| 2620 | case 5: |
| 2621 | if wireType != 0 { |
| 2622 | return fmt.Errorf("proto: wrong wireType = %d for field AutoLeave", wireType) |
| 2623 | } |
| 2624 | var v int |
| 2625 | for shift := uint(0); ; shift += 7 { |
| 2626 | if shift >= 64 { |
| 2627 | return ErrIntOverflowRaft |
| 2628 | } |
| 2629 | if iNdEx >= l { |
| 2630 | return io.ErrUnexpectedEOF |
| 2631 | } |
| 2632 | b := dAtA[iNdEx] |
| 2633 | iNdEx++ |
| 2634 | v |= int(b&0x7F) << shift |
| 2635 | if b < 0x80 { |
| 2636 | break |
| 2637 | } |
| 2638 | } |
| 2639 | m.AutoLeave = bool(v != 0) |
| 2640 | default: |
| 2641 | iNdEx = preIndex |
| 2642 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 2643 | if err != nil { |
| 2644 | return err |
| 2645 | } |
| 2646 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 2647 | return ErrInvalidLengthRaft |
| 2648 | } |
| 2649 | if (iNdEx + skippy) > l { |
| 2650 | return io.ErrUnexpectedEOF |
| 2651 | } |
| 2652 | iNdEx += skippy |
| 2653 | } |
| 2654 | } |
| 2655 | |
| 2656 | if iNdEx > l { |
| 2657 | return io.ErrUnexpectedEOF |
| 2658 | } |
| 2659 | return nil |
| 2660 | } |
| 2661 | func (m *ConfChange) Unmarshal(dAtA []byte) error { |
| 2662 | l := len(dAtA) |
| 2663 | iNdEx := 0 |
| 2664 | for iNdEx < l { |
| 2665 | preIndex := iNdEx |
| 2666 | var wire uint64 |
| 2667 | for shift := uint(0); ; shift += 7 { |
| 2668 | if shift >= 64 { |
| 2669 | return ErrIntOverflowRaft |
| 2670 | } |
| 2671 | if iNdEx >= l { |
| 2672 | return io.ErrUnexpectedEOF |
| 2673 | } |
| 2674 | b := dAtA[iNdEx] |
| 2675 | iNdEx++ |
| 2676 | wire |= uint64(b&0x7F) << shift |
| 2677 | if b < 0x80 { |
| 2678 | break |
| 2679 | } |
| 2680 | } |
| 2681 | fieldNum := int32(wire >> 3) |
| 2682 | wireType := int(wire & 0x7) |
| 2683 | if wireType == 4 { |
| 2684 | return fmt.Errorf("proto: ConfChange: wiretype end group for non-group") |
| 2685 | } |
| 2686 | if fieldNum <= 0 { |
| 2687 | return fmt.Errorf("proto: ConfChange: illegal tag %d (wire type %d)", fieldNum, wire) |
| 2688 | } |
| 2689 | switch fieldNum { |
| 2690 | case 1: |
| 2691 | if wireType != 0 { |
| 2692 | return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) |
| 2693 | } |
| 2694 | m.ID = 0 |
| 2695 | for shift := uint(0); ; shift += 7 { |
| 2696 | if shift >= 64 { |
| 2697 | return ErrIntOverflowRaft |
| 2698 | } |
| 2699 | if iNdEx >= l { |
| 2700 | return io.ErrUnexpectedEOF |
| 2701 | } |
| 2702 | b := dAtA[iNdEx] |
| 2703 | iNdEx++ |
| 2704 | m.ID |= uint64(b&0x7F) << shift |
| 2705 | if b < 0x80 { |
| 2706 | break |
| 2707 | } |
| 2708 | } |
| 2709 | case 2: |
| 2710 | if wireType != 0 { |
| 2711 | return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| 2712 | } |
| 2713 | m.Type = 0 |
| 2714 | for shift := uint(0); ; shift += 7 { |
| 2715 | if shift >= 64 { |
| 2716 | return ErrIntOverflowRaft |
| 2717 | } |
| 2718 | if iNdEx >= l { |
| 2719 | return io.ErrUnexpectedEOF |
| 2720 | } |
| 2721 | b := dAtA[iNdEx] |
| 2722 | iNdEx++ |
| 2723 | m.Type |= ConfChangeType(b&0x7F) << shift |
| 2724 | if b < 0x80 { |
| 2725 | break |
| 2726 | } |
| 2727 | } |
| 2728 | case 3: |
| 2729 | if wireType != 0 { |
| 2730 | return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) |
| 2731 | } |
| 2732 | m.NodeID = 0 |
| 2733 | for shift := uint(0); ; shift += 7 { |
| 2734 | if shift >= 64 { |
| 2735 | return ErrIntOverflowRaft |
| 2736 | } |
| 2737 | if iNdEx >= l { |
| 2738 | return io.ErrUnexpectedEOF |
| 2739 | } |
| 2740 | b := dAtA[iNdEx] |
| 2741 | iNdEx++ |
| 2742 | m.NodeID |= uint64(b&0x7F) << shift |
| 2743 | if b < 0x80 { |
| 2744 | break |
| 2745 | } |
| 2746 | } |
| 2747 | case 4: |
| 2748 | if wireType != 2 { |
| 2749 | return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) |
| 2750 | } |
| 2751 | var byteLen int |
| 2752 | for shift := uint(0); ; shift += 7 { |
| 2753 | if shift >= 64 { |
| 2754 | return ErrIntOverflowRaft |
| 2755 | } |
| 2756 | if iNdEx >= l { |
| 2757 | return io.ErrUnexpectedEOF |
| 2758 | } |
| 2759 | b := dAtA[iNdEx] |
| 2760 | iNdEx++ |
| 2761 | byteLen |= int(b&0x7F) << shift |
| 2762 | if b < 0x80 { |
| 2763 | break |
| 2764 | } |
| 2765 | } |
| 2766 | if byteLen < 0 { |
| 2767 | return ErrInvalidLengthRaft |
| 2768 | } |
| 2769 | postIndex := iNdEx + byteLen |
| 2770 | if postIndex < 0 { |
| 2771 | return ErrInvalidLengthRaft |
| 2772 | } |
| 2773 | if postIndex > l { |
| 2774 | return io.ErrUnexpectedEOF |
| 2775 | } |
| 2776 | m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) |
| 2777 | if m.Context == nil { |
| 2778 | m.Context = []byte{} |
| 2779 | } |
| 2780 | iNdEx = postIndex |
| 2781 | default: |
| 2782 | iNdEx = preIndex |
| 2783 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 2784 | if err != nil { |
| 2785 | return err |
| 2786 | } |
| 2787 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 2788 | return ErrInvalidLengthRaft |
| 2789 | } |
| 2790 | if (iNdEx + skippy) > l { |
| 2791 | return io.ErrUnexpectedEOF |
| 2792 | } |
| 2793 | iNdEx += skippy |
| 2794 | } |
| 2795 | } |
| 2796 | |
| 2797 | if iNdEx > l { |
| 2798 | return io.ErrUnexpectedEOF |
| 2799 | } |
| 2800 | return nil |
| 2801 | } |
| 2802 | func (m *ConfChangeSingle) Unmarshal(dAtA []byte) error { |
| 2803 | l := len(dAtA) |
| 2804 | iNdEx := 0 |
| 2805 | for iNdEx < l { |
| 2806 | preIndex := iNdEx |
| 2807 | var wire uint64 |
| 2808 | for shift := uint(0); ; shift += 7 { |
| 2809 | if shift >= 64 { |
| 2810 | return ErrIntOverflowRaft |
| 2811 | } |
| 2812 | if iNdEx >= l { |
| 2813 | return io.ErrUnexpectedEOF |
| 2814 | } |
| 2815 | b := dAtA[iNdEx] |
| 2816 | iNdEx++ |
| 2817 | wire |= uint64(b&0x7F) << shift |
| 2818 | if b < 0x80 { |
| 2819 | break |
| 2820 | } |
| 2821 | } |
| 2822 | fieldNum := int32(wire >> 3) |
| 2823 | wireType := int(wire & 0x7) |
| 2824 | if wireType == 4 { |
| 2825 | return fmt.Errorf("proto: ConfChangeSingle: wiretype end group for non-group") |
| 2826 | } |
| 2827 | if fieldNum <= 0 { |
| 2828 | return fmt.Errorf("proto: ConfChangeSingle: illegal tag %d (wire type %d)", fieldNum, wire) |
| 2829 | } |
| 2830 | switch fieldNum { |
| 2831 | case 1: |
| 2832 | if wireType != 0 { |
| 2833 | return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| 2834 | } |
| 2835 | m.Type = 0 |
| 2836 | for shift := uint(0); ; shift += 7 { |
| 2837 | if shift >= 64 { |
| 2838 | return ErrIntOverflowRaft |
| 2839 | } |
| 2840 | if iNdEx >= l { |
| 2841 | return io.ErrUnexpectedEOF |
| 2842 | } |
| 2843 | b := dAtA[iNdEx] |
| 2844 | iNdEx++ |
| 2845 | m.Type |= ConfChangeType(b&0x7F) << shift |
| 2846 | if b < 0x80 { |
| 2847 | break |
| 2848 | } |
| 2849 | } |
| 2850 | case 2: |
| 2851 | if wireType != 0 { |
| 2852 | return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) |
| 2853 | } |
| 2854 | m.NodeID = 0 |
| 2855 | for shift := uint(0); ; shift += 7 { |
| 2856 | if shift >= 64 { |
| 2857 | return ErrIntOverflowRaft |
| 2858 | } |
| 2859 | if iNdEx >= l { |
| 2860 | return io.ErrUnexpectedEOF |
| 2861 | } |
| 2862 | b := dAtA[iNdEx] |
| 2863 | iNdEx++ |
| 2864 | m.NodeID |= uint64(b&0x7F) << shift |
| 2865 | if b < 0x80 { |
| 2866 | break |
| 2867 | } |
| 2868 | } |
| 2869 | default: |
| 2870 | iNdEx = preIndex |
| 2871 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 2872 | if err != nil { |
| 2873 | return err |
| 2874 | } |
| 2875 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 2876 | return ErrInvalidLengthRaft |
| 2877 | } |
| 2878 | if (iNdEx + skippy) > l { |
| 2879 | return io.ErrUnexpectedEOF |
| 2880 | } |
| 2881 | iNdEx += skippy |
| 2882 | } |
| 2883 | } |
| 2884 | |
| 2885 | if iNdEx > l { |
| 2886 | return io.ErrUnexpectedEOF |
| 2887 | } |
| 2888 | return nil |
| 2889 | } |
| 2890 | func (m *ConfChangeV2) Unmarshal(dAtA []byte) error { |
| 2891 | l := len(dAtA) |
| 2892 | iNdEx := 0 |
| 2893 | for iNdEx < l { |
| 2894 | preIndex := iNdEx |
| 2895 | var wire uint64 |
| 2896 | for shift := uint(0); ; shift += 7 { |
| 2897 | if shift >= 64 { |
| 2898 | return ErrIntOverflowRaft |
| 2899 | } |
| 2900 | if iNdEx >= l { |
| 2901 | return io.ErrUnexpectedEOF |
| 2902 | } |
| 2903 | b := dAtA[iNdEx] |
| 2904 | iNdEx++ |
| 2905 | wire |= uint64(b&0x7F) << shift |
| 2906 | if b < 0x80 { |
| 2907 | break |
| 2908 | } |
| 2909 | } |
| 2910 | fieldNum := int32(wire >> 3) |
| 2911 | wireType := int(wire & 0x7) |
| 2912 | if wireType == 4 { |
| 2913 | return fmt.Errorf("proto: ConfChangeV2: wiretype end group for non-group") |
| 2914 | } |
| 2915 | if fieldNum <= 0 { |
| 2916 | return fmt.Errorf("proto: ConfChangeV2: illegal tag %d (wire type %d)", fieldNum, wire) |
| 2917 | } |
| 2918 | switch fieldNum { |
| 2919 | case 1: |
| 2920 | if wireType != 0 { |
| 2921 | return fmt.Errorf("proto: wrong wireType = %d for field Transition", wireType) |
| 2922 | } |
| 2923 | m.Transition = 0 |
| 2924 | for shift := uint(0); ; shift += 7 { |
| 2925 | if shift >= 64 { |
| 2926 | return ErrIntOverflowRaft |
| 2927 | } |
| 2928 | if iNdEx >= l { |
| 2929 | return io.ErrUnexpectedEOF |
| 2930 | } |
| 2931 | b := dAtA[iNdEx] |
| 2932 | iNdEx++ |
| 2933 | m.Transition |= ConfChangeTransition(b&0x7F) << shift |
| 2934 | if b < 0x80 { |
| 2935 | break |
| 2936 | } |
| 2937 | } |
| 2938 | case 2: |
| 2939 | if wireType != 2 { |
| 2940 | return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) |
| 2941 | } |
| 2942 | var msglen int |
| 2943 | for shift := uint(0); ; shift += 7 { |
| 2944 | if shift >= 64 { |
| 2945 | return ErrIntOverflowRaft |
| 2946 | } |
| 2947 | if iNdEx >= l { |
| 2948 | return io.ErrUnexpectedEOF |
| 2949 | } |
| 2950 | b := dAtA[iNdEx] |
| 2951 | iNdEx++ |
| 2952 | msglen |= int(b&0x7F) << shift |
| 2953 | if b < 0x80 { |
| 2954 | break |
| 2955 | } |
| 2956 | } |
| 2957 | if msglen < 0 { |
| 2958 | return ErrInvalidLengthRaft |
| 2959 | } |
| 2960 | postIndex := iNdEx + msglen |
| 2961 | if postIndex < 0 { |
| 2962 | return ErrInvalidLengthRaft |
| 2963 | } |
| 2964 | if postIndex > l { |
| 2965 | return io.ErrUnexpectedEOF |
| 2966 | } |
| 2967 | m.Changes = append(m.Changes, ConfChangeSingle{}) |
| 2968 | if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| 2969 | return err |
| 2970 | } |
| 2971 | iNdEx = postIndex |
| 2972 | case 3: |
| 2973 | if wireType != 2 { |
| 2974 | return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) |
| 2975 | } |
| 2976 | var byteLen int |
| 2977 | for shift := uint(0); ; shift += 7 { |
| 2978 | if shift >= 64 { |
| 2979 | return ErrIntOverflowRaft |
| 2980 | } |
| 2981 | if iNdEx >= l { |
| 2982 | return io.ErrUnexpectedEOF |
| 2983 | } |
| 2984 | b := dAtA[iNdEx] |
| 2985 | iNdEx++ |
| 2986 | byteLen |= int(b&0x7F) << shift |
| 2987 | if b < 0x80 { |
| 2988 | break |
| 2989 | } |
| 2990 | } |
| 2991 | if byteLen < 0 { |
| 2992 | return ErrInvalidLengthRaft |
| 2993 | } |
| 2994 | postIndex := iNdEx + byteLen |
| 2995 | if postIndex < 0 { |
| 2996 | return ErrInvalidLengthRaft |
| 2997 | } |
| 2998 | if postIndex > l { |
| 2999 | return io.ErrUnexpectedEOF |
| 3000 | } |
| 3001 | m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) |
| 3002 | if m.Context == nil { |
| 3003 | m.Context = []byte{} |
| 3004 | } |
| 3005 | iNdEx = postIndex |
| 3006 | default: |
| 3007 | iNdEx = preIndex |
| 3008 | skippy, err := skipRaft(dAtA[iNdEx:]) |
| 3009 | if err != nil { |
| 3010 | return err |
| 3011 | } |
| 3012 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 3013 | return ErrInvalidLengthRaft |
| 3014 | } |
| 3015 | if (iNdEx + skippy) > l { |
| 3016 | return io.ErrUnexpectedEOF |
| 3017 | } |
| 3018 | iNdEx += skippy |
| 3019 | } |
| 3020 | } |
| 3021 | |
| 3022 | if iNdEx > l { |
| 3023 | return io.ErrUnexpectedEOF |
| 3024 | } |
| 3025 | return nil |
| 3026 | } |
| 3027 | func skipRaft(dAtA []byte) (n int, err error) { |
| 3028 | l := len(dAtA) |
| 3029 | iNdEx := 0 |
| 3030 | depth := 0 |
| 3031 | for iNdEx < l { |
| 3032 | var wire uint64 |
| 3033 | for shift := uint(0); ; shift += 7 { |
| 3034 | if shift >= 64 { |
| 3035 | return 0, ErrIntOverflowRaft |
| 3036 | } |
| 3037 | if iNdEx >= l { |
| 3038 | return 0, io.ErrUnexpectedEOF |
| 3039 | } |
| 3040 | b := dAtA[iNdEx] |
| 3041 | iNdEx++ |
| 3042 | wire |= (uint64(b) & 0x7F) << shift |
| 3043 | if b < 0x80 { |
| 3044 | break |
| 3045 | } |
| 3046 | } |
| 3047 | wireType := int(wire & 0x7) |
| 3048 | switch wireType { |
| 3049 | case 0: |
| 3050 | for shift := uint(0); ; shift += 7 { |
| 3051 | if shift >= 64 { |
| 3052 | return 0, ErrIntOverflowRaft |
| 3053 | } |
| 3054 | if iNdEx >= l { |
| 3055 | return 0, io.ErrUnexpectedEOF |
| 3056 | } |
| 3057 | iNdEx++ |
| 3058 | if dAtA[iNdEx-1] < 0x80 { |
| 3059 | break |
| 3060 | } |
| 3061 | } |
| 3062 | case 1: |
| 3063 | iNdEx += 8 |
| 3064 | case 2: |
| 3065 | var length int |
| 3066 | for shift := uint(0); ; shift += 7 { |
| 3067 | if shift >= 64 { |
| 3068 | return 0, ErrIntOverflowRaft |
| 3069 | } |
| 3070 | if iNdEx >= l { |
| 3071 | return 0, io.ErrUnexpectedEOF |
| 3072 | } |
| 3073 | b := dAtA[iNdEx] |
| 3074 | iNdEx++ |
| 3075 | length |= (int(b) & 0x7F) << shift |
| 3076 | if b < 0x80 { |
| 3077 | break |
| 3078 | } |
| 3079 | } |
| 3080 | if length < 0 { |
| 3081 | return 0, ErrInvalidLengthRaft |
| 3082 | } |
| 3083 | iNdEx += length |
| 3084 | case 3: |
| 3085 | depth++ |
| 3086 | case 4: |
| 3087 | if depth == 0 { |
| 3088 | return 0, ErrUnexpectedEndOfGroupRaft |
| 3089 | } |
| 3090 | depth-- |
| 3091 | case 5: |
| 3092 | iNdEx += 4 |
| 3093 | default: |
| 3094 | return 0, fmt.Errorf("proto: illegal wireType %d", wireType) |
| 3095 | } |
| 3096 | if iNdEx < 0 { |
| 3097 | return 0, ErrInvalidLengthRaft |
| 3098 | } |
| 3099 | if depth == 0 { |
| 3100 | return iNdEx, nil |
| 3101 | } |
| 3102 | } |
| 3103 | return 0, io.ErrUnexpectedEOF |
| 3104 | } |
| 3105 | |
| 3106 | var ( |
| 3107 | ErrInvalidLengthRaft = fmt.Errorf("proto: negative length found during unmarshaling") |
| 3108 | ErrIntOverflowRaft = fmt.Errorf("proto: integer overflow") |
| 3109 | ErrUnexpectedEndOfGroupRaft = fmt.Errorf("proto: unexpected end of group") |
| 3110 | ) |