rpc.pb.go 76 KB

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