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