| // Code generated by protoc-gen-gogo. DO NOT EDIT. |
| // source: raft.proto |
| |
| package raftpb |
| |
| import ( |
| fmt "fmt" |
| io "io" |
| math "math" |
| math_bits "math/bits" |
| |
| _ "github.com/gogo/protobuf/gogoproto" |
| proto "github.com/golang/protobuf/proto" |
| ) |
| |
| // Reference imports to suppress errors if they are not otherwise used. |
| var _ = proto.Marshal |
| var _ = fmt.Errorf |
| var _ = math.Inf |
| |
| // This is a compile-time assertion to ensure that this generated file |
| // is compatible with the proto package it is being compiled against. |
| // A compilation error at this line likely means your copy of the |
| // proto package needs to be updated. |
| const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package |
| |
| type EntryType int32 |
| |
| const ( |
| EntryNormal EntryType = 0 |
| EntryConfChange EntryType = 1 |
| EntryConfChangeV2 EntryType = 2 |
| ) |
| |
| var EntryType_name = map[int32]string{ |
| 0: "EntryNormal", |
| 1: "EntryConfChange", |
| 2: "EntryConfChangeV2", |
| } |
| |
| var EntryType_value = map[string]int32{ |
| "EntryNormal": 0, |
| "EntryConfChange": 1, |
| "EntryConfChangeV2": 2, |
| } |
| |
| func (x EntryType) Enum() *EntryType { |
| p := new(EntryType) |
| *p = x |
| return p |
| } |
| |
| func (x EntryType) String() string { |
| return proto.EnumName(EntryType_name, int32(x)) |
| } |
| |
| func (x *EntryType) UnmarshalJSON(data []byte) error { |
| value, err := proto.UnmarshalJSONEnum(EntryType_value, data, "EntryType") |
| if err != nil { |
| return err |
| } |
| *x = EntryType(value) |
| return nil |
| } |
| |
| func (EntryType) EnumDescriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{0} |
| } |
| |
| // For description of different message types, see: |
| // https://pkg.go.dev/go.etcd.io/raft/v3#hdr-MessageType |
| type MessageType int32 |
| |
| const ( |
| MsgHup MessageType = 0 |
| MsgBeat MessageType = 1 |
| MsgProp MessageType = 2 |
| MsgApp MessageType = 3 |
| MsgAppResp MessageType = 4 |
| MsgVote MessageType = 5 |
| MsgVoteResp MessageType = 6 |
| MsgSnap MessageType = 7 |
| MsgHeartbeat MessageType = 8 |
| MsgHeartbeatResp MessageType = 9 |
| MsgUnreachable MessageType = 10 |
| MsgSnapStatus MessageType = 11 |
| MsgCheckQuorum MessageType = 12 |
| MsgTransferLeader MessageType = 13 |
| MsgTimeoutNow MessageType = 14 |
| MsgReadIndex MessageType = 15 |
| MsgReadIndexResp MessageType = 16 |
| MsgPreVote MessageType = 17 |
| MsgPreVoteResp MessageType = 18 |
| MsgStorageAppend MessageType = 19 |
| MsgStorageAppendResp MessageType = 20 |
| MsgStorageApply MessageType = 21 |
| MsgStorageApplyResp MessageType = 22 |
| MsgForgetLeader MessageType = 23 |
| ) |
| |
| var MessageType_name = map[int32]string{ |
| 0: "MsgHup", |
| 1: "MsgBeat", |
| 2: "MsgProp", |
| 3: "MsgApp", |
| 4: "MsgAppResp", |
| 5: "MsgVote", |
| 6: "MsgVoteResp", |
| 7: "MsgSnap", |
| 8: "MsgHeartbeat", |
| 9: "MsgHeartbeatResp", |
| 10: "MsgUnreachable", |
| 11: "MsgSnapStatus", |
| 12: "MsgCheckQuorum", |
| 13: "MsgTransferLeader", |
| 14: "MsgTimeoutNow", |
| 15: "MsgReadIndex", |
| 16: "MsgReadIndexResp", |
| 17: "MsgPreVote", |
| 18: "MsgPreVoteResp", |
| 19: "MsgStorageAppend", |
| 20: "MsgStorageAppendResp", |
| 21: "MsgStorageApply", |
| 22: "MsgStorageApplyResp", |
| 23: "MsgForgetLeader", |
| } |
| |
| var MessageType_value = map[string]int32{ |
| "MsgHup": 0, |
| "MsgBeat": 1, |
| "MsgProp": 2, |
| "MsgApp": 3, |
| "MsgAppResp": 4, |
| "MsgVote": 5, |
| "MsgVoteResp": 6, |
| "MsgSnap": 7, |
| "MsgHeartbeat": 8, |
| "MsgHeartbeatResp": 9, |
| "MsgUnreachable": 10, |
| "MsgSnapStatus": 11, |
| "MsgCheckQuorum": 12, |
| "MsgTransferLeader": 13, |
| "MsgTimeoutNow": 14, |
| "MsgReadIndex": 15, |
| "MsgReadIndexResp": 16, |
| "MsgPreVote": 17, |
| "MsgPreVoteResp": 18, |
| "MsgStorageAppend": 19, |
| "MsgStorageAppendResp": 20, |
| "MsgStorageApply": 21, |
| "MsgStorageApplyResp": 22, |
| "MsgForgetLeader": 23, |
| } |
| |
| func (x MessageType) Enum() *MessageType { |
| p := new(MessageType) |
| *p = x |
| return p |
| } |
| |
| func (x MessageType) String() string { |
| return proto.EnumName(MessageType_name, int32(x)) |
| } |
| |
| func (x *MessageType) UnmarshalJSON(data []byte) error { |
| value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType") |
| if err != nil { |
| return err |
| } |
| *x = MessageType(value) |
| return nil |
| } |
| |
| func (MessageType) EnumDescriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{1} |
| } |
| |
| // ConfChangeTransition specifies the behavior of a configuration change with |
| // respect to joint consensus. |
| type ConfChangeTransition int32 |
| |
| const ( |
| // Automatically use the simple protocol if possible, otherwise fall back |
| // to ConfChangeJointImplicit. Most applications will want to use this. |
| ConfChangeTransitionAuto ConfChangeTransition = 0 |
| // Use joint consensus unconditionally, and transition out of them |
| // automatically (by proposing a zero configuration change). |
| // |
| // This option is suitable for applications that want to minimize the time |
| // spent in the joint configuration and do not store the joint configuration |
| // in the state machine (outside of InitialState). |
| ConfChangeTransitionJointImplicit ConfChangeTransition = 1 |
| // Use joint consensus and remain in the joint configuration until the |
| // application proposes a no-op configuration change. This is suitable for |
| // applications that want to explicitly control the transitions, for example |
| // to use a custom payload (via the Context field). |
| ConfChangeTransitionJointExplicit ConfChangeTransition = 2 |
| ) |
| |
| var ConfChangeTransition_name = map[int32]string{ |
| 0: "ConfChangeTransitionAuto", |
| 1: "ConfChangeTransitionJointImplicit", |
| 2: "ConfChangeTransitionJointExplicit", |
| } |
| |
| var ConfChangeTransition_value = map[string]int32{ |
| "ConfChangeTransitionAuto": 0, |
| "ConfChangeTransitionJointImplicit": 1, |
| "ConfChangeTransitionJointExplicit": 2, |
| } |
| |
| func (x ConfChangeTransition) Enum() *ConfChangeTransition { |
| p := new(ConfChangeTransition) |
| *p = x |
| return p |
| } |
| |
| func (x ConfChangeTransition) String() string { |
| return proto.EnumName(ConfChangeTransition_name, int32(x)) |
| } |
| |
| func (x *ConfChangeTransition) UnmarshalJSON(data []byte) error { |
| value, err := proto.UnmarshalJSONEnum(ConfChangeTransition_value, data, "ConfChangeTransition") |
| if err != nil { |
| return err |
| } |
| *x = ConfChangeTransition(value) |
| return nil |
| } |
| |
| func (ConfChangeTransition) EnumDescriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{2} |
| } |
| |
| type ConfChangeType int32 |
| |
| const ( |
| ConfChangeAddNode ConfChangeType = 0 |
| ConfChangeRemoveNode ConfChangeType = 1 |
| ConfChangeUpdateNode ConfChangeType = 2 |
| ConfChangeAddLearnerNode ConfChangeType = 3 |
| ) |
| |
| var ConfChangeType_name = map[int32]string{ |
| 0: "ConfChangeAddNode", |
| 1: "ConfChangeRemoveNode", |
| 2: "ConfChangeUpdateNode", |
| 3: "ConfChangeAddLearnerNode", |
| } |
| |
| var ConfChangeType_value = map[string]int32{ |
| "ConfChangeAddNode": 0, |
| "ConfChangeRemoveNode": 1, |
| "ConfChangeUpdateNode": 2, |
| "ConfChangeAddLearnerNode": 3, |
| } |
| |
| func (x ConfChangeType) Enum() *ConfChangeType { |
| p := new(ConfChangeType) |
| *p = x |
| return p |
| } |
| |
| func (x ConfChangeType) String() string { |
| return proto.EnumName(ConfChangeType_name, int32(x)) |
| } |
| |
| func (x *ConfChangeType) UnmarshalJSON(data []byte) error { |
| value, err := proto.UnmarshalJSONEnum(ConfChangeType_value, data, "ConfChangeType") |
| if err != nil { |
| return err |
| } |
| *x = ConfChangeType(value) |
| return nil |
| } |
| |
| func (ConfChangeType) EnumDescriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{3} |
| } |
| |
| type Entry struct { |
| Term uint64 `protobuf:"varint,2,opt,name=Term" json:"Term"` |
| Index uint64 `protobuf:"varint,3,opt,name=Index" json:"Index"` |
| Type EntryType `protobuf:"varint,1,opt,name=Type,enum=raftpb.EntryType" json:"Type"` |
| Data []byte `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"` |
| } |
| |
| func (m *Entry) Reset() { *m = Entry{} } |
| func (m *Entry) String() string { return proto.CompactTextString(m) } |
| func (*Entry) ProtoMessage() {} |
| func (*Entry) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{0} |
| } |
| func (m *Entry) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_Entry.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *Entry) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_Entry.Merge(m, src) |
| } |
| func (m *Entry) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *Entry) XXX_DiscardUnknown() { |
| xxx_messageInfo_Entry.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_Entry proto.InternalMessageInfo |
| |
| type SnapshotMetadata struct { |
| ConfState ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state"` |
| Index uint64 `protobuf:"varint,2,opt,name=index" json:"index"` |
| Term uint64 `protobuf:"varint,3,opt,name=term" json:"term"` |
| } |
| |
| func (m *SnapshotMetadata) Reset() { *m = SnapshotMetadata{} } |
| func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) } |
| func (*SnapshotMetadata) ProtoMessage() {} |
| func (*SnapshotMetadata) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{1} |
| } |
| func (m *SnapshotMetadata) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *SnapshotMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_SnapshotMetadata.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *SnapshotMetadata) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_SnapshotMetadata.Merge(m, src) |
| } |
| func (m *SnapshotMetadata) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *SnapshotMetadata) XXX_DiscardUnknown() { |
| xxx_messageInfo_SnapshotMetadata.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_SnapshotMetadata proto.InternalMessageInfo |
| |
| type Snapshot struct { |
| Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` |
| Metadata SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata"` |
| } |
| |
| func (m *Snapshot) Reset() { *m = Snapshot{} } |
| func (m *Snapshot) String() string { return proto.CompactTextString(m) } |
| func (*Snapshot) ProtoMessage() {} |
| func (*Snapshot) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{2} |
| } |
| func (m *Snapshot) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *Snapshot) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_Snapshot.Merge(m, src) |
| } |
| func (m *Snapshot) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *Snapshot) XXX_DiscardUnknown() { |
| xxx_messageInfo_Snapshot.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_Snapshot proto.InternalMessageInfo |
| |
| type Message struct { |
| Type MessageType `protobuf:"varint,1,opt,name=type,enum=raftpb.MessageType" json:"type"` |
| To uint64 `protobuf:"varint,2,opt,name=to" json:"to"` |
| From uint64 `protobuf:"varint,3,opt,name=from" json:"from"` |
| Term uint64 `protobuf:"varint,4,opt,name=term" json:"term"` |
| // logTerm is generally used for appending Raft logs to followers. For example, |
| // (type=MsgApp,index=100,logTerm=5) means the leader appends entries starting |
| // at index=101, and the term of the entry at index 100 is 5. |
| // (type=MsgAppResp,reject=true,index=100,logTerm=5) means follower rejects some |
| // entries from its leader as it already has an entry with term 5 at index 100. |
| // (type=MsgStorageAppendResp,index=100,logTerm=5) means the local node wrote |
| // entries up to index=100 in stable storage, and the term of the entry at index |
| // 100 was 5. This doesn't always mean that the corresponding MsgStorageAppend |
| // message was the one that carried these entries, just that those entries were |
| // stable at the time of processing the corresponding MsgStorageAppend. |
| LogTerm uint64 `protobuf:"varint,5,opt,name=logTerm" json:"logTerm"` |
| Index uint64 `protobuf:"varint,6,opt,name=index" json:"index"` |
| Entries []Entry `protobuf:"bytes,7,rep,name=entries" json:"entries"` |
| Commit uint64 `protobuf:"varint,8,opt,name=commit" json:"commit"` |
| // (type=MsgStorageAppend,vote=5,term=10) means the local node is voting for |
| // peer 5 in term 10. For MsgStorageAppends, the term, vote, and commit fields |
| // will either all be set (to facilitate the construction of a HardState) if |
| // any of the fields have changed or will all be unset if none of the fields |
| // have changed. |
| Vote uint64 `protobuf:"varint,13,opt,name=vote" json:"vote"` |
| // snapshot is non-nil and non-empty for MsgSnap messages and nil for all other |
| // message types. However, peer nodes running older binary versions may send a |
| // non-nil, empty value for the snapshot field of non-MsgSnap messages. Code |
| // should be prepared to handle such messages. |
| Snapshot *Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot,omitempty"` |
| Reject bool `protobuf:"varint,10,opt,name=reject" json:"reject"` |
| RejectHint uint64 `protobuf:"varint,11,opt,name=rejectHint" json:"rejectHint"` |
| Context []byte `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"` |
| // responses are populated by a raft node to instruct storage threads on how |
| // to respond and who to respond to when the work associated with a message |
| // is complete. Populated for MsgStorageAppend and MsgStorageApply messages. |
| Responses []Message `protobuf:"bytes,14,rep,name=responses" json:"responses"` |
| } |
| |
| func (m *Message) Reset() { *m = Message{} } |
| func (m *Message) String() string { return proto.CompactTextString(m) } |
| func (*Message) ProtoMessage() {} |
| func (*Message) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{3} |
| } |
| func (m *Message) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_Message.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *Message) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_Message.Merge(m, src) |
| } |
| func (m *Message) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *Message) XXX_DiscardUnknown() { |
| xxx_messageInfo_Message.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_Message proto.InternalMessageInfo |
| |
| type HardState struct { |
| Term uint64 `protobuf:"varint,1,opt,name=term" json:"term"` |
| Vote uint64 `protobuf:"varint,2,opt,name=vote" json:"vote"` |
| Commit uint64 `protobuf:"varint,3,opt,name=commit" json:"commit"` |
| } |
| |
| func (m *HardState) Reset() { *m = HardState{} } |
| func (m *HardState) String() string { return proto.CompactTextString(m) } |
| func (*HardState) ProtoMessage() {} |
| func (*HardState) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{4} |
| } |
| func (m *HardState) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *HardState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_HardState.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *HardState) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_HardState.Merge(m, src) |
| } |
| func (m *HardState) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *HardState) XXX_DiscardUnknown() { |
| xxx_messageInfo_HardState.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_HardState proto.InternalMessageInfo |
| |
| type ConfState struct { |
| // The voters in the incoming config. (If the configuration is not joint, |
| // then the outgoing config is empty). |
| Voters []uint64 `protobuf:"varint,1,rep,name=voters" json:"voters,omitempty"` |
| // The learners in the incoming config. |
| Learners []uint64 `protobuf:"varint,2,rep,name=learners" json:"learners,omitempty"` |
| // The voters in the outgoing config. |
| VotersOutgoing []uint64 `protobuf:"varint,3,rep,name=voters_outgoing,json=votersOutgoing" json:"voters_outgoing,omitempty"` |
| // The nodes that will become learners when the outgoing config is removed. |
| // These nodes are necessarily currently in nodes_joint (or they would have |
| // been added to the incoming config right away). |
| LearnersNext []uint64 `protobuf:"varint,4,rep,name=learners_next,json=learnersNext" json:"learners_next,omitempty"` |
| // If set, the config is joint and Raft will automatically transition into |
| // the final config (i.e. remove the outgoing config) when this is safe. |
| AutoLeave bool `protobuf:"varint,5,opt,name=auto_leave,json=autoLeave" json:"auto_leave"` |
| } |
| |
| func (m *ConfState) Reset() { *m = ConfState{} } |
| func (m *ConfState) String() string { return proto.CompactTextString(m) } |
| func (*ConfState) ProtoMessage() {} |
| func (*ConfState) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{5} |
| } |
| func (m *ConfState) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *ConfState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_ConfState.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *ConfState) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_ConfState.Merge(m, src) |
| } |
| func (m *ConfState) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *ConfState) XXX_DiscardUnknown() { |
| xxx_messageInfo_ConfState.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_ConfState proto.InternalMessageInfo |
| |
| type ConfChange struct { |
| Type ConfChangeType `protobuf:"varint,2,opt,name=type,enum=raftpb.ConfChangeType" json:"type"` |
| NodeID uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId" json:"node_id"` |
| Context []byte `protobuf:"bytes,4,opt,name=context" json:"context,omitempty"` |
| // NB: this is used only by etcd to thread through a unique identifier. |
| // Ideally it should really use the Context instead. No counterpart to |
| // this field exists in ConfChangeV2. |
| ID uint64 `protobuf:"varint,1,opt,name=id" json:"id"` |
| } |
| |
| func (m *ConfChange) Reset() { *m = ConfChange{} } |
| func (m *ConfChange) String() string { return proto.CompactTextString(m) } |
| func (*ConfChange) ProtoMessage() {} |
| func (*ConfChange) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{6} |
| } |
| func (m *ConfChange) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *ConfChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_ConfChange.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *ConfChange) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_ConfChange.Merge(m, src) |
| } |
| func (m *ConfChange) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *ConfChange) XXX_DiscardUnknown() { |
| xxx_messageInfo_ConfChange.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_ConfChange proto.InternalMessageInfo |
| |
| // ConfChangeSingle is an individual configuration change operation. Multiple |
| // such operations can be carried out atomically via a ConfChangeV2. |
| type ConfChangeSingle struct { |
| Type ConfChangeType `protobuf:"varint,1,opt,name=type,enum=raftpb.ConfChangeType" json:"type"` |
| NodeID uint64 `protobuf:"varint,2,opt,name=node_id,json=nodeId" json:"node_id"` |
| } |
| |
| func (m *ConfChangeSingle) Reset() { *m = ConfChangeSingle{} } |
| func (m *ConfChangeSingle) String() string { return proto.CompactTextString(m) } |
| func (*ConfChangeSingle) ProtoMessage() {} |
| func (*ConfChangeSingle) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{7} |
| } |
| func (m *ConfChangeSingle) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *ConfChangeSingle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_ConfChangeSingle.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *ConfChangeSingle) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_ConfChangeSingle.Merge(m, src) |
| } |
| func (m *ConfChangeSingle) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *ConfChangeSingle) XXX_DiscardUnknown() { |
| xxx_messageInfo_ConfChangeSingle.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_ConfChangeSingle proto.InternalMessageInfo |
| |
| // ConfChangeV2 messages initiate configuration changes. They support both the |
| // simple "one at a time" membership change protocol and full Joint Consensus |
| // allowing for arbitrary changes in membership. |
| // |
| // The supplied context is treated as an opaque payload and can be used to |
| // attach an action on the state machine to the application of the config change |
| // proposal. Note that contrary to Joint Consensus as outlined in the Raft |
| // paper[1], configuration changes become active when they are *applied* to the |
| // state machine (not when they are appended to the log). |
| // |
| // The simple protocol can be used whenever only a single change is made. |
| // |
| // Non-simple changes require the use of Joint Consensus, for which two |
| // configuration changes are run. The first configuration change specifies the |
| // desired changes and transitions the Raft group into the joint configuration, |
| // in which quorum requires a majority of both the pre-changes and post-changes |
| // configuration. Joint Consensus avoids entering fragile intermediate |
| // configurations that could compromise survivability. For example, without the |
| // use of Joint Consensus and running across three availability zones with a |
| // replication factor of three, it is not possible to replace a voter without |
| // entering an intermediate configuration that does not survive the outage of |
| // one availability zone. |
| // |
| // The provided ConfChangeTransition specifies how (and whether) Joint Consensus |
| // is used, and assigns the task of leaving the joint configuration either to |
| // Raft or the application. Leaving the joint configuration is accomplished by |
| // proposing a ConfChangeV2 with only and optionally the Context field |
| // populated. |
| // |
| // For details on Raft membership changes, see: |
| // |
| // [1]: https://github.com/ongardie/dissertation/blob/master/online-trim.pdf |
| type ConfChangeV2 struct { |
| Transition ConfChangeTransition `protobuf:"varint,1,opt,name=transition,enum=raftpb.ConfChangeTransition" json:"transition"` |
| Changes []ConfChangeSingle `protobuf:"bytes,2,rep,name=changes" json:"changes"` |
| Context []byte `protobuf:"bytes,3,opt,name=context" json:"context,omitempty"` |
| } |
| |
| func (m *ConfChangeV2) Reset() { *m = ConfChangeV2{} } |
| func (m *ConfChangeV2) String() string { return proto.CompactTextString(m) } |
| func (*ConfChangeV2) ProtoMessage() {} |
| func (*ConfChangeV2) Descriptor() ([]byte, []int) { |
| return fileDescriptor_b042552c306ae59b, []int{8} |
| } |
| func (m *ConfChangeV2) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *ConfChangeV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_ConfChangeV2.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalToSizedBuffer(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (m *ConfChangeV2) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_ConfChangeV2.Merge(m, src) |
| } |
| func (m *ConfChangeV2) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *ConfChangeV2) XXX_DiscardUnknown() { |
| xxx_messageInfo_ConfChangeV2.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_ConfChangeV2 proto.InternalMessageInfo |
| |
| func init() { |
| proto.RegisterEnum("raftpb.EntryType", EntryType_name, EntryType_value) |
| proto.RegisterEnum("raftpb.MessageType", MessageType_name, MessageType_value) |
| proto.RegisterEnum("raftpb.ConfChangeTransition", ConfChangeTransition_name, ConfChangeTransition_value) |
| proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) |
| proto.RegisterType((*Entry)(nil), "raftpb.Entry") |
| proto.RegisterType((*SnapshotMetadata)(nil), "raftpb.SnapshotMetadata") |
| proto.RegisterType((*Snapshot)(nil), "raftpb.Snapshot") |
| proto.RegisterType((*Message)(nil), "raftpb.Message") |
| proto.RegisterType((*HardState)(nil), "raftpb.HardState") |
| proto.RegisterType((*ConfState)(nil), "raftpb.ConfState") |
| proto.RegisterType((*ConfChange)(nil), "raftpb.ConfChange") |
| proto.RegisterType((*ConfChangeSingle)(nil), "raftpb.ConfChangeSingle") |
| proto.RegisterType((*ConfChangeV2)(nil), "raftpb.ConfChangeV2") |
| } |
| |
| func init() { proto.RegisterFile("raft.proto", fileDescriptor_b042552c306ae59b) } |
| |
| var fileDescriptor_b042552c306ae59b = []byte{ |
| // 1102 bytes of a gzipped FileDescriptorProto |
| 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0x23, 0x45, |
| 0x14, 0xed, 0x6e, 0x77, 0xfc, 0xb8, 0x76, 0x9c, 0x4a, 0xc5, 0x33, 0xd3, 0x8a, 0x22, 0x8f, 0xf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, 0x83, 0x09, 0x00, 0x00, |
| } |
| |
| func (m *Entry) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *Entry) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| if m.Data != nil { |
| i -= len(m.Data) |
| copy(dAtA[i:], m.Data) |
| i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) |
| i-- |
| dAtA[i] = 0x22 |
| } |
| i = encodeVarintRaft(dAtA, i, uint64(m.Index)) |
| i-- |
| dAtA[i] = 0x18 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| i-- |
| dAtA[i] = 0x10 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| i-- |
| dAtA[i] = 0x8 |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *SnapshotMetadata) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *SnapshotMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| i-- |
| dAtA[i] = 0x18 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Index)) |
| i-- |
| dAtA[i] = 0x10 |
| { |
| size, err := m.ConfState.MarshalToSizedBuffer(dAtA[:i]) |
| if err != nil { |
| return 0, err |
| } |
| i -= size |
| i = encodeVarintRaft(dAtA, i, uint64(size)) |
| } |
| i-- |
| dAtA[i] = 0xa |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *Snapshot) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| { |
| size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) |
| if err != nil { |
| return 0, err |
| } |
| i -= size |
| i = encodeVarintRaft(dAtA, i, uint64(size)) |
| } |
| i-- |
| dAtA[i] = 0x12 |
| if m.Data != nil { |
| i -= len(m.Data) |
| copy(dAtA[i:], m.Data) |
| i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) |
| i-- |
| dAtA[i] = 0xa |
| } |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *Message) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *Message) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| if len(m.Responses) > 0 { |
| for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { |
| { |
| size, err := m.Responses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) |
| if err != nil { |
| return 0, err |
| } |
| i -= size |
| i = encodeVarintRaft(dAtA, i, uint64(size)) |
| } |
| i-- |
| dAtA[i] = 0x72 |
| } |
| } |
| i = encodeVarintRaft(dAtA, i, uint64(m.Vote)) |
| i-- |
| dAtA[i] = 0x68 |
| if m.Context != nil { |
| i -= len(m.Context) |
| copy(dAtA[i:], m.Context) |
| i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) |
| i-- |
| dAtA[i] = 0x62 |
| } |
| i = encodeVarintRaft(dAtA, i, uint64(m.RejectHint)) |
| i-- |
| dAtA[i] = 0x58 |
| i-- |
| if m.Reject { |
| dAtA[i] = 1 |
| } else { |
| dAtA[i] = 0 |
| } |
| i-- |
| dAtA[i] = 0x50 |
| if m.Snapshot != nil { |
| { |
| size, err := m.Snapshot.MarshalToSizedBuffer(dAtA[:i]) |
| if err != nil { |
| return 0, err |
| } |
| i -= size |
| i = encodeVarintRaft(dAtA, i, uint64(size)) |
| } |
| i-- |
| dAtA[i] = 0x4a |
| } |
| i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) |
| i-- |
| dAtA[i] = 0x40 |
| if len(m.Entries) > 0 { |
| for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { |
| { |
| size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) |
| if err != nil { |
| return 0, err |
| } |
| i -= size |
| i = encodeVarintRaft(dAtA, i, uint64(size)) |
| } |
| i-- |
| dAtA[i] = 0x3a |
| } |
| } |
| i = encodeVarintRaft(dAtA, i, uint64(m.Index)) |
| i-- |
| dAtA[i] = 0x30 |
| i = encodeVarintRaft(dAtA, i, uint64(m.LogTerm)) |
| i-- |
| dAtA[i] = 0x28 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| i-- |
| dAtA[i] = 0x20 |
| i = encodeVarintRaft(dAtA, i, uint64(m.From)) |
| i-- |
| dAtA[i] = 0x18 |
| i = encodeVarintRaft(dAtA, i, uint64(m.To)) |
| i-- |
| dAtA[i] = 0x10 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| i-- |
| dAtA[i] = 0x8 |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *HardState) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *HardState) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *HardState) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) |
| i-- |
| dAtA[i] = 0x18 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Vote)) |
| i-- |
| dAtA[i] = 0x10 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Term)) |
| i-- |
| dAtA[i] = 0x8 |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *ConfState) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *ConfState) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *ConfState) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| i-- |
| if m.AutoLeave { |
| dAtA[i] = 1 |
| } else { |
| dAtA[i] = 0 |
| } |
| i-- |
| dAtA[i] = 0x28 |
| if len(m.LearnersNext) > 0 { |
| for iNdEx := len(m.LearnersNext) - 1; iNdEx >= 0; iNdEx-- { |
| i = encodeVarintRaft(dAtA, i, uint64(m.LearnersNext[iNdEx])) |
| i-- |
| dAtA[i] = 0x20 |
| } |
| } |
| if len(m.VotersOutgoing) > 0 { |
| for iNdEx := len(m.VotersOutgoing) - 1; iNdEx >= 0; iNdEx-- { |
| i = encodeVarintRaft(dAtA, i, uint64(m.VotersOutgoing[iNdEx])) |
| i-- |
| dAtA[i] = 0x18 |
| } |
| } |
| if len(m.Learners) > 0 { |
| for iNdEx := len(m.Learners) - 1; iNdEx >= 0; iNdEx-- { |
| i = encodeVarintRaft(dAtA, i, uint64(m.Learners[iNdEx])) |
| i-- |
| dAtA[i] = 0x10 |
| } |
| } |
| if len(m.Voters) > 0 { |
| for iNdEx := len(m.Voters) - 1; iNdEx >= 0; iNdEx-- { |
| i = encodeVarintRaft(dAtA, i, uint64(m.Voters[iNdEx])) |
| i-- |
| dAtA[i] = 0x8 |
| } |
| } |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *ConfChange) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *ConfChange) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *ConfChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| if m.Context != nil { |
| i -= len(m.Context) |
| copy(dAtA[i:], m.Context) |
| i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) |
| i-- |
| dAtA[i] = 0x22 |
| } |
| i = encodeVarintRaft(dAtA, i, uint64(m.NodeID)) |
| i-- |
| dAtA[i] = 0x18 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| i-- |
| dAtA[i] = 0x10 |
| i = encodeVarintRaft(dAtA, i, uint64(m.ID)) |
| i-- |
| dAtA[i] = 0x8 |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *ConfChangeSingle) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *ConfChangeSingle) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *ConfChangeSingle) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| i = encodeVarintRaft(dAtA, i, uint64(m.NodeID)) |
| i-- |
| dAtA[i] = 0x10 |
| i = encodeVarintRaft(dAtA, i, uint64(m.Type)) |
| i-- |
| dAtA[i] = 0x8 |
| return len(dAtA) - i, nil |
| } |
| |
| func (m *ConfChangeV2) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalToSizedBuffer(dAtA[:size]) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *ConfChangeV2) MarshalTo(dAtA []byte) (int, error) { |
| size := m.Size() |
| return m.MarshalToSizedBuffer(dAtA[:size]) |
| } |
| |
| func (m *ConfChangeV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { |
| i := len(dAtA) |
| _ = i |
| var l int |
| _ = l |
| if m.Context != nil { |
| i -= len(m.Context) |
| copy(dAtA[i:], m.Context) |
| i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) |
| i-- |
| dAtA[i] = 0x1a |
| } |
| if len(m.Changes) > 0 { |
| for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { |
| { |
| size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) |
| if err != nil { |
| return 0, err |
| } |
| i -= size |
| i = encodeVarintRaft(dAtA, i, uint64(size)) |
| } |
| i-- |
| dAtA[i] = 0x12 |
| } |
| } |
| i = encodeVarintRaft(dAtA, i, uint64(m.Transition)) |
| i-- |
| dAtA[i] = 0x8 |
| return len(dAtA) - i, nil |
| } |
| |
| func encodeVarintRaft(dAtA []byte, offset int, v uint64) int { |
| offset -= sovRaft(v) |
| base := offset |
| for v >= 1<<7 { |
| dAtA[offset] = uint8(v&0x7f | 0x80) |
| v >>= 7 |
| offset++ |
| } |
| dAtA[offset] = uint8(v) |
| return base |
| } |
| func (m *Entry) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| n += 1 + sovRaft(uint64(m.Type)) |
| n += 1 + sovRaft(uint64(m.Term)) |
| n += 1 + sovRaft(uint64(m.Index)) |
| if m.Data != nil { |
| l = len(m.Data) |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| return n |
| } |
| |
| func (m *SnapshotMetadata) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| l = m.ConfState.Size() |
| n += 1 + l + sovRaft(uint64(l)) |
| n += 1 + sovRaft(uint64(m.Index)) |
| n += 1 + sovRaft(uint64(m.Term)) |
| return n |
| } |
| |
| func (m *Snapshot) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| if m.Data != nil { |
| l = len(m.Data) |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| l = m.Metadata.Size() |
| n += 1 + l + sovRaft(uint64(l)) |
| return n |
| } |
| |
| func (m *Message) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| n += 1 + sovRaft(uint64(m.Type)) |
| n += 1 + sovRaft(uint64(m.To)) |
| n += 1 + sovRaft(uint64(m.From)) |
| n += 1 + sovRaft(uint64(m.Term)) |
| n += 1 + sovRaft(uint64(m.LogTerm)) |
| n += 1 + sovRaft(uint64(m.Index)) |
| if len(m.Entries) > 0 { |
| for _, e := range m.Entries { |
| l = e.Size() |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| } |
| n += 1 + sovRaft(uint64(m.Commit)) |
| if m.Snapshot != nil { |
| l = m.Snapshot.Size() |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| n += 2 |
| n += 1 + sovRaft(uint64(m.RejectHint)) |
| if m.Context != nil { |
| l = len(m.Context) |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| n += 1 + sovRaft(uint64(m.Vote)) |
| if len(m.Responses) > 0 { |
| for _, e := range m.Responses { |
| l = e.Size() |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| } |
| return n |
| } |
| |
| func (m *HardState) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| n += 1 + sovRaft(uint64(m.Term)) |
| n += 1 + sovRaft(uint64(m.Vote)) |
| n += 1 + sovRaft(uint64(m.Commit)) |
| return n |
| } |
| |
| func (m *ConfState) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| if len(m.Voters) > 0 { |
| for _, e := range m.Voters { |
| n += 1 + sovRaft(uint64(e)) |
| } |
| } |
| if len(m.Learners) > 0 { |
| for _, e := range m.Learners { |
| n += 1 + sovRaft(uint64(e)) |
| } |
| } |
| if len(m.VotersOutgoing) > 0 { |
| for _, e := range m.VotersOutgoing { |
| n += 1 + sovRaft(uint64(e)) |
| } |
| } |
| if len(m.LearnersNext) > 0 { |
| for _, e := range m.LearnersNext { |
| n += 1 + sovRaft(uint64(e)) |
| } |
| } |
| n += 2 |
| return n |
| } |
| |
| func (m *ConfChange) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| n += 1 + sovRaft(uint64(m.ID)) |
| n += 1 + sovRaft(uint64(m.Type)) |
| n += 1 + sovRaft(uint64(m.NodeID)) |
| if m.Context != nil { |
| l = len(m.Context) |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| return n |
| } |
| |
| func (m *ConfChangeSingle) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| n += 1 + sovRaft(uint64(m.Type)) |
| n += 1 + sovRaft(uint64(m.NodeID)) |
| return n |
| } |
| |
| func (m *ConfChangeV2) Size() (n int) { |
| if m == nil { |
| return 0 |
| } |
| var l int |
| _ = l |
| n += 1 + sovRaft(uint64(m.Transition)) |
| if len(m.Changes) > 0 { |
| for _, e := range m.Changes { |
| l = e.Size() |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| } |
| if m.Context != nil { |
| l = len(m.Context) |
| n += 1 + l + sovRaft(uint64(l)) |
| } |
| return n |
| } |
| |
| func sovRaft(x uint64) (n int) { |
| return (math_bits.Len64(x|1) + 6) / 7 |
| } |
| func sozRaft(x uint64) (n int) { |
| return sovRaft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) |
| } |
| func (m *Entry) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: Entry: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| } |
| m.Type = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Type |= EntryType(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 2: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| } |
| m.Term = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Term |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 3: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) |
| } |
| m.Index = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Index |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 4: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) |
| } |
| var byteLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| byteLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if byteLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + byteLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) |
| if m.Data == nil { |
| m.Data = []byte{} |
| } |
| iNdEx = postIndex |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: SnapshotMetadata: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: SnapshotMetadata: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field ConfState", wireType) |
| } |
| var msglen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| msglen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if msglen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + msglen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| if err := m.ConfState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| return err |
| } |
| iNdEx = postIndex |
| case 2: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) |
| } |
| m.Index = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Index |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 3: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| } |
| m.Term = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Term |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *Snapshot) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) |
| } |
| var byteLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| byteLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if byteLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + byteLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) |
| if m.Data == nil { |
| m.Data = []byte{} |
| } |
| iNdEx = postIndex |
| case 2: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) |
| } |
| var msglen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| msglen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if msglen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + msglen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| return err |
| } |
| iNdEx = postIndex |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *Message) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: Message: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| } |
| m.Type = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Type |= MessageType(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 2: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) |
| } |
| m.To = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.To |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 3: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) |
| } |
| m.From = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.From |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 4: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| } |
| m.Term = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Term |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 5: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field LogTerm", wireType) |
| } |
| m.LogTerm = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.LogTerm |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 6: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) |
| } |
| m.Index = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Index |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 7: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) |
| } |
| var msglen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| msglen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if msglen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + msglen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Entries = append(m.Entries, Entry{}) |
| if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| return err |
| } |
| iNdEx = postIndex |
| case 8: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) |
| } |
| m.Commit = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Commit |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 9: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) |
| } |
| var msglen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| msglen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if msglen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + msglen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| if m.Snapshot == nil { |
| m.Snapshot = &Snapshot{} |
| } |
| if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| return err |
| } |
| iNdEx = postIndex |
| case 10: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Reject", wireType) |
| } |
| var v int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.Reject = bool(v != 0) |
| case 11: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field RejectHint", wireType) |
| } |
| m.RejectHint = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.RejectHint |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 12: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) |
| } |
| var byteLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| byteLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if byteLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + byteLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) |
| if m.Context == nil { |
| m.Context = []byte{} |
| } |
| iNdEx = postIndex |
| case 13: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) |
| } |
| m.Vote = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Vote |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 14: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType) |
| } |
| var msglen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| msglen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if msglen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + msglen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Responses = append(m.Responses, Message{}) |
| if err := m.Responses[len(m.Responses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| return err |
| } |
| iNdEx = postIndex |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *HardState) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: HardState: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: HardState: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) |
| } |
| m.Term = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Term |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 2: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) |
| } |
| m.Vote = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Vote |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 3: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) |
| } |
| m.Commit = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Commit |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *ConfState) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: ConfState: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: ConfState: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType == 0 { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.Voters = append(m.Voters, v) |
| } else if wireType == 2 { |
| var packedLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| packedLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if packedLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + packedLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| var elementCount int |
| var count int |
| for _, integer := range dAtA[iNdEx:postIndex] { |
| if integer < 128 { |
| count++ |
| } |
| } |
| elementCount = count |
| if elementCount != 0 && len(m.Voters) == 0 { |
| m.Voters = make([]uint64, 0, elementCount) |
| } |
| for iNdEx < postIndex { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.Voters = append(m.Voters, v) |
| } |
| } else { |
| return fmt.Errorf("proto: wrong wireType = %d for field Voters", wireType) |
| } |
| case 2: |
| if wireType == 0 { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.Learners = append(m.Learners, v) |
| } else if wireType == 2 { |
| var packedLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| packedLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if packedLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + packedLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| var elementCount int |
| var count int |
| for _, integer := range dAtA[iNdEx:postIndex] { |
| if integer < 128 { |
| count++ |
| } |
| } |
| elementCount = count |
| if elementCount != 0 && len(m.Learners) == 0 { |
| m.Learners = make([]uint64, 0, elementCount) |
| } |
| for iNdEx < postIndex { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.Learners = append(m.Learners, v) |
| } |
| } else { |
| return fmt.Errorf("proto: wrong wireType = %d for field Learners", wireType) |
| } |
| case 3: |
| if wireType == 0 { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.VotersOutgoing = append(m.VotersOutgoing, v) |
| } else if wireType == 2 { |
| var packedLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| packedLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if packedLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + packedLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| var elementCount int |
| var count int |
| for _, integer := range dAtA[iNdEx:postIndex] { |
| if integer < 128 { |
| count++ |
| } |
| } |
| elementCount = count |
| if elementCount != 0 && len(m.VotersOutgoing) == 0 { |
| m.VotersOutgoing = make([]uint64, 0, elementCount) |
| } |
| for iNdEx < postIndex { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.VotersOutgoing = append(m.VotersOutgoing, v) |
| } |
| } else { |
| return fmt.Errorf("proto: wrong wireType = %d for field VotersOutgoing", wireType) |
| } |
| case 4: |
| if wireType == 0 { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.LearnersNext = append(m.LearnersNext, v) |
| } else if wireType == 2 { |
| var packedLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| packedLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if packedLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + packedLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| var elementCount int |
| var count int |
| for _, integer := range dAtA[iNdEx:postIndex] { |
| if integer < 128 { |
| count++ |
| } |
| } |
| elementCount = count |
| if elementCount != 0 && len(m.LearnersNext) == 0 { |
| m.LearnersNext = make([]uint64, 0, elementCount) |
| } |
| for iNdEx < postIndex { |
| var v uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.LearnersNext = append(m.LearnersNext, v) |
| } |
| } else { |
| return fmt.Errorf("proto: wrong wireType = %d for field LearnersNext", wireType) |
| } |
| case 5: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field AutoLeave", wireType) |
| } |
| var v int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| v |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| m.AutoLeave = bool(v != 0) |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *ConfChange) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: ConfChange: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: ConfChange: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) |
| } |
| m.ID = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.ID |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 2: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| } |
| m.Type = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Type |= ConfChangeType(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 3: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) |
| } |
| m.NodeID = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.NodeID |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 4: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) |
| } |
| var byteLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| byteLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if byteLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + byteLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) |
| if m.Context == nil { |
| m.Context = []byte{} |
| } |
| iNdEx = postIndex |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *ConfChangeSingle) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: ConfChangeSingle: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: ConfChangeSingle: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| } |
| m.Type = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Type |= ConfChangeType(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 2: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) |
| } |
| m.NodeID = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.NodeID |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func (m *ConfChangeV2) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= uint64(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: ConfChangeV2: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: ConfChangeV2: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Transition", wireType) |
| } |
| m.Transition = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Transition |= ConfChangeTransition(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 2: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) |
| } |
| var msglen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| msglen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if msglen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + msglen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Changes = append(m.Changes, ConfChangeSingle{}) |
| if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
| return err |
| } |
| iNdEx = postIndex |
| case 3: |
| if wireType != 2 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) |
| } |
| var byteLen int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| byteLen |= int(b&0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if byteLen < 0 { |
| return ErrInvalidLengthRaft |
| } |
| postIndex := iNdEx + byteLen |
| if postIndex < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if postIndex > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) |
| if m.Context == nil { |
| m.Context = []byte{} |
| } |
| iNdEx = postIndex |
| default: |
| iNdEx = preIndex |
| skippy, err := skipRaft(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if (skippy < 0) || (iNdEx+skippy) < 0 { |
| return ErrInvalidLengthRaft |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func skipRaft(dAtA []byte) (n int, err error) { |
| l := len(dAtA) |
| iNdEx := 0 |
| depth := 0 |
| for iNdEx < l { |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return 0, ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return 0, io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= (uint64(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| wireType := int(wire & 0x7) |
| switch wireType { |
| case 0: |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return 0, ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return 0, io.ErrUnexpectedEOF |
| } |
| iNdEx++ |
| if dAtA[iNdEx-1] < 0x80 { |
| break |
| } |
| } |
| case 1: |
| iNdEx += 8 |
| case 2: |
| var length int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return 0, ErrIntOverflowRaft |
| } |
| if iNdEx >= l { |
| return 0, io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| length |= (int(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| if length < 0 { |
| return 0, ErrInvalidLengthRaft |
| } |
| iNdEx += length |
| case 3: |
| depth++ |
| case 4: |
| if depth == 0 { |
| return 0, ErrUnexpectedEndOfGroupRaft |
| } |
| depth-- |
| case 5: |
| iNdEx += 4 |
| default: |
| return 0, fmt.Errorf("proto: illegal wireType %d", wireType) |
| } |
| if iNdEx < 0 { |
| return 0, ErrInvalidLengthRaft |
| } |
| if depth == 0 { |
| return iNdEx, nil |
| } |
| } |
| return 0, io.ErrUnexpectedEOF |
| } |
| |
| var ( |
| ErrInvalidLengthRaft = fmt.Errorf("proto: negative length found during unmarshaling") |
| ErrIntOverflowRaft = fmt.Errorf("proto: integer overflow") |
| ErrUnexpectedEndOfGroupRaft = fmt.Errorf("proto: unexpected end of group") |
| ) |