1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546 |
- // Code generated by protoc-gen-gogo.
- // source: raft.proto
- // DO NOT EDIT!
- /*
- Package raftpb is a generated protocol buffer package.
- It is generated from these files:
- raft.proto
- It has these top-level messages:
- Entry
- SnapshotMetadata
- Snapshot
- Message
- HardState
- ConfState
- ConfChange
- */
- package raftpb
- import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
- import math "math"
- // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
- import io "io"
- import fmt "fmt"
- // Reference imports to suppress errors if they are not otherwise used.
- var _ = proto.Marshal
- var _ = math.Inf
- type EntryType int32
- const (
- EntryNormal EntryType = 0
- EntryConfChange EntryType = 1
- )
- var EntryType_name = map[int32]string{
- 0: "EntryNormal",
- 1: "EntryConfChange",
- }
- var EntryType_value = map[string]int32{
- "EntryNormal": 0,
- "EntryConfChange": 1,
- }
- 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
- }
- 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
- )
- 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",
- }
- 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,
- }
- 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
- }
- type ConfChangeType int32
- const (
- ConfChangeAddNode ConfChangeType = 0
- ConfChangeRemoveNode ConfChangeType = 1
- ConfChangeUpdateNode ConfChangeType = 2
- )
- var ConfChangeType_name = map[int32]string{
- 0: "ConfChangeAddNode",
- 1: "ConfChangeRemoveNode",
- 2: "ConfChangeUpdateNode",
- }
- var ConfChangeType_value = map[string]int32{
- "ConfChangeAddNode": 0,
- "ConfChangeRemoveNode": 1,
- "ConfChangeUpdateNode": 2,
- }
- 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
- }
- type Entry struct {
- Type EntryType `protobuf:"varint,1,opt,enum=raftpb.EntryType" json:"Type"`
- Term uint64 `protobuf:"varint,2,opt" json:"Term"`
- Index uint64 `protobuf:"varint,3,opt" json:"Index"`
- Data []byte `protobuf:"bytes,4,opt" json:"Data,omitempty"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *Entry) Reset() { *m = Entry{} }
- func (m *Entry) String() string { return proto.CompactTextString(m) }
- func (*Entry) ProtoMessage() {}
- type SnapshotMetadata struct {
- ConfState ConfState `protobuf:"bytes,1,opt,name=conf_state" json:"conf_state"`
- Index uint64 `protobuf:"varint,2,opt,name=index" json:"index"`
- Term uint64 `protobuf:"varint,3,opt,name=term" json:"term"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *SnapshotMetadata) Reset() { *m = SnapshotMetadata{} }
- func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) }
- func (*SnapshotMetadata) ProtoMessage() {}
- type Snapshot struct {
- Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
- Metadata SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *Snapshot) Reset() { *m = Snapshot{} }
- func (m *Snapshot) String() string { return proto.CompactTextString(m) }
- func (*Snapshot) ProtoMessage() {}
- 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 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"`
- Snapshot Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot"`
- Reject bool `protobuf:"varint,10,opt,name=reject" json:"reject"`
- RejectHint uint64 `protobuf:"varint,11,opt,name=rejectHint" json:"rejectHint"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *Message) Reset() { *m = Message{} }
- func (m *Message) String() string { return proto.CompactTextString(m) }
- func (*Message) ProtoMessage() {}
- 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"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *HardState) Reset() { *m = HardState{} }
- func (m *HardState) String() string { return proto.CompactTextString(m) }
- func (*HardState) ProtoMessage() {}
- type ConfState struct {
- Nodes []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes,omitempty"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *ConfState) Reset() { *m = ConfState{} }
- func (m *ConfState) String() string { return proto.CompactTextString(m) }
- func (*ConfState) ProtoMessage() {}
- type ConfChange struct {
- ID uint64 `protobuf:"varint,1,opt" json:"ID"`
- Type ConfChangeType `protobuf:"varint,2,opt,enum=raftpb.ConfChangeType" json:"Type"`
- NodeID uint64 `protobuf:"varint,3,opt" json:"NodeID"`
- Context []byte `protobuf:"bytes,4,opt" json:"Context,omitempty"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *ConfChange) Reset() { *m = ConfChange{} }
- func (m *ConfChange) String() string { return proto.CompactTextString(m) }
- func (*ConfChange) ProtoMessage() {}
- func init() {
- proto.RegisterEnum("raftpb.EntryType", EntryType_name, EntryType_value)
- proto.RegisterEnum("raftpb.MessageType", MessageType_name, MessageType_value)
- proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value)
- }
- func (m *Entry) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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)
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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 iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Data = append([]byte{}, data[iNdEx:postIndex]...)
- iNdEx = postIndex
- default:
- var sizeOfWire int
- for {
- sizeOfWire++
- wire >>= 7
- if wire == 0 {
- break
- }
- }
- iNdEx -= sizeOfWire
- skippy, err := skipRaft(data[iNdEx:])
- if err != nil {
- return err
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
- return nil
- }
- func (m *SnapshotMetadata) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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)
- 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 iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- postIndex := iNdEx + msglen
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Term |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- var sizeOfWire int
- for {
- sizeOfWire++
- wire >>= 7
- if wire == 0 {
- break
- }
- }
- iNdEx -= sizeOfWire
- skippy, err := skipRaft(data[iNdEx:])
- if err != nil {
- return err
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
- return nil
- }
- func (m *Snapshot) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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)
- 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 iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Data = append([]byte{}, data[iNdEx:postIndex]...)
- 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 iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if err := m.Metadata.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- var sizeOfWire int
- for {
- sizeOfWire++
- wire >>= 7
- if wire == 0 {
- break
- }
- }
- iNdEx -= sizeOfWire
- skippy, err := skipRaft(data[iNdEx:])
- if err != nil {
- return err
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
- return nil
- }
- func (m *Message) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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)
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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 iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- postIndex := iNdEx + msglen
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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 iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- 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 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)
- }
- for shift := uint(0); ; shift += 7 {
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.RejectHint |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- var sizeOfWire int
- for {
- sizeOfWire++
- wire >>= 7
- if wire == 0 {
- break
- }
- }
- iNdEx -= sizeOfWire
- skippy, err := skipRaft(data[iNdEx:])
- if err != nil {
- return err
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
- return nil
- }
- func (m *HardState) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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)
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Commit |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- var sizeOfWire int
- for {
- sizeOfWire++
- wire >>= 7
- if wire == 0 {
- break
- }
- }
- iNdEx -= sizeOfWire
- skippy, err := skipRaft(data[iNdEx:])
- if err != nil {
- return err
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
- return nil
- }
- func (m *ConfState) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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)
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Nodes", wireType)
- }
- var v uint64
- for shift := uint(0); ; shift += 7 {
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Nodes = append(m.Nodes, v)
- default:
- var sizeOfWire int
- for {
- sizeOfWire++
- wire >>= 7
- if wire == 0 {
- break
- }
- }
- iNdEx -= sizeOfWire
- skippy, err := skipRaft(data[iNdEx:])
- if err != nil {
- return err
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
- return nil
- }
- func (m *ConfChange) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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)
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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)
- }
- for shift := uint(0); ; shift += 7 {
- 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 iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Context = append([]byte{}, data[iNdEx:postIndex]...)
- iNdEx = postIndex
- default:
- var sizeOfWire int
- for {
- sizeOfWire++
- wire >>= 7
- if wire == 0 {
- break
- }
- }
- iNdEx -= sizeOfWire
- skippy, err := skipRaft(data[iNdEx:])
- if err != nil {
- return err
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
- return nil
- }
- func skipRaft(data []byte) (n int, err error) {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- 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 {
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if data[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- iNdEx += length
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := skipRaft(data[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
- }
- func (m *Entry) Size() (n int) {
- 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))
- }
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
- }
- func (m *SnapshotMetadata) Size() (n int) {
- 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))
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
- }
- func (m *Snapshot) Size() (n int) {
- 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))
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
- }
- func (m *Message) Size() (n int) {
- 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))
- l = m.Snapshot.Size()
- n += 1 + l + sovRaft(uint64(l))
- n += 2
- n += 1 + sovRaft(uint64(m.RejectHint))
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
- }
- func (m *HardState) Size() (n int) {
- var l int
- _ = l
- n += 1 + sovRaft(uint64(m.Term))
- n += 1 + sovRaft(uint64(m.Vote))
- n += 1 + sovRaft(uint64(m.Commit))
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
- }
- func (m *ConfState) Size() (n int) {
- var l int
- _ = l
- if len(m.Nodes) > 0 {
- for _, e := range m.Nodes {
- n += 1 + sovRaft(uint64(e))
- }
- }
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
- }
- func (m *ConfChange) Size() (n int) {
- 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))
- }
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
- }
- func sovRaft(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
- }
- func sozRaft(x uint64) (n int) {
- return sovRaft(uint64((x << 1) ^ uint64((int64(x) >> 63))))
- }
- func (m *Entry) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
- }
- func (m *Entry) MarshalTo(data []byte) (n int, err error) {
- var i int
- _ = i
- var l int
- _ = l
- data[i] = 0x8
- i++
- i = encodeVarintRaft(data, i, uint64(m.Type))
- data[i] = 0x10
- i++
- i = encodeVarintRaft(data, i, uint64(m.Term))
- data[i] = 0x18
- i++
- i = encodeVarintRaft(data, i, uint64(m.Index))
- if m.Data != nil {
- data[i] = 0x22
- i++
- i = encodeVarintRaft(data, i, uint64(len(m.Data)))
- i += copy(data[i:], m.Data)
- }
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
- }
- func (m *SnapshotMetadata) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
- }
- func (m *SnapshotMetadata) MarshalTo(data []byte) (n int, err error) {
- var i int
- _ = i
- var l int
- _ = l
- data[i] = 0xa
- i++
- i = encodeVarintRaft(data, i, uint64(m.ConfState.Size()))
- n1, err := m.ConfState.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n1
- data[i] = 0x10
- i++
- i = encodeVarintRaft(data, i, uint64(m.Index))
- data[i] = 0x18
- i++
- i = encodeVarintRaft(data, i, uint64(m.Term))
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
- }
- func (m *Snapshot) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
- }
- func (m *Snapshot) MarshalTo(data []byte) (n int, err error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Data != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRaft(data, i, uint64(len(m.Data)))
- i += copy(data[i:], m.Data)
- }
- data[i] = 0x12
- i++
- i = encodeVarintRaft(data, i, uint64(m.Metadata.Size()))
- n2, err := m.Metadata.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n2
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
- }
- func (m *Message) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
- }
- func (m *Message) MarshalTo(data []byte) (n int, err error) {
- var i int
- _ = i
- var l int
- _ = l
- data[i] = 0x8
- i++
- i = encodeVarintRaft(data, i, uint64(m.Type))
- data[i] = 0x10
- i++
- i = encodeVarintRaft(data, i, uint64(m.To))
- data[i] = 0x18
- i++
- i = encodeVarintRaft(data, i, uint64(m.From))
- data[i] = 0x20
- i++
- i = encodeVarintRaft(data, i, uint64(m.Term))
- data[i] = 0x28
- i++
- i = encodeVarintRaft(data, i, uint64(m.LogTerm))
- data[i] = 0x30
- i++
- i = encodeVarintRaft(data, i, uint64(m.Index))
- if len(m.Entries) > 0 {
- for _, msg := range m.Entries {
- data[i] = 0x3a
- i++
- i = encodeVarintRaft(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- data[i] = 0x40
- i++
- i = encodeVarintRaft(data, i, uint64(m.Commit))
- data[i] = 0x4a
- i++
- i = encodeVarintRaft(data, i, uint64(m.Snapshot.Size()))
- n3, err := m.Snapshot.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n3
- data[i] = 0x50
- i++
- if m.Reject {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- data[i] = 0x58
- i++
- i = encodeVarintRaft(data, i, uint64(m.RejectHint))
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
- }
- func (m *HardState) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
- }
- func (m *HardState) MarshalTo(data []byte) (n int, err error) {
- var i int
- _ = i
- var l int
- _ = l
- data[i] = 0x8
- i++
- i = encodeVarintRaft(data, i, uint64(m.Term))
- data[i] = 0x10
- i++
- i = encodeVarintRaft(data, i, uint64(m.Vote))
- data[i] = 0x18
- i++
- i = encodeVarintRaft(data, i, uint64(m.Commit))
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
- }
- func (m *ConfState) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
- }
- func (m *ConfState) MarshalTo(data []byte) (n int, err error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Nodes) > 0 {
- for _, num := range m.Nodes {
- data[i] = 0x8
- i++
- i = encodeVarintRaft(data, i, uint64(num))
- }
- }
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
- }
- func (m *ConfChange) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
- }
- func (m *ConfChange) MarshalTo(data []byte) (n int, err error) {
- var i int
- _ = i
- var l int
- _ = l
- data[i] = 0x8
- i++
- i = encodeVarintRaft(data, i, uint64(m.ID))
- data[i] = 0x10
- i++
- i = encodeVarintRaft(data, i, uint64(m.Type))
- data[i] = 0x18
- i++
- i = encodeVarintRaft(data, i, uint64(m.NodeID))
- if m.Context != nil {
- data[i] = 0x22
- i++
- i = encodeVarintRaft(data, i, uint64(len(m.Context)))
- i += copy(data[i:], m.Context)
- }
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
- }
- func encodeFixed64Raft(data []byte, offset int, v uint64) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- data[offset+4] = uint8(v >> 32)
- data[offset+5] = uint8(v >> 40)
- data[offset+6] = uint8(v >> 48)
- data[offset+7] = uint8(v >> 56)
- return offset + 8
- }
- func encodeFixed32Raft(data []byte, offset int, v uint32) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- return offset + 4
- }
- func encodeVarintRaft(data []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- data[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- data[offset] = uint8(v)
- return offset + 1
- }
|