raft.pb.go 57 KB

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