rpc.pb.go 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972
  1. // Code generated by protoc-gen-gogo.
  2. // source: rpc.proto
  3. // DO NOT EDIT!
  4. package etcdserverpb
  5. import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
  6. // discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
  7. import storagepb "github.com/coreos/etcd/storage/storagepb"
  8. import io "io"
  9. import fmt "fmt"
  10. import (
  11. context "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
  12. grpc "github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc"
  13. )
  14. // Reference imports to suppress errors if they are not otherwise used.
  15. var _ context.Context
  16. var _ grpc.ClientConn
  17. // Reference imports to suppress errors if they are not otherwise used.
  18. var _ = proto.Marshal
  19. type Compare_CompareResult int32
  20. const (
  21. Compare_EQUAL Compare_CompareResult = 0
  22. Compare_GREATER Compare_CompareResult = 1
  23. Compare_LESS Compare_CompareResult = 2
  24. )
  25. var Compare_CompareResult_name = map[int32]string{
  26. 0: "EQUAL",
  27. 1: "GREATER",
  28. 2: "LESS",
  29. }
  30. var Compare_CompareResult_value = map[string]int32{
  31. "EQUAL": 0,
  32. "GREATER": 1,
  33. "LESS": 2,
  34. }
  35. func (x Compare_CompareResult) String() string {
  36. return proto.EnumName(Compare_CompareResult_name, int32(x))
  37. }
  38. type Compare_CompareTarget int32
  39. const (
  40. Compare_VERSION Compare_CompareTarget = 0
  41. Compare_CREATE Compare_CompareTarget = 1
  42. Compare_MOD Compare_CompareTarget = 2
  43. Compare_VALUE Compare_CompareTarget = 3
  44. )
  45. var Compare_CompareTarget_name = map[int32]string{
  46. 0: "VERSION",
  47. 1: "CREATE",
  48. 2: "MOD",
  49. 3: "VALUE",
  50. }
  51. var Compare_CompareTarget_value = map[string]int32{
  52. "VERSION": 0,
  53. "CREATE": 1,
  54. "MOD": 2,
  55. "VALUE": 3,
  56. }
  57. func (x Compare_CompareTarget) String() string {
  58. return proto.EnumName(Compare_CompareTarget_name, int32(x))
  59. }
  60. type ResponseHeader struct {
  61. // an error type message?
  62. Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
  63. ClusterId uint64 `protobuf:"varint,2,opt,name=cluster_id,proto3" json:"cluster_id,omitempty"`
  64. MemberId uint64 `protobuf:"varint,3,opt,name=member_id,proto3" json:"member_id,omitempty"`
  65. // index of the store when the request was applied.
  66. Index int64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
  67. // term of raft when the request was applied.
  68. RaftTerm uint64 `protobuf:"varint,5,opt,name=raft_term,proto3" json:"raft_term,omitempty"`
  69. }
  70. func (m *ResponseHeader) Reset() { *m = ResponseHeader{} }
  71. func (m *ResponseHeader) String() string { return proto.CompactTextString(m) }
  72. func (*ResponseHeader) ProtoMessage() {}
  73. type RangeRequest struct {
  74. // if the range_end is not given, the request returns the key.
  75. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
  76. // if the range_end is given, it gets the keys in range [key, range_end).
  77. RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,proto3" json:"range_end,omitempty"`
  78. // limit the number of keys returned.
  79. Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
  80. // the response will be consistent with previous request with same token if the token is
  81. // given and is valid.
  82. ConsistentToken []byte `protobuf:"bytes,4,opt,name=consistent_token,proto3" json:"consistent_token,omitempty"`
  83. }
  84. func (m *RangeRequest) Reset() { *m = RangeRequest{} }
  85. func (m *RangeRequest) String() string { return proto.CompactTextString(m) }
  86. func (*RangeRequest) ProtoMessage() {}
  87. type RangeResponse struct {
  88. Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
  89. Kvs []*storagepb.KeyValue `protobuf:"bytes,2,rep,name=kvs" json:"kvs,omitempty"`
  90. ConsistentToken []byte `protobuf:"bytes,3,opt,name=consistent_token,proto3" json:"consistent_token,omitempty"`
  91. // more indicates if there are more keys to return in the requested range.
  92. More bool `protobuf:"varint,4,opt,name=more,proto3" json:"more,omitempty"`
  93. }
  94. func (m *RangeResponse) Reset() { *m = RangeResponse{} }
  95. func (m *RangeResponse) String() string { return proto.CompactTextString(m) }
  96. func (*RangeResponse) ProtoMessage() {}
  97. func (m *RangeResponse) GetHeader() *ResponseHeader {
  98. if m != nil {
  99. return m.Header
  100. }
  101. return nil
  102. }
  103. func (m *RangeResponse) GetKvs() []*storagepb.KeyValue {
  104. if m != nil {
  105. return m.Kvs
  106. }
  107. return nil
  108. }
  109. type PutRequest struct {
  110. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
  111. Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
  112. }
  113. func (m *PutRequest) Reset() { *m = PutRequest{} }
  114. func (m *PutRequest) String() string { return proto.CompactTextString(m) }
  115. func (*PutRequest) ProtoMessage() {}
  116. type PutResponse struct {
  117. Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
  118. }
  119. func (m *PutResponse) Reset() { *m = PutResponse{} }
  120. func (m *PutResponse) String() string { return proto.CompactTextString(m) }
  121. func (*PutResponse) ProtoMessage() {}
  122. func (m *PutResponse) GetHeader() *ResponseHeader {
  123. if m != nil {
  124. return m.Header
  125. }
  126. return nil
  127. }
  128. type DeleteRangeRequest struct {
  129. // if the range_end is not given, the request deletes the key.
  130. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
  131. // if the range_end is given, it deletes the keys in range [key, range_end).
  132. RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,proto3" json:"range_end,omitempty"`
  133. }
  134. func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} }
  135. func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) }
  136. func (*DeleteRangeRequest) ProtoMessage() {}
  137. type DeleteRangeResponse struct {
  138. Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
  139. }
  140. func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} }
  141. func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) }
  142. func (*DeleteRangeResponse) ProtoMessage() {}
  143. func (m *DeleteRangeResponse) GetHeader() *ResponseHeader {
  144. if m != nil {
  145. return m.Header
  146. }
  147. return nil
  148. }
  149. type RequestUnion struct {
  150. RequestRange *RangeRequest `protobuf:"bytes,1,opt,name=request_range" json:"request_range,omitempty"`
  151. RequestPut *PutRequest `protobuf:"bytes,2,opt,name=request_put" json:"request_put,omitempty"`
  152. RequestDeleteRange *DeleteRangeRequest `protobuf:"bytes,3,opt,name=request_delete_range" json:"request_delete_range,omitempty"`
  153. }
  154. func (m *RequestUnion) Reset() { *m = RequestUnion{} }
  155. func (m *RequestUnion) String() string { return proto.CompactTextString(m) }
  156. func (*RequestUnion) ProtoMessage() {}
  157. func (m *RequestUnion) GetRequestRange() *RangeRequest {
  158. if m != nil {
  159. return m.RequestRange
  160. }
  161. return nil
  162. }
  163. func (m *RequestUnion) GetRequestPut() *PutRequest {
  164. if m != nil {
  165. return m.RequestPut
  166. }
  167. return nil
  168. }
  169. func (m *RequestUnion) GetRequestDeleteRange() *DeleteRangeRequest {
  170. if m != nil {
  171. return m.RequestDeleteRange
  172. }
  173. return nil
  174. }
  175. type ResponseUnion struct {
  176. ResponseRange *RangeResponse `protobuf:"bytes,1,opt,name=response_range" json:"response_range,omitempty"`
  177. ResponsePut *PutResponse `protobuf:"bytes,2,opt,name=response_put" json:"response_put,omitempty"`
  178. ResponseDeleteRange *DeleteRangeResponse `protobuf:"bytes,3,opt,name=response_delete_range" json:"response_delete_range,omitempty"`
  179. }
  180. func (m *ResponseUnion) Reset() { *m = ResponseUnion{} }
  181. func (m *ResponseUnion) String() string { return proto.CompactTextString(m) }
  182. func (*ResponseUnion) ProtoMessage() {}
  183. func (m *ResponseUnion) GetResponseRange() *RangeResponse {
  184. if m != nil {
  185. return m.ResponseRange
  186. }
  187. return nil
  188. }
  189. func (m *ResponseUnion) GetResponsePut() *PutResponse {
  190. if m != nil {
  191. return m.ResponsePut
  192. }
  193. return nil
  194. }
  195. func (m *ResponseUnion) GetResponseDeleteRange() *DeleteRangeResponse {
  196. if m != nil {
  197. return m.ResponseDeleteRange
  198. }
  199. return nil
  200. }
  201. type Compare struct {
  202. Result Compare_CompareResult `protobuf:"varint,1,opt,name=result,proto3,enum=etcdserverpb.Compare_CompareResult" json:"result,omitempty"`
  203. Target Compare_CompareTarget `protobuf:"varint,2,opt,name=target,proto3,enum=etcdserverpb.Compare_CompareTarget" json:"target,omitempty"`
  204. // key path
  205. Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
  206. // version of the given key
  207. Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
  208. // create index of the given key
  209. CreateIndex int64 `protobuf:"varint,5,opt,name=create_index,proto3" json:"create_index,omitempty"`
  210. // last modified index of the given key
  211. ModIndex int64 `protobuf:"varint,6,opt,name=mod_index,proto3" json:"mod_index,omitempty"`
  212. // value of the given key
  213. Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
  214. }
  215. func (m *Compare) Reset() { *m = Compare{} }
  216. func (m *Compare) String() string { return proto.CompactTextString(m) }
  217. func (*Compare) ProtoMessage() {}
  218. // From google paxosdb paper:
  219. // Our implementation hinges around a powerful primitive which we call MultiOp. All other database
  220. // operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically
  221. // and consists of three components:
  222. // 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check
  223. // for the absence or presence of a value, or compare with a given value. Two different tests in the guard
  224. // may apply to the same or different entries in the database. All tests in the guard are applied and
  225. // MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise
  226. // it executes f op (see item 3 below).
  227. // 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or
  228. // lookup operation, and applies to a single database entry. Two different operations in the list may apply
  229. // to the same or different entries in the database. These operations are executed
  230. // if guard evaluates to
  231. // true.
  232. // 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
  233. type TxnRequest struct {
  234. Compare []*Compare `protobuf:"bytes,1,rep,name=compare" json:"compare,omitempty"`
  235. Success []*RequestUnion `protobuf:"bytes,2,rep,name=success" json:"success,omitempty"`
  236. Failure []*RequestUnion `protobuf:"bytes,3,rep,name=failure" json:"failure,omitempty"`
  237. }
  238. func (m *TxnRequest) Reset() { *m = TxnRequest{} }
  239. func (m *TxnRequest) String() string { return proto.CompactTextString(m) }
  240. func (*TxnRequest) ProtoMessage() {}
  241. func (m *TxnRequest) GetCompare() []*Compare {
  242. if m != nil {
  243. return m.Compare
  244. }
  245. return nil
  246. }
  247. func (m *TxnRequest) GetSuccess() []*RequestUnion {
  248. if m != nil {
  249. return m.Success
  250. }
  251. return nil
  252. }
  253. func (m *TxnRequest) GetFailure() []*RequestUnion {
  254. if m != nil {
  255. return m.Failure
  256. }
  257. return nil
  258. }
  259. type TxnResponse struct {
  260. Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
  261. Succeeded bool `protobuf:"varint,2,opt,name=succeeded,proto3" json:"succeeded,omitempty"`
  262. Responses []*ResponseUnion `protobuf:"bytes,3,rep,name=responses" json:"responses,omitempty"`
  263. }
  264. func (m *TxnResponse) Reset() { *m = TxnResponse{} }
  265. func (m *TxnResponse) String() string { return proto.CompactTextString(m) }
  266. func (*TxnResponse) ProtoMessage() {}
  267. func (m *TxnResponse) GetHeader() *ResponseHeader {
  268. if m != nil {
  269. return m.Header
  270. }
  271. return nil
  272. }
  273. func (m *TxnResponse) GetResponses() []*ResponseUnion {
  274. if m != nil {
  275. return m.Responses
  276. }
  277. return nil
  278. }
  279. // Compaction compacts the kv store upto the given index (including).
  280. // It removes the old versions of a key. It keeps the newest version of
  281. // the key even if its latest modification index is smaller than the given
  282. // index.
  283. type CompactionRequest struct {
  284. Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
  285. }
  286. func (m *CompactionRequest) Reset() { *m = CompactionRequest{} }
  287. func (m *CompactionRequest) String() string { return proto.CompactTextString(m) }
  288. func (*CompactionRequest) ProtoMessage() {}
  289. type CompactionResponse struct {
  290. Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
  291. }
  292. func (m *CompactionResponse) Reset() { *m = CompactionResponse{} }
  293. func (m *CompactionResponse) String() string { return proto.CompactTextString(m) }
  294. func (*CompactionResponse) ProtoMessage() {}
  295. func (m *CompactionResponse) GetHeader() *ResponseHeader {
  296. if m != nil {
  297. return m.Header
  298. }
  299. return nil
  300. }
  301. func init() {
  302. proto.RegisterEnum("etcdserverpb.Compare_CompareResult", Compare_CompareResult_name, Compare_CompareResult_value)
  303. proto.RegisterEnum("etcdserverpb.Compare_CompareTarget", Compare_CompareTarget_name, Compare_CompareTarget_value)
  304. }
  305. func (m *ResponseHeader) Unmarshal(data []byte) error {
  306. l := len(data)
  307. iNdEx := 0
  308. for iNdEx < l {
  309. var wire uint64
  310. for shift := uint(0); ; shift += 7 {
  311. if iNdEx >= l {
  312. return io.ErrUnexpectedEOF
  313. }
  314. b := data[iNdEx]
  315. iNdEx++
  316. wire |= (uint64(b) & 0x7F) << shift
  317. if b < 0x80 {
  318. break
  319. }
  320. }
  321. fieldNum := int32(wire >> 3)
  322. wireType := int(wire & 0x7)
  323. switch fieldNum {
  324. case 1:
  325. if wireType != 2 {
  326. return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType)
  327. }
  328. var stringLen uint64
  329. for shift := uint(0); ; shift += 7 {
  330. if iNdEx >= l {
  331. return io.ErrUnexpectedEOF
  332. }
  333. b := data[iNdEx]
  334. iNdEx++
  335. stringLen |= (uint64(b) & 0x7F) << shift
  336. if b < 0x80 {
  337. break
  338. }
  339. }
  340. postIndex := iNdEx + int(stringLen)
  341. if postIndex > l {
  342. return io.ErrUnexpectedEOF
  343. }
  344. m.Error = string(data[iNdEx:postIndex])
  345. iNdEx = postIndex
  346. case 2:
  347. if wireType != 0 {
  348. return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType)
  349. }
  350. for shift := uint(0); ; shift += 7 {
  351. if iNdEx >= l {
  352. return io.ErrUnexpectedEOF
  353. }
  354. b := data[iNdEx]
  355. iNdEx++
  356. m.ClusterId |= (uint64(b) & 0x7F) << shift
  357. if b < 0x80 {
  358. break
  359. }
  360. }
  361. case 3:
  362. if wireType != 0 {
  363. return fmt.Errorf("proto: wrong wireType = %d for field MemberId", wireType)
  364. }
  365. for shift := uint(0); ; shift += 7 {
  366. if iNdEx >= l {
  367. return io.ErrUnexpectedEOF
  368. }
  369. b := data[iNdEx]
  370. iNdEx++
  371. m.MemberId |= (uint64(b) & 0x7F) << shift
  372. if b < 0x80 {
  373. break
  374. }
  375. }
  376. case 4:
  377. if wireType != 0 {
  378. return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
  379. }
  380. for shift := uint(0); ; shift += 7 {
  381. if iNdEx >= l {
  382. return io.ErrUnexpectedEOF
  383. }
  384. b := data[iNdEx]
  385. iNdEx++
  386. m.Index |= (int64(b) & 0x7F) << shift
  387. if b < 0x80 {
  388. break
  389. }
  390. }
  391. case 5:
  392. if wireType != 0 {
  393. return fmt.Errorf("proto: wrong wireType = %d for field RaftTerm", wireType)
  394. }
  395. for shift := uint(0); ; shift += 7 {
  396. if iNdEx >= l {
  397. return io.ErrUnexpectedEOF
  398. }
  399. b := data[iNdEx]
  400. iNdEx++
  401. m.RaftTerm |= (uint64(b) & 0x7F) << shift
  402. if b < 0x80 {
  403. break
  404. }
  405. }
  406. default:
  407. var sizeOfWire int
  408. for {
  409. sizeOfWire++
  410. wire >>= 7
  411. if wire == 0 {
  412. break
  413. }
  414. }
  415. iNdEx -= sizeOfWire
  416. skippy, err := skipRpc(data[iNdEx:])
  417. if err != nil {
  418. return err
  419. }
  420. if (iNdEx + skippy) > l {
  421. return io.ErrUnexpectedEOF
  422. }
  423. iNdEx += skippy
  424. }
  425. }
  426. return nil
  427. }
  428. func (m *RangeRequest) Unmarshal(data []byte) error {
  429. l := len(data)
  430. iNdEx := 0
  431. for iNdEx < l {
  432. var wire uint64
  433. for shift := uint(0); ; shift += 7 {
  434. if iNdEx >= l {
  435. return io.ErrUnexpectedEOF
  436. }
  437. b := data[iNdEx]
  438. iNdEx++
  439. wire |= (uint64(b) & 0x7F) << shift
  440. if b < 0x80 {
  441. break
  442. }
  443. }
  444. fieldNum := int32(wire >> 3)
  445. wireType := int(wire & 0x7)
  446. switch fieldNum {
  447. case 1:
  448. if wireType != 2 {
  449. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  450. }
  451. var byteLen int
  452. for shift := uint(0); ; shift += 7 {
  453. if iNdEx >= l {
  454. return io.ErrUnexpectedEOF
  455. }
  456. b := data[iNdEx]
  457. iNdEx++
  458. byteLen |= (int(b) & 0x7F) << shift
  459. if b < 0x80 {
  460. break
  461. }
  462. }
  463. postIndex := iNdEx + byteLen
  464. if postIndex > l {
  465. return io.ErrUnexpectedEOF
  466. }
  467. m.Key = append([]byte{}, data[iNdEx:postIndex]...)
  468. iNdEx = postIndex
  469. case 2:
  470. if wireType != 2 {
  471. return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
  472. }
  473. var byteLen int
  474. for shift := uint(0); ; shift += 7 {
  475. if iNdEx >= l {
  476. return io.ErrUnexpectedEOF
  477. }
  478. b := data[iNdEx]
  479. iNdEx++
  480. byteLen |= (int(b) & 0x7F) << shift
  481. if b < 0x80 {
  482. break
  483. }
  484. }
  485. postIndex := iNdEx + byteLen
  486. if postIndex > l {
  487. return io.ErrUnexpectedEOF
  488. }
  489. m.RangeEnd = append([]byte{}, data[iNdEx:postIndex]...)
  490. iNdEx = postIndex
  491. case 3:
  492. if wireType != 0 {
  493. return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType)
  494. }
  495. for shift := uint(0); ; shift += 7 {
  496. if iNdEx >= l {
  497. return io.ErrUnexpectedEOF
  498. }
  499. b := data[iNdEx]
  500. iNdEx++
  501. m.Limit |= (int64(b) & 0x7F) << shift
  502. if b < 0x80 {
  503. break
  504. }
  505. }
  506. case 4:
  507. if wireType != 2 {
  508. return fmt.Errorf("proto: wrong wireType = %d for field ConsistentToken", wireType)
  509. }
  510. var byteLen int
  511. for shift := uint(0); ; shift += 7 {
  512. if iNdEx >= l {
  513. return io.ErrUnexpectedEOF
  514. }
  515. b := data[iNdEx]
  516. iNdEx++
  517. byteLen |= (int(b) & 0x7F) << shift
  518. if b < 0x80 {
  519. break
  520. }
  521. }
  522. postIndex := iNdEx + byteLen
  523. if postIndex > l {
  524. return io.ErrUnexpectedEOF
  525. }
  526. m.ConsistentToken = append([]byte{}, data[iNdEx:postIndex]...)
  527. iNdEx = postIndex
  528. default:
  529. var sizeOfWire int
  530. for {
  531. sizeOfWire++
  532. wire >>= 7
  533. if wire == 0 {
  534. break
  535. }
  536. }
  537. iNdEx -= sizeOfWire
  538. skippy, err := skipRpc(data[iNdEx:])
  539. if err != nil {
  540. return err
  541. }
  542. if (iNdEx + skippy) > l {
  543. return io.ErrUnexpectedEOF
  544. }
  545. iNdEx += skippy
  546. }
  547. }
  548. return nil
  549. }
  550. func (m *RangeResponse) Unmarshal(data []byte) error {
  551. l := len(data)
  552. iNdEx := 0
  553. for iNdEx < l {
  554. var wire uint64
  555. for shift := uint(0); ; shift += 7 {
  556. if iNdEx >= l {
  557. return io.ErrUnexpectedEOF
  558. }
  559. b := data[iNdEx]
  560. iNdEx++
  561. wire |= (uint64(b) & 0x7F) << shift
  562. if b < 0x80 {
  563. break
  564. }
  565. }
  566. fieldNum := int32(wire >> 3)
  567. wireType := int(wire & 0x7)
  568. switch fieldNum {
  569. case 1:
  570. if wireType != 2 {
  571. return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
  572. }
  573. var msglen int
  574. for shift := uint(0); ; shift += 7 {
  575. if iNdEx >= l {
  576. return io.ErrUnexpectedEOF
  577. }
  578. b := data[iNdEx]
  579. iNdEx++
  580. msglen |= (int(b) & 0x7F) << shift
  581. if b < 0x80 {
  582. break
  583. }
  584. }
  585. postIndex := iNdEx + msglen
  586. if postIndex > l {
  587. return io.ErrUnexpectedEOF
  588. }
  589. if m.Header == nil {
  590. m.Header = &ResponseHeader{}
  591. }
  592. if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
  593. return err
  594. }
  595. iNdEx = postIndex
  596. case 2:
  597. if wireType != 2 {
  598. return fmt.Errorf("proto: wrong wireType = %d for field Kvs", wireType)
  599. }
  600. var msglen int
  601. for shift := uint(0); ; shift += 7 {
  602. if iNdEx >= l {
  603. return io.ErrUnexpectedEOF
  604. }
  605. b := data[iNdEx]
  606. iNdEx++
  607. msglen |= (int(b) & 0x7F) << shift
  608. if b < 0x80 {
  609. break
  610. }
  611. }
  612. postIndex := iNdEx + msglen
  613. if postIndex > l {
  614. return io.ErrUnexpectedEOF
  615. }
  616. m.Kvs = append(m.Kvs, &storagepb.KeyValue{})
  617. if err := m.Kvs[len(m.Kvs)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  618. return err
  619. }
  620. iNdEx = postIndex
  621. case 3:
  622. if wireType != 2 {
  623. return fmt.Errorf("proto: wrong wireType = %d for field ConsistentToken", wireType)
  624. }
  625. var byteLen int
  626. for shift := uint(0); ; shift += 7 {
  627. if iNdEx >= l {
  628. return io.ErrUnexpectedEOF
  629. }
  630. b := data[iNdEx]
  631. iNdEx++
  632. byteLen |= (int(b) & 0x7F) << shift
  633. if b < 0x80 {
  634. break
  635. }
  636. }
  637. postIndex := iNdEx + byteLen
  638. if postIndex > l {
  639. return io.ErrUnexpectedEOF
  640. }
  641. m.ConsistentToken = append([]byte{}, data[iNdEx:postIndex]...)
  642. iNdEx = postIndex
  643. case 4:
  644. if wireType != 0 {
  645. return fmt.Errorf("proto: wrong wireType = %d for field More", wireType)
  646. }
  647. var v int
  648. for shift := uint(0); ; shift += 7 {
  649. if iNdEx >= l {
  650. return io.ErrUnexpectedEOF
  651. }
  652. b := data[iNdEx]
  653. iNdEx++
  654. v |= (int(b) & 0x7F) << shift
  655. if b < 0x80 {
  656. break
  657. }
  658. }
  659. m.More = bool(v != 0)
  660. default:
  661. var sizeOfWire int
  662. for {
  663. sizeOfWire++
  664. wire >>= 7
  665. if wire == 0 {
  666. break
  667. }
  668. }
  669. iNdEx -= sizeOfWire
  670. skippy, err := skipRpc(data[iNdEx:])
  671. if err != nil {
  672. return err
  673. }
  674. if (iNdEx + skippy) > l {
  675. return io.ErrUnexpectedEOF
  676. }
  677. iNdEx += skippy
  678. }
  679. }
  680. return nil
  681. }
  682. func (m *PutRequest) Unmarshal(data []byte) error {
  683. l := len(data)
  684. iNdEx := 0
  685. for iNdEx < l {
  686. var wire uint64
  687. for shift := uint(0); ; shift += 7 {
  688. if iNdEx >= l {
  689. return io.ErrUnexpectedEOF
  690. }
  691. b := data[iNdEx]
  692. iNdEx++
  693. wire |= (uint64(b) & 0x7F) << shift
  694. if b < 0x80 {
  695. break
  696. }
  697. }
  698. fieldNum := int32(wire >> 3)
  699. wireType := int(wire & 0x7)
  700. switch fieldNum {
  701. case 1:
  702. if wireType != 2 {
  703. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  704. }
  705. var byteLen int
  706. for shift := uint(0); ; shift += 7 {
  707. if iNdEx >= l {
  708. return io.ErrUnexpectedEOF
  709. }
  710. b := data[iNdEx]
  711. iNdEx++
  712. byteLen |= (int(b) & 0x7F) << shift
  713. if b < 0x80 {
  714. break
  715. }
  716. }
  717. postIndex := iNdEx + byteLen
  718. if postIndex > l {
  719. return io.ErrUnexpectedEOF
  720. }
  721. m.Key = append([]byte{}, data[iNdEx:postIndex]...)
  722. iNdEx = postIndex
  723. case 2:
  724. if wireType != 2 {
  725. return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
  726. }
  727. var byteLen int
  728. for shift := uint(0); ; shift += 7 {
  729. if iNdEx >= l {
  730. return io.ErrUnexpectedEOF
  731. }
  732. b := data[iNdEx]
  733. iNdEx++
  734. byteLen |= (int(b) & 0x7F) << shift
  735. if b < 0x80 {
  736. break
  737. }
  738. }
  739. postIndex := iNdEx + byteLen
  740. if postIndex > l {
  741. return io.ErrUnexpectedEOF
  742. }
  743. m.Value = append([]byte{}, data[iNdEx:postIndex]...)
  744. iNdEx = postIndex
  745. default:
  746. var sizeOfWire int
  747. for {
  748. sizeOfWire++
  749. wire >>= 7
  750. if wire == 0 {
  751. break
  752. }
  753. }
  754. iNdEx -= sizeOfWire
  755. skippy, err := skipRpc(data[iNdEx:])
  756. if err != nil {
  757. return err
  758. }
  759. if (iNdEx + skippy) > l {
  760. return io.ErrUnexpectedEOF
  761. }
  762. iNdEx += skippy
  763. }
  764. }
  765. return nil
  766. }
  767. func (m *PutResponse) Unmarshal(data []byte) error {
  768. l := len(data)
  769. iNdEx := 0
  770. for iNdEx < l {
  771. var wire uint64
  772. for shift := uint(0); ; shift += 7 {
  773. if iNdEx >= l {
  774. return io.ErrUnexpectedEOF
  775. }
  776. b := data[iNdEx]
  777. iNdEx++
  778. wire |= (uint64(b) & 0x7F) << shift
  779. if b < 0x80 {
  780. break
  781. }
  782. }
  783. fieldNum := int32(wire >> 3)
  784. wireType := int(wire & 0x7)
  785. switch fieldNum {
  786. case 1:
  787. if wireType != 2 {
  788. return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
  789. }
  790. var msglen int
  791. for shift := uint(0); ; shift += 7 {
  792. if iNdEx >= l {
  793. return io.ErrUnexpectedEOF
  794. }
  795. b := data[iNdEx]
  796. iNdEx++
  797. msglen |= (int(b) & 0x7F) << shift
  798. if b < 0x80 {
  799. break
  800. }
  801. }
  802. postIndex := iNdEx + msglen
  803. if postIndex > l {
  804. return io.ErrUnexpectedEOF
  805. }
  806. if m.Header == nil {
  807. m.Header = &ResponseHeader{}
  808. }
  809. if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
  810. return err
  811. }
  812. iNdEx = postIndex
  813. default:
  814. var sizeOfWire int
  815. for {
  816. sizeOfWire++
  817. wire >>= 7
  818. if wire == 0 {
  819. break
  820. }
  821. }
  822. iNdEx -= sizeOfWire
  823. skippy, err := skipRpc(data[iNdEx:])
  824. if err != nil {
  825. return err
  826. }
  827. if (iNdEx + skippy) > l {
  828. return io.ErrUnexpectedEOF
  829. }
  830. iNdEx += skippy
  831. }
  832. }
  833. return nil
  834. }
  835. func (m *DeleteRangeRequest) Unmarshal(data []byte) error {
  836. l := len(data)
  837. iNdEx := 0
  838. for iNdEx < l {
  839. var wire uint64
  840. for shift := uint(0); ; shift += 7 {
  841. if iNdEx >= l {
  842. return io.ErrUnexpectedEOF
  843. }
  844. b := data[iNdEx]
  845. iNdEx++
  846. wire |= (uint64(b) & 0x7F) << shift
  847. if b < 0x80 {
  848. break
  849. }
  850. }
  851. fieldNum := int32(wire >> 3)
  852. wireType := int(wire & 0x7)
  853. switch fieldNum {
  854. case 1:
  855. if wireType != 2 {
  856. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  857. }
  858. var byteLen int
  859. for shift := uint(0); ; shift += 7 {
  860. if iNdEx >= l {
  861. return io.ErrUnexpectedEOF
  862. }
  863. b := data[iNdEx]
  864. iNdEx++
  865. byteLen |= (int(b) & 0x7F) << shift
  866. if b < 0x80 {
  867. break
  868. }
  869. }
  870. postIndex := iNdEx + byteLen
  871. if postIndex > l {
  872. return io.ErrUnexpectedEOF
  873. }
  874. m.Key = append([]byte{}, data[iNdEx:postIndex]...)
  875. iNdEx = postIndex
  876. case 2:
  877. if wireType != 2 {
  878. return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
  879. }
  880. var byteLen int
  881. for shift := uint(0); ; shift += 7 {
  882. if iNdEx >= l {
  883. return io.ErrUnexpectedEOF
  884. }
  885. b := data[iNdEx]
  886. iNdEx++
  887. byteLen |= (int(b) & 0x7F) << shift
  888. if b < 0x80 {
  889. break
  890. }
  891. }
  892. postIndex := iNdEx + byteLen
  893. if postIndex > l {
  894. return io.ErrUnexpectedEOF
  895. }
  896. m.RangeEnd = append([]byte{}, data[iNdEx:postIndex]...)
  897. iNdEx = postIndex
  898. default:
  899. var sizeOfWire int
  900. for {
  901. sizeOfWire++
  902. wire >>= 7
  903. if wire == 0 {
  904. break
  905. }
  906. }
  907. iNdEx -= sizeOfWire
  908. skippy, err := skipRpc(data[iNdEx:])
  909. if err != nil {
  910. return err
  911. }
  912. if (iNdEx + skippy) > l {
  913. return io.ErrUnexpectedEOF
  914. }
  915. iNdEx += skippy
  916. }
  917. }
  918. return nil
  919. }
  920. func (m *DeleteRangeResponse) Unmarshal(data []byte) error {
  921. l := len(data)
  922. iNdEx := 0
  923. for iNdEx < l {
  924. var wire uint64
  925. for shift := uint(0); ; shift += 7 {
  926. if iNdEx >= l {
  927. return io.ErrUnexpectedEOF
  928. }
  929. b := data[iNdEx]
  930. iNdEx++
  931. wire |= (uint64(b) & 0x7F) << shift
  932. if b < 0x80 {
  933. break
  934. }
  935. }
  936. fieldNum := int32(wire >> 3)
  937. wireType := int(wire & 0x7)
  938. switch fieldNum {
  939. case 1:
  940. if wireType != 2 {
  941. return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
  942. }
  943. var msglen int
  944. for shift := uint(0); ; shift += 7 {
  945. if iNdEx >= l {
  946. return io.ErrUnexpectedEOF
  947. }
  948. b := data[iNdEx]
  949. iNdEx++
  950. msglen |= (int(b) & 0x7F) << shift
  951. if b < 0x80 {
  952. break
  953. }
  954. }
  955. postIndex := iNdEx + msglen
  956. if postIndex > l {
  957. return io.ErrUnexpectedEOF
  958. }
  959. if m.Header == nil {
  960. m.Header = &ResponseHeader{}
  961. }
  962. if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
  963. return err
  964. }
  965. iNdEx = postIndex
  966. default:
  967. var sizeOfWire int
  968. for {
  969. sizeOfWire++
  970. wire >>= 7
  971. if wire == 0 {
  972. break
  973. }
  974. }
  975. iNdEx -= sizeOfWire
  976. skippy, err := skipRpc(data[iNdEx:])
  977. if err != nil {
  978. return err
  979. }
  980. if (iNdEx + skippy) > l {
  981. return io.ErrUnexpectedEOF
  982. }
  983. iNdEx += skippy
  984. }
  985. }
  986. return nil
  987. }
  988. func (m *RequestUnion) Unmarshal(data []byte) error {
  989. l := len(data)
  990. iNdEx := 0
  991. for iNdEx < l {
  992. var wire uint64
  993. for shift := uint(0); ; shift += 7 {
  994. if iNdEx >= l {
  995. return io.ErrUnexpectedEOF
  996. }
  997. b := data[iNdEx]
  998. iNdEx++
  999. wire |= (uint64(b) & 0x7F) << shift
  1000. if b < 0x80 {
  1001. break
  1002. }
  1003. }
  1004. fieldNum := int32(wire >> 3)
  1005. wireType := int(wire & 0x7)
  1006. switch fieldNum {
  1007. case 1:
  1008. if wireType != 2 {
  1009. return fmt.Errorf("proto: wrong wireType = %d for field RequestRange", wireType)
  1010. }
  1011. var msglen int
  1012. for shift := uint(0); ; shift += 7 {
  1013. if iNdEx >= l {
  1014. return io.ErrUnexpectedEOF
  1015. }
  1016. b := data[iNdEx]
  1017. iNdEx++
  1018. msglen |= (int(b) & 0x7F) << shift
  1019. if b < 0x80 {
  1020. break
  1021. }
  1022. }
  1023. postIndex := iNdEx + msglen
  1024. if postIndex > l {
  1025. return io.ErrUnexpectedEOF
  1026. }
  1027. if m.RequestRange == nil {
  1028. m.RequestRange = &RangeRequest{}
  1029. }
  1030. if err := m.RequestRange.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1031. return err
  1032. }
  1033. iNdEx = postIndex
  1034. case 2:
  1035. if wireType != 2 {
  1036. return fmt.Errorf("proto: wrong wireType = %d for field RequestPut", wireType)
  1037. }
  1038. var msglen int
  1039. for shift := uint(0); ; shift += 7 {
  1040. if iNdEx >= l {
  1041. return io.ErrUnexpectedEOF
  1042. }
  1043. b := data[iNdEx]
  1044. iNdEx++
  1045. msglen |= (int(b) & 0x7F) << shift
  1046. if b < 0x80 {
  1047. break
  1048. }
  1049. }
  1050. postIndex := iNdEx + msglen
  1051. if postIndex > l {
  1052. return io.ErrUnexpectedEOF
  1053. }
  1054. if m.RequestPut == nil {
  1055. m.RequestPut = &PutRequest{}
  1056. }
  1057. if err := m.RequestPut.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1058. return err
  1059. }
  1060. iNdEx = postIndex
  1061. case 3:
  1062. if wireType != 2 {
  1063. return fmt.Errorf("proto: wrong wireType = %d for field RequestDeleteRange", wireType)
  1064. }
  1065. var msglen int
  1066. for shift := uint(0); ; shift += 7 {
  1067. if iNdEx >= l {
  1068. return io.ErrUnexpectedEOF
  1069. }
  1070. b := data[iNdEx]
  1071. iNdEx++
  1072. msglen |= (int(b) & 0x7F) << shift
  1073. if b < 0x80 {
  1074. break
  1075. }
  1076. }
  1077. postIndex := iNdEx + msglen
  1078. if postIndex > l {
  1079. return io.ErrUnexpectedEOF
  1080. }
  1081. if m.RequestDeleteRange == nil {
  1082. m.RequestDeleteRange = &DeleteRangeRequest{}
  1083. }
  1084. if err := m.RequestDeleteRange.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1085. return err
  1086. }
  1087. iNdEx = postIndex
  1088. default:
  1089. var sizeOfWire int
  1090. for {
  1091. sizeOfWire++
  1092. wire >>= 7
  1093. if wire == 0 {
  1094. break
  1095. }
  1096. }
  1097. iNdEx -= sizeOfWire
  1098. skippy, err := skipRpc(data[iNdEx:])
  1099. if err != nil {
  1100. return err
  1101. }
  1102. if (iNdEx + skippy) > l {
  1103. return io.ErrUnexpectedEOF
  1104. }
  1105. iNdEx += skippy
  1106. }
  1107. }
  1108. return nil
  1109. }
  1110. func (m *ResponseUnion) Unmarshal(data []byte) error {
  1111. l := len(data)
  1112. iNdEx := 0
  1113. for iNdEx < l {
  1114. var wire uint64
  1115. for shift := uint(0); ; shift += 7 {
  1116. if iNdEx >= l {
  1117. return io.ErrUnexpectedEOF
  1118. }
  1119. b := data[iNdEx]
  1120. iNdEx++
  1121. wire |= (uint64(b) & 0x7F) << shift
  1122. if b < 0x80 {
  1123. break
  1124. }
  1125. }
  1126. fieldNum := int32(wire >> 3)
  1127. wireType := int(wire & 0x7)
  1128. switch fieldNum {
  1129. case 1:
  1130. if wireType != 2 {
  1131. return fmt.Errorf("proto: wrong wireType = %d for field ResponseRange", wireType)
  1132. }
  1133. var msglen int
  1134. for shift := uint(0); ; shift += 7 {
  1135. if iNdEx >= l {
  1136. return io.ErrUnexpectedEOF
  1137. }
  1138. b := data[iNdEx]
  1139. iNdEx++
  1140. msglen |= (int(b) & 0x7F) << shift
  1141. if b < 0x80 {
  1142. break
  1143. }
  1144. }
  1145. postIndex := iNdEx + msglen
  1146. if postIndex > l {
  1147. return io.ErrUnexpectedEOF
  1148. }
  1149. if m.ResponseRange == nil {
  1150. m.ResponseRange = &RangeResponse{}
  1151. }
  1152. if err := m.ResponseRange.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1153. return err
  1154. }
  1155. iNdEx = postIndex
  1156. case 2:
  1157. if wireType != 2 {
  1158. return fmt.Errorf("proto: wrong wireType = %d for field ResponsePut", wireType)
  1159. }
  1160. var msglen int
  1161. for shift := uint(0); ; shift += 7 {
  1162. if iNdEx >= l {
  1163. return io.ErrUnexpectedEOF
  1164. }
  1165. b := data[iNdEx]
  1166. iNdEx++
  1167. msglen |= (int(b) & 0x7F) << shift
  1168. if b < 0x80 {
  1169. break
  1170. }
  1171. }
  1172. postIndex := iNdEx + msglen
  1173. if postIndex > l {
  1174. return io.ErrUnexpectedEOF
  1175. }
  1176. if m.ResponsePut == nil {
  1177. m.ResponsePut = &PutResponse{}
  1178. }
  1179. if err := m.ResponsePut.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1180. return err
  1181. }
  1182. iNdEx = postIndex
  1183. case 3:
  1184. if wireType != 2 {
  1185. return fmt.Errorf("proto: wrong wireType = %d for field ResponseDeleteRange", wireType)
  1186. }
  1187. var msglen int
  1188. for shift := uint(0); ; shift += 7 {
  1189. if iNdEx >= l {
  1190. return io.ErrUnexpectedEOF
  1191. }
  1192. b := data[iNdEx]
  1193. iNdEx++
  1194. msglen |= (int(b) & 0x7F) << shift
  1195. if b < 0x80 {
  1196. break
  1197. }
  1198. }
  1199. postIndex := iNdEx + msglen
  1200. if postIndex > l {
  1201. return io.ErrUnexpectedEOF
  1202. }
  1203. if m.ResponseDeleteRange == nil {
  1204. m.ResponseDeleteRange = &DeleteRangeResponse{}
  1205. }
  1206. if err := m.ResponseDeleteRange.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1207. return err
  1208. }
  1209. iNdEx = postIndex
  1210. default:
  1211. var sizeOfWire int
  1212. for {
  1213. sizeOfWire++
  1214. wire >>= 7
  1215. if wire == 0 {
  1216. break
  1217. }
  1218. }
  1219. iNdEx -= sizeOfWire
  1220. skippy, err := skipRpc(data[iNdEx:])
  1221. if err != nil {
  1222. return err
  1223. }
  1224. if (iNdEx + skippy) > l {
  1225. return io.ErrUnexpectedEOF
  1226. }
  1227. iNdEx += skippy
  1228. }
  1229. }
  1230. return nil
  1231. }
  1232. func (m *Compare) Unmarshal(data []byte) error {
  1233. l := len(data)
  1234. iNdEx := 0
  1235. for iNdEx < l {
  1236. var wire uint64
  1237. for shift := uint(0); ; shift += 7 {
  1238. if iNdEx >= l {
  1239. return io.ErrUnexpectedEOF
  1240. }
  1241. b := data[iNdEx]
  1242. iNdEx++
  1243. wire |= (uint64(b) & 0x7F) << shift
  1244. if b < 0x80 {
  1245. break
  1246. }
  1247. }
  1248. fieldNum := int32(wire >> 3)
  1249. wireType := int(wire & 0x7)
  1250. switch fieldNum {
  1251. case 1:
  1252. if wireType != 0 {
  1253. return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType)
  1254. }
  1255. for shift := uint(0); ; shift += 7 {
  1256. if iNdEx >= l {
  1257. return io.ErrUnexpectedEOF
  1258. }
  1259. b := data[iNdEx]
  1260. iNdEx++
  1261. m.Result |= (Compare_CompareResult(b) & 0x7F) << shift
  1262. if b < 0x80 {
  1263. break
  1264. }
  1265. }
  1266. case 2:
  1267. if wireType != 0 {
  1268. return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType)
  1269. }
  1270. for shift := uint(0); ; shift += 7 {
  1271. if iNdEx >= l {
  1272. return io.ErrUnexpectedEOF
  1273. }
  1274. b := data[iNdEx]
  1275. iNdEx++
  1276. m.Target |= (Compare_CompareTarget(b) & 0x7F) << shift
  1277. if b < 0x80 {
  1278. break
  1279. }
  1280. }
  1281. case 3:
  1282. if wireType != 2 {
  1283. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  1284. }
  1285. var byteLen int
  1286. for shift := uint(0); ; shift += 7 {
  1287. if iNdEx >= l {
  1288. return io.ErrUnexpectedEOF
  1289. }
  1290. b := data[iNdEx]
  1291. iNdEx++
  1292. byteLen |= (int(b) & 0x7F) << shift
  1293. if b < 0x80 {
  1294. break
  1295. }
  1296. }
  1297. postIndex := iNdEx + byteLen
  1298. if postIndex > l {
  1299. return io.ErrUnexpectedEOF
  1300. }
  1301. m.Key = append([]byte{}, data[iNdEx:postIndex]...)
  1302. iNdEx = postIndex
  1303. case 4:
  1304. if wireType != 0 {
  1305. return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
  1306. }
  1307. for shift := uint(0); ; shift += 7 {
  1308. if iNdEx >= l {
  1309. return io.ErrUnexpectedEOF
  1310. }
  1311. b := data[iNdEx]
  1312. iNdEx++
  1313. m.Version |= (int64(b) & 0x7F) << shift
  1314. if b < 0x80 {
  1315. break
  1316. }
  1317. }
  1318. case 5:
  1319. if wireType != 0 {
  1320. return fmt.Errorf("proto: wrong wireType = %d for field CreateIndex", wireType)
  1321. }
  1322. for shift := uint(0); ; shift += 7 {
  1323. if iNdEx >= l {
  1324. return io.ErrUnexpectedEOF
  1325. }
  1326. b := data[iNdEx]
  1327. iNdEx++
  1328. m.CreateIndex |= (int64(b) & 0x7F) << shift
  1329. if b < 0x80 {
  1330. break
  1331. }
  1332. }
  1333. case 6:
  1334. if wireType != 0 {
  1335. return fmt.Errorf("proto: wrong wireType = %d for field ModIndex", wireType)
  1336. }
  1337. for shift := uint(0); ; shift += 7 {
  1338. if iNdEx >= l {
  1339. return io.ErrUnexpectedEOF
  1340. }
  1341. b := data[iNdEx]
  1342. iNdEx++
  1343. m.ModIndex |= (int64(b) & 0x7F) << shift
  1344. if b < 0x80 {
  1345. break
  1346. }
  1347. }
  1348. case 7:
  1349. if wireType != 2 {
  1350. return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
  1351. }
  1352. var byteLen int
  1353. for shift := uint(0); ; shift += 7 {
  1354. if iNdEx >= l {
  1355. return io.ErrUnexpectedEOF
  1356. }
  1357. b := data[iNdEx]
  1358. iNdEx++
  1359. byteLen |= (int(b) & 0x7F) << shift
  1360. if b < 0x80 {
  1361. break
  1362. }
  1363. }
  1364. postIndex := iNdEx + byteLen
  1365. if postIndex > l {
  1366. return io.ErrUnexpectedEOF
  1367. }
  1368. m.Value = append([]byte{}, data[iNdEx:postIndex]...)
  1369. iNdEx = postIndex
  1370. default:
  1371. var sizeOfWire int
  1372. for {
  1373. sizeOfWire++
  1374. wire >>= 7
  1375. if wire == 0 {
  1376. break
  1377. }
  1378. }
  1379. iNdEx -= sizeOfWire
  1380. skippy, err := skipRpc(data[iNdEx:])
  1381. if err != nil {
  1382. return err
  1383. }
  1384. if (iNdEx + skippy) > l {
  1385. return io.ErrUnexpectedEOF
  1386. }
  1387. iNdEx += skippy
  1388. }
  1389. }
  1390. return nil
  1391. }
  1392. func (m *TxnRequest) Unmarshal(data []byte) error {
  1393. l := len(data)
  1394. iNdEx := 0
  1395. for iNdEx < l {
  1396. var wire uint64
  1397. for shift := uint(0); ; shift += 7 {
  1398. if iNdEx >= l {
  1399. return io.ErrUnexpectedEOF
  1400. }
  1401. b := data[iNdEx]
  1402. iNdEx++
  1403. wire |= (uint64(b) & 0x7F) << shift
  1404. if b < 0x80 {
  1405. break
  1406. }
  1407. }
  1408. fieldNum := int32(wire >> 3)
  1409. wireType := int(wire & 0x7)
  1410. switch fieldNum {
  1411. case 1:
  1412. if wireType != 2 {
  1413. return fmt.Errorf("proto: wrong wireType = %d for field Compare", wireType)
  1414. }
  1415. var msglen int
  1416. for shift := uint(0); ; shift += 7 {
  1417. if iNdEx >= l {
  1418. return io.ErrUnexpectedEOF
  1419. }
  1420. b := data[iNdEx]
  1421. iNdEx++
  1422. msglen |= (int(b) & 0x7F) << shift
  1423. if b < 0x80 {
  1424. break
  1425. }
  1426. }
  1427. postIndex := iNdEx + msglen
  1428. if postIndex > l {
  1429. return io.ErrUnexpectedEOF
  1430. }
  1431. m.Compare = append(m.Compare, &Compare{})
  1432. if err := m.Compare[len(m.Compare)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  1433. return err
  1434. }
  1435. iNdEx = postIndex
  1436. case 2:
  1437. if wireType != 2 {
  1438. return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType)
  1439. }
  1440. var msglen int
  1441. for shift := uint(0); ; shift += 7 {
  1442. if iNdEx >= l {
  1443. return io.ErrUnexpectedEOF
  1444. }
  1445. b := data[iNdEx]
  1446. iNdEx++
  1447. msglen |= (int(b) & 0x7F) << shift
  1448. if b < 0x80 {
  1449. break
  1450. }
  1451. }
  1452. postIndex := iNdEx + msglen
  1453. if postIndex > l {
  1454. return io.ErrUnexpectedEOF
  1455. }
  1456. m.Success = append(m.Success, &RequestUnion{})
  1457. if err := m.Success[len(m.Success)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  1458. return err
  1459. }
  1460. iNdEx = postIndex
  1461. case 3:
  1462. if wireType != 2 {
  1463. return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType)
  1464. }
  1465. var msglen int
  1466. for shift := uint(0); ; shift += 7 {
  1467. if iNdEx >= l {
  1468. return io.ErrUnexpectedEOF
  1469. }
  1470. b := data[iNdEx]
  1471. iNdEx++
  1472. msglen |= (int(b) & 0x7F) << shift
  1473. if b < 0x80 {
  1474. break
  1475. }
  1476. }
  1477. postIndex := iNdEx + msglen
  1478. if postIndex > l {
  1479. return io.ErrUnexpectedEOF
  1480. }
  1481. m.Failure = append(m.Failure, &RequestUnion{})
  1482. if err := m.Failure[len(m.Failure)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  1483. return err
  1484. }
  1485. iNdEx = postIndex
  1486. default:
  1487. var sizeOfWire int
  1488. for {
  1489. sizeOfWire++
  1490. wire >>= 7
  1491. if wire == 0 {
  1492. break
  1493. }
  1494. }
  1495. iNdEx -= sizeOfWire
  1496. skippy, err := skipRpc(data[iNdEx:])
  1497. if err != nil {
  1498. return err
  1499. }
  1500. if (iNdEx + skippy) > l {
  1501. return io.ErrUnexpectedEOF
  1502. }
  1503. iNdEx += skippy
  1504. }
  1505. }
  1506. return nil
  1507. }
  1508. func (m *TxnResponse) Unmarshal(data []byte) error {
  1509. l := len(data)
  1510. iNdEx := 0
  1511. for iNdEx < l {
  1512. var wire uint64
  1513. for shift := uint(0); ; shift += 7 {
  1514. if iNdEx >= l {
  1515. return io.ErrUnexpectedEOF
  1516. }
  1517. b := data[iNdEx]
  1518. iNdEx++
  1519. wire |= (uint64(b) & 0x7F) << shift
  1520. if b < 0x80 {
  1521. break
  1522. }
  1523. }
  1524. fieldNum := int32(wire >> 3)
  1525. wireType := int(wire & 0x7)
  1526. switch fieldNum {
  1527. case 1:
  1528. if wireType != 2 {
  1529. return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
  1530. }
  1531. var msglen int
  1532. for shift := uint(0); ; shift += 7 {
  1533. if iNdEx >= l {
  1534. return io.ErrUnexpectedEOF
  1535. }
  1536. b := data[iNdEx]
  1537. iNdEx++
  1538. msglen |= (int(b) & 0x7F) << shift
  1539. if b < 0x80 {
  1540. break
  1541. }
  1542. }
  1543. postIndex := iNdEx + msglen
  1544. if postIndex > l {
  1545. return io.ErrUnexpectedEOF
  1546. }
  1547. if m.Header == nil {
  1548. m.Header = &ResponseHeader{}
  1549. }
  1550. if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1551. return err
  1552. }
  1553. iNdEx = postIndex
  1554. case 2:
  1555. if wireType != 0 {
  1556. return fmt.Errorf("proto: wrong wireType = %d for field Succeeded", wireType)
  1557. }
  1558. var v int
  1559. for shift := uint(0); ; shift += 7 {
  1560. if iNdEx >= l {
  1561. return io.ErrUnexpectedEOF
  1562. }
  1563. b := data[iNdEx]
  1564. iNdEx++
  1565. v |= (int(b) & 0x7F) << shift
  1566. if b < 0x80 {
  1567. break
  1568. }
  1569. }
  1570. m.Succeeded = bool(v != 0)
  1571. case 3:
  1572. if wireType != 2 {
  1573. return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType)
  1574. }
  1575. var msglen int
  1576. for shift := uint(0); ; shift += 7 {
  1577. if iNdEx >= l {
  1578. return io.ErrUnexpectedEOF
  1579. }
  1580. b := data[iNdEx]
  1581. iNdEx++
  1582. msglen |= (int(b) & 0x7F) << shift
  1583. if b < 0x80 {
  1584. break
  1585. }
  1586. }
  1587. postIndex := iNdEx + msglen
  1588. if postIndex > l {
  1589. return io.ErrUnexpectedEOF
  1590. }
  1591. m.Responses = append(m.Responses, &ResponseUnion{})
  1592. if err := m.Responses[len(m.Responses)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  1593. return err
  1594. }
  1595. iNdEx = postIndex
  1596. default:
  1597. var sizeOfWire int
  1598. for {
  1599. sizeOfWire++
  1600. wire >>= 7
  1601. if wire == 0 {
  1602. break
  1603. }
  1604. }
  1605. iNdEx -= sizeOfWire
  1606. skippy, err := skipRpc(data[iNdEx:])
  1607. if err != nil {
  1608. return err
  1609. }
  1610. if (iNdEx + skippy) > l {
  1611. return io.ErrUnexpectedEOF
  1612. }
  1613. iNdEx += skippy
  1614. }
  1615. }
  1616. return nil
  1617. }
  1618. func (m *CompactionRequest) Unmarshal(data []byte) error {
  1619. l := len(data)
  1620. iNdEx := 0
  1621. for iNdEx < l {
  1622. var wire uint64
  1623. for shift := uint(0); ; shift += 7 {
  1624. if iNdEx >= l {
  1625. return io.ErrUnexpectedEOF
  1626. }
  1627. b := data[iNdEx]
  1628. iNdEx++
  1629. wire |= (uint64(b) & 0x7F) << shift
  1630. if b < 0x80 {
  1631. break
  1632. }
  1633. }
  1634. fieldNum := int32(wire >> 3)
  1635. wireType := int(wire & 0x7)
  1636. switch fieldNum {
  1637. case 1:
  1638. if wireType != 0 {
  1639. return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
  1640. }
  1641. for shift := uint(0); ; shift += 7 {
  1642. if iNdEx >= l {
  1643. return io.ErrUnexpectedEOF
  1644. }
  1645. b := data[iNdEx]
  1646. iNdEx++
  1647. m.Index |= (int64(b) & 0x7F) << shift
  1648. if b < 0x80 {
  1649. break
  1650. }
  1651. }
  1652. default:
  1653. var sizeOfWire int
  1654. for {
  1655. sizeOfWire++
  1656. wire >>= 7
  1657. if wire == 0 {
  1658. break
  1659. }
  1660. }
  1661. iNdEx -= sizeOfWire
  1662. skippy, err := skipRpc(data[iNdEx:])
  1663. if err != nil {
  1664. return err
  1665. }
  1666. if (iNdEx + skippy) > l {
  1667. return io.ErrUnexpectedEOF
  1668. }
  1669. iNdEx += skippy
  1670. }
  1671. }
  1672. return nil
  1673. }
  1674. func (m *CompactionResponse) Unmarshal(data []byte) error {
  1675. l := len(data)
  1676. iNdEx := 0
  1677. for iNdEx < l {
  1678. var wire uint64
  1679. for shift := uint(0); ; shift += 7 {
  1680. if iNdEx >= l {
  1681. return io.ErrUnexpectedEOF
  1682. }
  1683. b := data[iNdEx]
  1684. iNdEx++
  1685. wire |= (uint64(b) & 0x7F) << shift
  1686. if b < 0x80 {
  1687. break
  1688. }
  1689. }
  1690. fieldNum := int32(wire >> 3)
  1691. wireType := int(wire & 0x7)
  1692. switch fieldNum {
  1693. case 1:
  1694. if wireType != 2 {
  1695. return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
  1696. }
  1697. var msglen int
  1698. for shift := uint(0); ; shift += 7 {
  1699. if iNdEx >= l {
  1700. return io.ErrUnexpectedEOF
  1701. }
  1702. b := data[iNdEx]
  1703. iNdEx++
  1704. msglen |= (int(b) & 0x7F) << shift
  1705. if b < 0x80 {
  1706. break
  1707. }
  1708. }
  1709. postIndex := iNdEx + msglen
  1710. if postIndex > l {
  1711. return io.ErrUnexpectedEOF
  1712. }
  1713. if m.Header == nil {
  1714. m.Header = &ResponseHeader{}
  1715. }
  1716. if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
  1717. return err
  1718. }
  1719. iNdEx = postIndex
  1720. default:
  1721. var sizeOfWire int
  1722. for {
  1723. sizeOfWire++
  1724. wire >>= 7
  1725. if wire == 0 {
  1726. break
  1727. }
  1728. }
  1729. iNdEx -= sizeOfWire
  1730. skippy, err := skipRpc(data[iNdEx:])
  1731. if err != nil {
  1732. return err
  1733. }
  1734. if (iNdEx + skippy) > l {
  1735. return io.ErrUnexpectedEOF
  1736. }
  1737. iNdEx += skippy
  1738. }
  1739. }
  1740. return nil
  1741. }
  1742. func skipRpc(data []byte) (n int, err error) {
  1743. l := len(data)
  1744. iNdEx := 0
  1745. for iNdEx < l {
  1746. var wire uint64
  1747. for shift := uint(0); ; shift += 7 {
  1748. if iNdEx >= l {
  1749. return 0, io.ErrUnexpectedEOF
  1750. }
  1751. b := data[iNdEx]
  1752. iNdEx++
  1753. wire |= (uint64(b) & 0x7F) << shift
  1754. if b < 0x80 {
  1755. break
  1756. }
  1757. }
  1758. wireType := int(wire & 0x7)
  1759. switch wireType {
  1760. case 0:
  1761. for {
  1762. if iNdEx >= l {
  1763. return 0, io.ErrUnexpectedEOF
  1764. }
  1765. iNdEx++
  1766. if data[iNdEx-1] < 0x80 {
  1767. break
  1768. }
  1769. }
  1770. return iNdEx, nil
  1771. case 1:
  1772. iNdEx += 8
  1773. return iNdEx, nil
  1774. case 2:
  1775. var length int
  1776. for shift := uint(0); ; shift += 7 {
  1777. if iNdEx >= l {
  1778. return 0, io.ErrUnexpectedEOF
  1779. }
  1780. b := data[iNdEx]
  1781. iNdEx++
  1782. length |= (int(b) & 0x7F) << shift
  1783. if b < 0x80 {
  1784. break
  1785. }
  1786. }
  1787. iNdEx += length
  1788. return iNdEx, nil
  1789. case 3:
  1790. for {
  1791. var innerWire uint64
  1792. var start int = iNdEx
  1793. for shift := uint(0); ; shift += 7 {
  1794. if iNdEx >= l {
  1795. return 0, io.ErrUnexpectedEOF
  1796. }
  1797. b := data[iNdEx]
  1798. iNdEx++
  1799. innerWire |= (uint64(b) & 0x7F) << shift
  1800. if b < 0x80 {
  1801. break
  1802. }
  1803. }
  1804. innerWireType := int(innerWire & 0x7)
  1805. if innerWireType == 4 {
  1806. break
  1807. }
  1808. next, err := skipRpc(data[start:])
  1809. if err != nil {
  1810. return 0, err
  1811. }
  1812. iNdEx = start + next
  1813. }
  1814. return iNdEx, nil
  1815. case 4:
  1816. return iNdEx, nil
  1817. case 5:
  1818. iNdEx += 4
  1819. return iNdEx, nil
  1820. default:
  1821. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  1822. }
  1823. }
  1824. panic("unreachable")
  1825. }
  1826. func (m *ResponseHeader) Size() (n int) {
  1827. var l int
  1828. _ = l
  1829. l = len(m.Error)
  1830. if l > 0 {
  1831. n += 1 + l + sovRpc(uint64(l))
  1832. }
  1833. if m.ClusterId != 0 {
  1834. n += 1 + sovRpc(uint64(m.ClusterId))
  1835. }
  1836. if m.MemberId != 0 {
  1837. n += 1 + sovRpc(uint64(m.MemberId))
  1838. }
  1839. if m.Index != 0 {
  1840. n += 1 + sovRpc(uint64(m.Index))
  1841. }
  1842. if m.RaftTerm != 0 {
  1843. n += 1 + sovRpc(uint64(m.RaftTerm))
  1844. }
  1845. return n
  1846. }
  1847. func (m *RangeRequest) Size() (n int) {
  1848. var l int
  1849. _ = l
  1850. if m.Key != nil {
  1851. l = len(m.Key)
  1852. if l > 0 {
  1853. n += 1 + l + sovRpc(uint64(l))
  1854. }
  1855. }
  1856. if m.RangeEnd != nil {
  1857. l = len(m.RangeEnd)
  1858. if l > 0 {
  1859. n += 1 + l + sovRpc(uint64(l))
  1860. }
  1861. }
  1862. if m.Limit != 0 {
  1863. n += 1 + sovRpc(uint64(m.Limit))
  1864. }
  1865. if m.ConsistentToken != nil {
  1866. l = len(m.ConsistentToken)
  1867. if l > 0 {
  1868. n += 1 + l + sovRpc(uint64(l))
  1869. }
  1870. }
  1871. return n
  1872. }
  1873. func (m *RangeResponse) Size() (n int) {
  1874. var l int
  1875. _ = l
  1876. if m.Header != nil {
  1877. l = m.Header.Size()
  1878. n += 1 + l + sovRpc(uint64(l))
  1879. }
  1880. if len(m.Kvs) > 0 {
  1881. for _, e := range m.Kvs {
  1882. l = e.Size()
  1883. n += 1 + l + sovRpc(uint64(l))
  1884. }
  1885. }
  1886. if m.ConsistentToken != nil {
  1887. l = len(m.ConsistentToken)
  1888. if l > 0 {
  1889. n += 1 + l + sovRpc(uint64(l))
  1890. }
  1891. }
  1892. if m.More {
  1893. n += 2
  1894. }
  1895. return n
  1896. }
  1897. func (m *PutRequest) Size() (n int) {
  1898. var l int
  1899. _ = l
  1900. if m.Key != nil {
  1901. l = len(m.Key)
  1902. if l > 0 {
  1903. n += 1 + l + sovRpc(uint64(l))
  1904. }
  1905. }
  1906. if m.Value != nil {
  1907. l = len(m.Value)
  1908. if l > 0 {
  1909. n += 1 + l + sovRpc(uint64(l))
  1910. }
  1911. }
  1912. return n
  1913. }
  1914. func (m *PutResponse) Size() (n int) {
  1915. var l int
  1916. _ = l
  1917. if m.Header != nil {
  1918. l = m.Header.Size()
  1919. n += 1 + l + sovRpc(uint64(l))
  1920. }
  1921. return n
  1922. }
  1923. func (m *DeleteRangeRequest) Size() (n int) {
  1924. var l int
  1925. _ = l
  1926. if m.Key != nil {
  1927. l = len(m.Key)
  1928. if l > 0 {
  1929. n += 1 + l + sovRpc(uint64(l))
  1930. }
  1931. }
  1932. if m.RangeEnd != nil {
  1933. l = len(m.RangeEnd)
  1934. if l > 0 {
  1935. n += 1 + l + sovRpc(uint64(l))
  1936. }
  1937. }
  1938. return n
  1939. }
  1940. func (m *DeleteRangeResponse) Size() (n int) {
  1941. var l int
  1942. _ = l
  1943. if m.Header != nil {
  1944. l = m.Header.Size()
  1945. n += 1 + l + sovRpc(uint64(l))
  1946. }
  1947. return n
  1948. }
  1949. func (m *RequestUnion) Size() (n int) {
  1950. var l int
  1951. _ = l
  1952. if m.RequestRange != nil {
  1953. l = m.RequestRange.Size()
  1954. n += 1 + l + sovRpc(uint64(l))
  1955. }
  1956. if m.RequestPut != nil {
  1957. l = m.RequestPut.Size()
  1958. n += 1 + l + sovRpc(uint64(l))
  1959. }
  1960. if m.RequestDeleteRange != nil {
  1961. l = m.RequestDeleteRange.Size()
  1962. n += 1 + l + sovRpc(uint64(l))
  1963. }
  1964. return n
  1965. }
  1966. func (m *ResponseUnion) Size() (n int) {
  1967. var l int
  1968. _ = l
  1969. if m.ResponseRange != nil {
  1970. l = m.ResponseRange.Size()
  1971. n += 1 + l + sovRpc(uint64(l))
  1972. }
  1973. if m.ResponsePut != nil {
  1974. l = m.ResponsePut.Size()
  1975. n += 1 + l + sovRpc(uint64(l))
  1976. }
  1977. if m.ResponseDeleteRange != nil {
  1978. l = m.ResponseDeleteRange.Size()
  1979. n += 1 + l + sovRpc(uint64(l))
  1980. }
  1981. return n
  1982. }
  1983. func (m *Compare) Size() (n int) {
  1984. var l int
  1985. _ = l
  1986. if m.Result != 0 {
  1987. n += 1 + sovRpc(uint64(m.Result))
  1988. }
  1989. if m.Target != 0 {
  1990. n += 1 + sovRpc(uint64(m.Target))
  1991. }
  1992. if m.Key != nil {
  1993. l = len(m.Key)
  1994. if l > 0 {
  1995. n += 1 + l + sovRpc(uint64(l))
  1996. }
  1997. }
  1998. if m.Version != 0 {
  1999. n += 1 + sovRpc(uint64(m.Version))
  2000. }
  2001. if m.CreateIndex != 0 {
  2002. n += 1 + sovRpc(uint64(m.CreateIndex))
  2003. }
  2004. if m.ModIndex != 0 {
  2005. n += 1 + sovRpc(uint64(m.ModIndex))
  2006. }
  2007. if m.Value != nil {
  2008. l = len(m.Value)
  2009. if l > 0 {
  2010. n += 1 + l + sovRpc(uint64(l))
  2011. }
  2012. }
  2013. return n
  2014. }
  2015. func (m *TxnRequest) Size() (n int) {
  2016. var l int
  2017. _ = l
  2018. if len(m.Compare) > 0 {
  2019. for _, e := range m.Compare {
  2020. l = e.Size()
  2021. n += 1 + l + sovRpc(uint64(l))
  2022. }
  2023. }
  2024. if len(m.Success) > 0 {
  2025. for _, e := range m.Success {
  2026. l = e.Size()
  2027. n += 1 + l + sovRpc(uint64(l))
  2028. }
  2029. }
  2030. if len(m.Failure) > 0 {
  2031. for _, e := range m.Failure {
  2032. l = e.Size()
  2033. n += 1 + l + sovRpc(uint64(l))
  2034. }
  2035. }
  2036. return n
  2037. }
  2038. func (m *TxnResponse) Size() (n int) {
  2039. var l int
  2040. _ = l
  2041. if m.Header != nil {
  2042. l = m.Header.Size()
  2043. n += 1 + l + sovRpc(uint64(l))
  2044. }
  2045. if m.Succeeded {
  2046. n += 2
  2047. }
  2048. if len(m.Responses) > 0 {
  2049. for _, e := range m.Responses {
  2050. l = e.Size()
  2051. n += 1 + l + sovRpc(uint64(l))
  2052. }
  2053. }
  2054. return n
  2055. }
  2056. func (m *CompactionRequest) Size() (n int) {
  2057. var l int
  2058. _ = l
  2059. if m.Index != 0 {
  2060. n += 1 + sovRpc(uint64(m.Index))
  2061. }
  2062. return n
  2063. }
  2064. func (m *CompactionResponse) Size() (n int) {
  2065. var l int
  2066. _ = l
  2067. if m.Header != nil {
  2068. l = m.Header.Size()
  2069. n += 1 + l + sovRpc(uint64(l))
  2070. }
  2071. return n
  2072. }
  2073. func sovRpc(x uint64) (n int) {
  2074. for {
  2075. n++
  2076. x >>= 7
  2077. if x == 0 {
  2078. break
  2079. }
  2080. }
  2081. return n
  2082. }
  2083. func sozRpc(x uint64) (n int) {
  2084. return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  2085. }
  2086. func (m *ResponseHeader) Marshal() (data []byte, err error) {
  2087. size := m.Size()
  2088. data = make([]byte, size)
  2089. n, err := m.MarshalTo(data)
  2090. if err != nil {
  2091. return nil, err
  2092. }
  2093. return data[:n], nil
  2094. }
  2095. func (m *ResponseHeader) MarshalTo(data []byte) (n int, err error) {
  2096. var i int
  2097. _ = i
  2098. var l int
  2099. _ = l
  2100. if len(m.Error) > 0 {
  2101. data[i] = 0xa
  2102. i++
  2103. i = encodeVarintRpc(data, i, uint64(len(m.Error)))
  2104. i += copy(data[i:], m.Error)
  2105. }
  2106. if m.ClusterId != 0 {
  2107. data[i] = 0x10
  2108. i++
  2109. i = encodeVarintRpc(data, i, uint64(m.ClusterId))
  2110. }
  2111. if m.MemberId != 0 {
  2112. data[i] = 0x18
  2113. i++
  2114. i = encodeVarintRpc(data, i, uint64(m.MemberId))
  2115. }
  2116. if m.Index != 0 {
  2117. data[i] = 0x20
  2118. i++
  2119. i = encodeVarintRpc(data, i, uint64(m.Index))
  2120. }
  2121. if m.RaftTerm != 0 {
  2122. data[i] = 0x28
  2123. i++
  2124. i = encodeVarintRpc(data, i, uint64(m.RaftTerm))
  2125. }
  2126. return i, nil
  2127. }
  2128. func (m *RangeRequest) Marshal() (data []byte, err error) {
  2129. size := m.Size()
  2130. data = make([]byte, size)
  2131. n, err := m.MarshalTo(data)
  2132. if err != nil {
  2133. return nil, err
  2134. }
  2135. return data[:n], nil
  2136. }
  2137. func (m *RangeRequest) MarshalTo(data []byte) (n int, err error) {
  2138. var i int
  2139. _ = i
  2140. var l int
  2141. _ = l
  2142. if m.Key != nil {
  2143. if len(m.Key) > 0 {
  2144. data[i] = 0xa
  2145. i++
  2146. i = encodeVarintRpc(data, i, uint64(len(m.Key)))
  2147. i += copy(data[i:], m.Key)
  2148. }
  2149. }
  2150. if m.RangeEnd != nil {
  2151. if len(m.RangeEnd) > 0 {
  2152. data[i] = 0x12
  2153. i++
  2154. i = encodeVarintRpc(data, i, uint64(len(m.RangeEnd)))
  2155. i += copy(data[i:], m.RangeEnd)
  2156. }
  2157. }
  2158. if m.Limit != 0 {
  2159. data[i] = 0x18
  2160. i++
  2161. i = encodeVarintRpc(data, i, uint64(m.Limit))
  2162. }
  2163. if m.ConsistentToken != nil {
  2164. if len(m.ConsistentToken) > 0 {
  2165. data[i] = 0x22
  2166. i++
  2167. i = encodeVarintRpc(data, i, uint64(len(m.ConsistentToken)))
  2168. i += copy(data[i:], m.ConsistentToken)
  2169. }
  2170. }
  2171. return i, nil
  2172. }
  2173. func (m *RangeResponse) Marshal() (data []byte, err error) {
  2174. size := m.Size()
  2175. data = make([]byte, size)
  2176. n, err := m.MarshalTo(data)
  2177. if err != nil {
  2178. return nil, err
  2179. }
  2180. return data[:n], nil
  2181. }
  2182. func (m *RangeResponse) MarshalTo(data []byte) (n int, err error) {
  2183. var i int
  2184. _ = i
  2185. var l int
  2186. _ = l
  2187. if m.Header != nil {
  2188. data[i] = 0xa
  2189. i++
  2190. i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
  2191. n1, err := m.Header.MarshalTo(data[i:])
  2192. if err != nil {
  2193. return 0, err
  2194. }
  2195. i += n1
  2196. }
  2197. if len(m.Kvs) > 0 {
  2198. for _, msg := range m.Kvs {
  2199. data[i] = 0x12
  2200. i++
  2201. i = encodeVarintRpc(data, i, uint64(msg.Size()))
  2202. n, err := msg.MarshalTo(data[i:])
  2203. if err != nil {
  2204. return 0, err
  2205. }
  2206. i += n
  2207. }
  2208. }
  2209. if m.ConsistentToken != nil {
  2210. if len(m.ConsistentToken) > 0 {
  2211. data[i] = 0x1a
  2212. i++
  2213. i = encodeVarintRpc(data, i, uint64(len(m.ConsistentToken)))
  2214. i += copy(data[i:], m.ConsistentToken)
  2215. }
  2216. }
  2217. if m.More {
  2218. data[i] = 0x20
  2219. i++
  2220. if m.More {
  2221. data[i] = 1
  2222. } else {
  2223. data[i] = 0
  2224. }
  2225. i++
  2226. }
  2227. return i, nil
  2228. }
  2229. func (m *PutRequest) Marshal() (data []byte, err error) {
  2230. size := m.Size()
  2231. data = make([]byte, size)
  2232. n, err := m.MarshalTo(data)
  2233. if err != nil {
  2234. return nil, err
  2235. }
  2236. return data[:n], nil
  2237. }
  2238. func (m *PutRequest) MarshalTo(data []byte) (n int, err error) {
  2239. var i int
  2240. _ = i
  2241. var l int
  2242. _ = l
  2243. if m.Key != nil {
  2244. if len(m.Key) > 0 {
  2245. data[i] = 0xa
  2246. i++
  2247. i = encodeVarintRpc(data, i, uint64(len(m.Key)))
  2248. i += copy(data[i:], m.Key)
  2249. }
  2250. }
  2251. if m.Value != nil {
  2252. if len(m.Value) > 0 {
  2253. data[i] = 0x12
  2254. i++
  2255. i = encodeVarintRpc(data, i, uint64(len(m.Value)))
  2256. i += copy(data[i:], m.Value)
  2257. }
  2258. }
  2259. return i, nil
  2260. }
  2261. func (m *PutResponse) Marshal() (data []byte, err error) {
  2262. size := m.Size()
  2263. data = make([]byte, size)
  2264. n, err := m.MarshalTo(data)
  2265. if err != nil {
  2266. return nil, err
  2267. }
  2268. return data[:n], nil
  2269. }
  2270. func (m *PutResponse) MarshalTo(data []byte) (n int, err error) {
  2271. var i int
  2272. _ = i
  2273. var l int
  2274. _ = l
  2275. if m.Header != nil {
  2276. data[i] = 0xa
  2277. i++
  2278. i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
  2279. n2, err := m.Header.MarshalTo(data[i:])
  2280. if err != nil {
  2281. return 0, err
  2282. }
  2283. i += n2
  2284. }
  2285. return i, nil
  2286. }
  2287. func (m *DeleteRangeRequest) Marshal() (data []byte, err error) {
  2288. size := m.Size()
  2289. data = make([]byte, size)
  2290. n, err := m.MarshalTo(data)
  2291. if err != nil {
  2292. return nil, err
  2293. }
  2294. return data[:n], nil
  2295. }
  2296. func (m *DeleteRangeRequest) MarshalTo(data []byte) (n int, err error) {
  2297. var i int
  2298. _ = i
  2299. var l int
  2300. _ = l
  2301. if m.Key != nil {
  2302. if len(m.Key) > 0 {
  2303. data[i] = 0xa
  2304. i++
  2305. i = encodeVarintRpc(data, i, uint64(len(m.Key)))
  2306. i += copy(data[i:], m.Key)
  2307. }
  2308. }
  2309. if m.RangeEnd != nil {
  2310. if len(m.RangeEnd) > 0 {
  2311. data[i] = 0x12
  2312. i++
  2313. i = encodeVarintRpc(data, i, uint64(len(m.RangeEnd)))
  2314. i += copy(data[i:], m.RangeEnd)
  2315. }
  2316. }
  2317. return i, nil
  2318. }
  2319. func (m *DeleteRangeResponse) Marshal() (data []byte, err error) {
  2320. size := m.Size()
  2321. data = make([]byte, size)
  2322. n, err := m.MarshalTo(data)
  2323. if err != nil {
  2324. return nil, err
  2325. }
  2326. return data[:n], nil
  2327. }
  2328. func (m *DeleteRangeResponse) MarshalTo(data []byte) (n int, err error) {
  2329. var i int
  2330. _ = i
  2331. var l int
  2332. _ = l
  2333. if m.Header != nil {
  2334. data[i] = 0xa
  2335. i++
  2336. i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
  2337. n3, err := m.Header.MarshalTo(data[i:])
  2338. if err != nil {
  2339. return 0, err
  2340. }
  2341. i += n3
  2342. }
  2343. return i, nil
  2344. }
  2345. func (m *RequestUnion) Marshal() (data []byte, err error) {
  2346. size := m.Size()
  2347. data = make([]byte, size)
  2348. n, err := m.MarshalTo(data)
  2349. if err != nil {
  2350. return nil, err
  2351. }
  2352. return data[:n], nil
  2353. }
  2354. func (m *RequestUnion) MarshalTo(data []byte) (n int, err error) {
  2355. var i int
  2356. _ = i
  2357. var l int
  2358. _ = l
  2359. if m.RequestRange != nil {
  2360. data[i] = 0xa
  2361. i++
  2362. i = encodeVarintRpc(data, i, uint64(m.RequestRange.Size()))
  2363. n4, err := m.RequestRange.MarshalTo(data[i:])
  2364. if err != nil {
  2365. return 0, err
  2366. }
  2367. i += n4
  2368. }
  2369. if m.RequestPut != nil {
  2370. data[i] = 0x12
  2371. i++
  2372. i = encodeVarintRpc(data, i, uint64(m.RequestPut.Size()))
  2373. n5, err := m.RequestPut.MarshalTo(data[i:])
  2374. if err != nil {
  2375. return 0, err
  2376. }
  2377. i += n5
  2378. }
  2379. if m.RequestDeleteRange != nil {
  2380. data[i] = 0x1a
  2381. i++
  2382. i = encodeVarintRpc(data, i, uint64(m.RequestDeleteRange.Size()))
  2383. n6, err := m.RequestDeleteRange.MarshalTo(data[i:])
  2384. if err != nil {
  2385. return 0, err
  2386. }
  2387. i += n6
  2388. }
  2389. return i, nil
  2390. }
  2391. func (m *ResponseUnion) Marshal() (data []byte, err error) {
  2392. size := m.Size()
  2393. data = make([]byte, size)
  2394. n, err := m.MarshalTo(data)
  2395. if err != nil {
  2396. return nil, err
  2397. }
  2398. return data[:n], nil
  2399. }
  2400. func (m *ResponseUnion) MarshalTo(data []byte) (n int, err error) {
  2401. var i int
  2402. _ = i
  2403. var l int
  2404. _ = l
  2405. if m.ResponseRange != nil {
  2406. data[i] = 0xa
  2407. i++
  2408. i = encodeVarintRpc(data, i, uint64(m.ResponseRange.Size()))
  2409. n7, err := m.ResponseRange.MarshalTo(data[i:])
  2410. if err != nil {
  2411. return 0, err
  2412. }
  2413. i += n7
  2414. }
  2415. if m.ResponsePut != nil {
  2416. data[i] = 0x12
  2417. i++
  2418. i = encodeVarintRpc(data, i, uint64(m.ResponsePut.Size()))
  2419. n8, err := m.ResponsePut.MarshalTo(data[i:])
  2420. if err != nil {
  2421. return 0, err
  2422. }
  2423. i += n8
  2424. }
  2425. if m.ResponseDeleteRange != nil {
  2426. data[i] = 0x1a
  2427. i++
  2428. i = encodeVarintRpc(data, i, uint64(m.ResponseDeleteRange.Size()))
  2429. n9, err := m.ResponseDeleteRange.MarshalTo(data[i:])
  2430. if err != nil {
  2431. return 0, err
  2432. }
  2433. i += n9
  2434. }
  2435. return i, nil
  2436. }
  2437. func (m *Compare) Marshal() (data []byte, err error) {
  2438. size := m.Size()
  2439. data = make([]byte, size)
  2440. n, err := m.MarshalTo(data)
  2441. if err != nil {
  2442. return nil, err
  2443. }
  2444. return data[:n], nil
  2445. }
  2446. func (m *Compare) MarshalTo(data []byte) (n int, err error) {
  2447. var i int
  2448. _ = i
  2449. var l int
  2450. _ = l
  2451. if m.Result != 0 {
  2452. data[i] = 0x8
  2453. i++
  2454. i = encodeVarintRpc(data, i, uint64(m.Result))
  2455. }
  2456. if m.Target != 0 {
  2457. data[i] = 0x10
  2458. i++
  2459. i = encodeVarintRpc(data, i, uint64(m.Target))
  2460. }
  2461. if m.Key != nil {
  2462. if len(m.Key) > 0 {
  2463. data[i] = 0x1a
  2464. i++
  2465. i = encodeVarintRpc(data, i, uint64(len(m.Key)))
  2466. i += copy(data[i:], m.Key)
  2467. }
  2468. }
  2469. if m.Version != 0 {
  2470. data[i] = 0x20
  2471. i++
  2472. i = encodeVarintRpc(data, i, uint64(m.Version))
  2473. }
  2474. if m.CreateIndex != 0 {
  2475. data[i] = 0x28
  2476. i++
  2477. i = encodeVarintRpc(data, i, uint64(m.CreateIndex))
  2478. }
  2479. if m.ModIndex != 0 {
  2480. data[i] = 0x30
  2481. i++
  2482. i = encodeVarintRpc(data, i, uint64(m.ModIndex))
  2483. }
  2484. if m.Value != nil {
  2485. if len(m.Value) > 0 {
  2486. data[i] = 0x3a
  2487. i++
  2488. i = encodeVarintRpc(data, i, uint64(len(m.Value)))
  2489. i += copy(data[i:], m.Value)
  2490. }
  2491. }
  2492. return i, nil
  2493. }
  2494. func (m *TxnRequest) Marshal() (data []byte, err error) {
  2495. size := m.Size()
  2496. data = make([]byte, size)
  2497. n, err := m.MarshalTo(data)
  2498. if err != nil {
  2499. return nil, err
  2500. }
  2501. return data[:n], nil
  2502. }
  2503. func (m *TxnRequest) MarshalTo(data []byte) (n int, err error) {
  2504. var i int
  2505. _ = i
  2506. var l int
  2507. _ = l
  2508. if len(m.Compare) > 0 {
  2509. for _, msg := range m.Compare {
  2510. data[i] = 0xa
  2511. i++
  2512. i = encodeVarintRpc(data, i, uint64(msg.Size()))
  2513. n, err := msg.MarshalTo(data[i:])
  2514. if err != nil {
  2515. return 0, err
  2516. }
  2517. i += n
  2518. }
  2519. }
  2520. if len(m.Success) > 0 {
  2521. for _, msg := range m.Success {
  2522. data[i] = 0x12
  2523. i++
  2524. i = encodeVarintRpc(data, i, uint64(msg.Size()))
  2525. n, err := msg.MarshalTo(data[i:])
  2526. if err != nil {
  2527. return 0, err
  2528. }
  2529. i += n
  2530. }
  2531. }
  2532. if len(m.Failure) > 0 {
  2533. for _, msg := range m.Failure {
  2534. data[i] = 0x1a
  2535. i++
  2536. i = encodeVarintRpc(data, i, uint64(msg.Size()))
  2537. n, err := msg.MarshalTo(data[i:])
  2538. if err != nil {
  2539. return 0, err
  2540. }
  2541. i += n
  2542. }
  2543. }
  2544. return i, nil
  2545. }
  2546. func (m *TxnResponse) Marshal() (data []byte, err error) {
  2547. size := m.Size()
  2548. data = make([]byte, size)
  2549. n, err := m.MarshalTo(data)
  2550. if err != nil {
  2551. return nil, err
  2552. }
  2553. return data[:n], nil
  2554. }
  2555. func (m *TxnResponse) MarshalTo(data []byte) (n int, err error) {
  2556. var i int
  2557. _ = i
  2558. var l int
  2559. _ = l
  2560. if m.Header != nil {
  2561. data[i] = 0xa
  2562. i++
  2563. i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
  2564. n10, err := m.Header.MarshalTo(data[i:])
  2565. if err != nil {
  2566. return 0, err
  2567. }
  2568. i += n10
  2569. }
  2570. if m.Succeeded {
  2571. data[i] = 0x10
  2572. i++
  2573. if m.Succeeded {
  2574. data[i] = 1
  2575. } else {
  2576. data[i] = 0
  2577. }
  2578. i++
  2579. }
  2580. if len(m.Responses) > 0 {
  2581. for _, msg := range m.Responses {
  2582. data[i] = 0x1a
  2583. i++
  2584. i = encodeVarintRpc(data, i, uint64(msg.Size()))
  2585. n, err := msg.MarshalTo(data[i:])
  2586. if err != nil {
  2587. return 0, err
  2588. }
  2589. i += n
  2590. }
  2591. }
  2592. return i, nil
  2593. }
  2594. func (m *CompactionRequest) Marshal() (data []byte, err error) {
  2595. size := m.Size()
  2596. data = make([]byte, size)
  2597. n, err := m.MarshalTo(data)
  2598. if err != nil {
  2599. return nil, err
  2600. }
  2601. return data[:n], nil
  2602. }
  2603. func (m *CompactionRequest) MarshalTo(data []byte) (n int, err error) {
  2604. var i int
  2605. _ = i
  2606. var l int
  2607. _ = l
  2608. if m.Index != 0 {
  2609. data[i] = 0x8
  2610. i++
  2611. i = encodeVarintRpc(data, i, uint64(m.Index))
  2612. }
  2613. return i, nil
  2614. }
  2615. func (m *CompactionResponse) Marshal() (data []byte, err error) {
  2616. size := m.Size()
  2617. data = make([]byte, size)
  2618. n, err := m.MarshalTo(data)
  2619. if err != nil {
  2620. return nil, err
  2621. }
  2622. return data[:n], nil
  2623. }
  2624. func (m *CompactionResponse) MarshalTo(data []byte) (n int, err error) {
  2625. var i int
  2626. _ = i
  2627. var l int
  2628. _ = l
  2629. if m.Header != nil {
  2630. data[i] = 0xa
  2631. i++
  2632. i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
  2633. n11, err := m.Header.MarshalTo(data[i:])
  2634. if err != nil {
  2635. return 0, err
  2636. }
  2637. i += n11
  2638. }
  2639. return i, nil
  2640. }
  2641. func encodeFixed64Rpc(data []byte, offset int, v uint64) int {
  2642. data[offset] = uint8(v)
  2643. data[offset+1] = uint8(v >> 8)
  2644. data[offset+2] = uint8(v >> 16)
  2645. data[offset+3] = uint8(v >> 24)
  2646. data[offset+4] = uint8(v >> 32)
  2647. data[offset+5] = uint8(v >> 40)
  2648. data[offset+6] = uint8(v >> 48)
  2649. data[offset+7] = uint8(v >> 56)
  2650. return offset + 8
  2651. }
  2652. func encodeFixed32Rpc(data []byte, offset int, v uint32) int {
  2653. data[offset] = uint8(v)
  2654. data[offset+1] = uint8(v >> 8)
  2655. data[offset+2] = uint8(v >> 16)
  2656. data[offset+3] = uint8(v >> 24)
  2657. return offset + 4
  2658. }
  2659. func encodeVarintRpc(data []byte, offset int, v uint64) int {
  2660. for v >= 1<<7 {
  2661. data[offset] = uint8(v&0x7f | 0x80)
  2662. v >>= 7
  2663. offset++
  2664. }
  2665. data[offset] = uint8(v)
  2666. return offset + 1
  2667. }
  2668. // Client API for Etcd service
  2669. type EtcdClient interface {
  2670. // Range gets the keys in the range from the store.
  2671. Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error)
  2672. // Put puts the given key into the store.
  2673. // A put request increases the index of the store,
  2674. // and generates one event in the event history.
  2675. Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
  2676. // Delete deletes the given range from the store.
  2677. // A delete request increase the index of the store,
  2678. // and generates one event in the event history.
  2679. DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error)
  2680. // Txn processes all the requests in one transaction.
  2681. // A txn request increases the index of the store,
  2682. // and generates events with the same index in the event history.
  2683. Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error)
  2684. // Compact compacts the event history in etcd. User should compact the
  2685. // event history periodically, or it will grow infinitely.
  2686. Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error)
  2687. }
  2688. type etcdClient struct {
  2689. cc *grpc.ClientConn
  2690. }
  2691. func NewEtcdClient(cc *grpc.ClientConn) EtcdClient {
  2692. return &etcdClient{cc}
  2693. }
  2694. func (c *etcdClient) Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) {
  2695. out := new(RangeResponse)
  2696. err := grpc.Invoke(ctx, "/etcdserverpb.etcd/Range", in, out, c.cc, opts...)
  2697. if err != nil {
  2698. return nil, err
  2699. }
  2700. return out, nil
  2701. }
  2702. func (c *etcdClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) {
  2703. out := new(PutResponse)
  2704. err := grpc.Invoke(ctx, "/etcdserverpb.etcd/Put", in, out, c.cc, opts...)
  2705. if err != nil {
  2706. return nil, err
  2707. }
  2708. return out, nil
  2709. }
  2710. func (c *etcdClient) DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error) {
  2711. out := new(DeleteRangeResponse)
  2712. err := grpc.Invoke(ctx, "/etcdserverpb.etcd/DeleteRange", in, out, c.cc, opts...)
  2713. if err != nil {
  2714. return nil, err
  2715. }
  2716. return out, nil
  2717. }
  2718. func (c *etcdClient) Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) {
  2719. out := new(TxnResponse)
  2720. err := grpc.Invoke(ctx, "/etcdserverpb.etcd/Txn", in, out, c.cc, opts...)
  2721. if err != nil {
  2722. return nil, err
  2723. }
  2724. return out, nil
  2725. }
  2726. func (c *etcdClient) Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error) {
  2727. out := new(CompactionResponse)
  2728. err := grpc.Invoke(ctx, "/etcdserverpb.etcd/Compact", in, out, c.cc, opts...)
  2729. if err != nil {
  2730. return nil, err
  2731. }
  2732. return out, nil
  2733. }
  2734. // Server API for Etcd service
  2735. type EtcdServer interface {
  2736. // Range gets the keys in the range from the store.
  2737. Range(context.Context, *RangeRequest) (*RangeResponse, error)
  2738. // Put puts the given key into the store.
  2739. // A put request increases the index of the store,
  2740. // and generates one event in the event history.
  2741. Put(context.Context, *PutRequest) (*PutResponse, error)
  2742. // Delete deletes the given range from the store.
  2743. // A delete request increase the index of the store,
  2744. // and generates one event in the event history.
  2745. DeleteRange(context.Context, *DeleteRangeRequest) (*DeleteRangeResponse, error)
  2746. // Txn processes all the requests in one transaction.
  2747. // A txn request increases the index of the store,
  2748. // and generates events with the same index in the event history.
  2749. Txn(context.Context, *TxnRequest) (*TxnResponse, error)
  2750. // Compact compacts the event history in etcd. User should compact the
  2751. // event history periodically, or it will grow infinitely.
  2752. Compact(context.Context, *CompactionRequest) (*CompactionResponse, error)
  2753. }
  2754. func RegisterEtcdServer(s *grpc.Server, srv EtcdServer) {
  2755. s.RegisterService(&_Etcd_serviceDesc, srv)
  2756. }
  2757. func _Etcd_Range_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
  2758. in := new(RangeRequest)
  2759. if err := codec.Unmarshal(buf, in); err != nil {
  2760. return nil, err
  2761. }
  2762. out, err := srv.(EtcdServer).Range(ctx, in)
  2763. if err != nil {
  2764. return nil, err
  2765. }
  2766. return out, nil
  2767. }
  2768. func _Etcd_Put_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
  2769. in := new(PutRequest)
  2770. if err := codec.Unmarshal(buf, in); err != nil {
  2771. return nil, err
  2772. }
  2773. out, err := srv.(EtcdServer).Put(ctx, in)
  2774. if err != nil {
  2775. return nil, err
  2776. }
  2777. return out, nil
  2778. }
  2779. func _Etcd_DeleteRange_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
  2780. in := new(DeleteRangeRequest)
  2781. if err := codec.Unmarshal(buf, in); err != nil {
  2782. return nil, err
  2783. }
  2784. out, err := srv.(EtcdServer).DeleteRange(ctx, in)
  2785. if err != nil {
  2786. return nil, err
  2787. }
  2788. return out, nil
  2789. }
  2790. func _Etcd_Txn_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
  2791. in := new(TxnRequest)
  2792. if err := codec.Unmarshal(buf, in); err != nil {
  2793. return nil, err
  2794. }
  2795. out, err := srv.(EtcdServer).Txn(ctx, in)
  2796. if err != nil {
  2797. return nil, err
  2798. }
  2799. return out, nil
  2800. }
  2801. func _Etcd_Compact_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
  2802. in := new(CompactionRequest)
  2803. if err := codec.Unmarshal(buf, in); err != nil {
  2804. return nil, err
  2805. }
  2806. out, err := srv.(EtcdServer).Compact(ctx, in)
  2807. if err != nil {
  2808. return nil, err
  2809. }
  2810. return out, nil
  2811. }
  2812. var _Etcd_serviceDesc = grpc.ServiceDesc{
  2813. ServiceName: "etcdserverpb.etcd",
  2814. HandlerType: (*EtcdServer)(nil),
  2815. Methods: []grpc.MethodDesc{
  2816. {
  2817. MethodName: "Range",
  2818. Handler: _Etcd_Range_Handler,
  2819. },
  2820. {
  2821. MethodName: "Put",
  2822. Handler: _Etcd_Put_Handler,
  2823. },
  2824. {
  2825. MethodName: "DeleteRange",
  2826. Handler: _Etcd_DeleteRange_Handler,
  2827. },
  2828. {
  2829. MethodName: "Txn",
  2830. Handler: _Etcd_Txn_Handler,
  2831. },
  2832. {
  2833. MethodName: "Compact",
  2834. Handler: _Etcd_Compact_Handler,
  2835. },
  2836. },
  2837. Streams: []grpc.StreamDesc{},
  2838. }