logbroker.pb.go 85 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416
  1. // Code generated by protoc-gen-gogo.
  2. // source: logbroker.proto
  3. // DO NOT EDIT!
  4. package api
  5. import proto "github.com/gogo/protobuf/proto"
  6. import fmt "fmt"
  7. import math "math"
  8. import _ "github.com/gogo/protobuf/gogoproto"
  9. import google_protobuf "github.com/gogo/protobuf/types"
  10. import _ "github.com/docker/swarmkit/protobuf/plugin"
  11. import github_com_docker_swarmkit_api_deepcopy "github.com/docker/swarmkit/api/deepcopy"
  12. import (
  13. context "golang.org/x/net/context"
  14. grpc "google.golang.org/grpc"
  15. )
  16. import raftselector "github.com/docker/swarmkit/manager/raftselector"
  17. import codes "google.golang.org/grpc/codes"
  18. import metadata "google.golang.org/grpc/metadata"
  19. import transport "google.golang.org/grpc/transport"
  20. import rafttime "time"
  21. import strings "strings"
  22. import reflect "reflect"
  23. import io "io"
  24. // Reference imports to suppress errors if they are not otherwise used.
  25. var _ = proto.Marshal
  26. var _ = fmt.Errorf
  27. var _ = math.Inf
  28. // LogStream defines the stream from which the log message came.
  29. type LogStream int32
  30. const (
  31. LogStreamUnknown LogStream = 0
  32. LogStreamStdout LogStream = 1
  33. LogStreamStderr LogStream = 2
  34. )
  35. var LogStream_name = map[int32]string{
  36. 0: "LOG_STREAM_UNKNOWN",
  37. 1: "LOG_STREAM_STDOUT",
  38. 2: "LOG_STREAM_STDERR",
  39. }
  40. var LogStream_value = map[string]int32{
  41. "LOG_STREAM_UNKNOWN": 0,
  42. "LOG_STREAM_STDOUT": 1,
  43. "LOG_STREAM_STDERR": 2,
  44. }
  45. func (x LogStream) String() string {
  46. return proto.EnumName(LogStream_name, int32(x))
  47. }
  48. func (LogStream) EnumDescriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{0} }
  49. type LogSubscriptionOptions struct {
  50. // Streams defines which log streams should be sent from the task source.
  51. // Empty means send all the messages.
  52. Streams []LogStream `protobuf:"varint,1,rep,name=streams,enum=docker.swarmkit.v1.LogStream" json:"streams,omitempty"`
  53. // Follow instructs the publisher to continue sending log messages as they
  54. // are produced, after satisfying the initial query.
  55. Follow bool `protobuf:"varint,2,opt,name=follow,proto3" json:"follow,omitempty"`
  56. // Tail defines how many messages relative to the log stream to send when
  57. // starting the stream.
  58. //
  59. // Positive values will skip that number of messages from the start of the
  60. // stream before publishing.
  61. //
  62. // Negative values will specify messages relative to the end of the stream,
  63. // offset by one. We can say that the last (-n-1) lines are returned when n
  64. // < 0. As reference, -1 would mean send no log lines (typically used with
  65. // follow), -2 would return the last log line, -11 would return the last 10
  66. // and so on.
  67. //
  68. // The default value of zero will return all logs.
  69. //
  70. // Note that this is very different from the Docker API.
  71. Tail int64 `protobuf:"varint,3,opt,name=tail,proto3" json:"tail,omitempty"`
  72. // Since indicates that only log messages produced after this timestamp
  73. // should be sent.
  74. // Note: can't use stdtime because this field is nullable.
  75. Since *google_protobuf.Timestamp `protobuf:"bytes,4,opt,name=since" json:"since,omitempty"`
  76. }
  77. func (m *LogSubscriptionOptions) Reset() { *m = LogSubscriptionOptions{} }
  78. func (*LogSubscriptionOptions) ProtoMessage() {}
  79. func (*LogSubscriptionOptions) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{0} }
  80. // LogSelector will match logs from ANY of the defined parameters.
  81. //
  82. // For the best effect, the client should use the least specific parameter
  83. // possible. For example, if they want to listen to all the tasks of a service,
  84. // they should use the service id, rather than specifying the individual tasks.
  85. type LogSelector struct {
  86. ServiceIDs []string `protobuf:"bytes,1,rep,name=service_ids,json=serviceIds" json:"service_ids,omitempty"`
  87. NodeIDs []string `protobuf:"bytes,2,rep,name=node_ids,json=nodeIds" json:"node_ids,omitempty"`
  88. TaskIDs []string `protobuf:"bytes,3,rep,name=task_ids,json=taskIds" json:"task_ids,omitempty"`
  89. }
  90. func (m *LogSelector) Reset() { *m = LogSelector{} }
  91. func (*LogSelector) ProtoMessage() {}
  92. func (*LogSelector) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{1} }
  93. // LogContext marks the context from which a log message was generated.
  94. type LogContext struct {
  95. ServiceID string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
  96. NodeID string `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
  97. TaskID string `protobuf:"bytes,3,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
  98. }
  99. func (m *LogContext) Reset() { *m = LogContext{} }
  100. func (*LogContext) ProtoMessage() {}
  101. func (*LogContext) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{2} }
  102. // LogAttr is an extra key/value pair that may be have been set by users
  103. type LogAttr struct {
  104. Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
  105. Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
  106. }
  107. func (m *LogAttr) Reset() { *m = LogAttr{} }
  108. func (*LogAttr) ProtoMessage() {}
  109. func (*LogAttr) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{3} }
  110. // LogMessage
  111. type LogMessage struct {
  112. // Context identifies the source of the log message.
  113. Context LogContext `protobuf:"bytes,1,opt,name=context" json:"context"`
  114. // Timestamp is the time at which the message was generated.
  115. // Note: can't use stdtime because this field is nullable.
  116. Timestamp *google_protobuf.Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp,omitempty"`
  117. // Stream identifies the stream of the log message, stdout or stderr.
  118. Stream LogStream `protobuf:"varint,3,opt,name=stream,proto3,enum=docker.swarmkit.v1.LogStream" json:"stream,omitempty"`
  119. // Data is the raw log message, as generated by the application.
  120. Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
  121. // Attrs is a list of key value pairs representing additional log details
  122. // that may have been returned from the logger
  123. Attrs []LogAttr `protobuf:"bytes,5,rep,name=attrs" json:"attrs"`
  124. }
  125. func (m *LogMessage) Reset() { *m = LogMessage{} }
  126. func (*LogMessage) ProtoMessage() {}
  127. func (*LogMessage) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{4} }
  128. type SubscribeLogsRequest struct {
  129. // LogSelector describes the logs to which the subscriber is
  130. Selector *LogSelector `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
  131. Options *LogSubscriptionOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"`
  132. }
  133. func (m *SubscribeLogsRequest) Reset() { *m = SubscribeLogsRequest{} }
  134. func (*SubscribeLogsRequest) ProtoMessage() {}
  135. func (*SubscribeLogsRequest) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{5} }
  136. type SubscribeLogsMessage struct {
  137. Messages []LogMessage `protobuf:"bytes,1,rep,name=messages" json:"messages"`
  138. }
  139. func (m *SubscribeLogsMessage) Reset() { *m = SubscribeLogsMessage{} }
  140. func (*SubscribeLogsMessage) ProtoMessage() {}
  141. func (*SubscribeLogsMessage) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{6} }
  142. // ListenSubscriptionsRequest is a placeholder to begin listening for
  143. // subscriptions.
  144. type ListenSubscriptionsRequest struct {
  145. }
  146. func (m *ListenSubscriptionsRequest) Reset() { *m = ListenSubscriptionsRequest{} }
  147. func (*ListenSubscriptionsRequest) ProtoMessage() {}
  148. func (*ListenSubscriptionsRequest) Descriptor() ([]byte, []int) {
  149. return fileDescriptorLogbroker, []int{7}
  150. }
  151. // SubscriptionMessage instructs the listener to start publishing messages for
  152. // the stream or end a subscription.
  153. //
  154. // If Options.Follow == false, the worker should end the subscription on its own.
  155. type SubscriptionMessage struct {
  156. // ID identifies the subscription.
  157. ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
  158. // Selector defines which sources should be sent for the subscription.
  159. Selector *LogSelector `protobuf:"bytes,2,opt,name=selector" json:"selector,omitempty"`
  160. // Options specify how the subscription should be satisfied.
  161. Options *LogSubscriptionOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
  162. // Close will be true if the node should shutdown the subscription with the
  163. // provided identifier.
  164. Close bool `protobuf:"varint,4,opt,name=close,proto3" json:"close,omitempty"`
  165. }
  166. func (m *SubscriptionMessage) Reset() { *m = SubscriptionMessage{} }
  167. func (*SubscriptionMessage) ProtoMessage() {}
  168. func (*SubscriptionMessage) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{8} }
  169. type PublishLogsMessage struct {
  170. // SubscriptionID identifies which subscription the set of messages should
  171. // be sent to. We can think of this as a "mail box" for the subscription.
  172. SubscriptionID string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"`
  173. // Messages is the log message for publishing.
  174. Messages []LogMessage `protobuf:"bytes,2,rep,name=messages" json:"messages"`
  175. // Close is a boolean for whether or not the client has completed its log
  176. // stream. When close is called, the manager can hang up the subscription.
  177. // Any further logs from this subscription are an error condition. Any
  178. // messages included when close is set can be discarded
  179. Close bool `protobuf:"varint,3,opt,name=close,proto3" json:"close,omitempty"`
  180. }
  181. func (m *PublishLogsMessage) Reset() { *m = PublishLogsMessage{} }
  182. func (*PublishLogsMessage) ProtoMessage() {}
  183. func (*PublishLogsMessage) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{9} }
  184. type PublishLogsResponse struct {
  185. }
  186. func (m *PublishLogsResponse) Reset() { *m = PublishLogsResponse{} }
  187. func (*PublishLogsResponse) ProtoMessage() {}
  188. func (*PublishLogsResponse) Descriptor() ([]byte, []int) { return fileDescriptorLogbroker, []int{10} }
  189. func init() {
  190. proto.RegisterType((*LogSubscriptionOptions)(nil), "docker.swarmkit.v1.LogSubscriptionOptions")
  191. proto.RegisterType((*LogSelector)(nil), "docker.swarmkit.v1.LogSelector")
  192. proto.RegisterType((*LogContext)(nil), "docker.swarmkit.v1.LogContext")
  193. proto.RegisterType((*LogAttr)(nil), "docker.swarmkit.v1.LogAttr")
  194. proto.RegisterType((*LogMessage)(nil), "docker.swarmkit.v1.LogMessage")
  195. proto.RegisterType((*SubscribeLogsRequest)(nil), "docker.swarmkit.v1.SubscribeLogsRequest")
  196. proto.RegisterType((*SubscribeLogsMessage)(nil), "docker.swarmkit.v1.SubscribeLogsMessage")
  197. proto.RegisterType((*ListenSubscriptionsRequest)(nil), "docker.swarmkit.v1.ListenSubscriptionsRequest")
  198. proto.RegisterType((*SubscriptionMessage)(nil), "docker.swarmkit.v1.SubscriptionMessage")
  199. proto.RegisterType((*PublishLogsMessage)(nil), "docker.swarmkit.v1.PublishLogsMessage")
  200. proto.RegisterType((*PublishLogsResponse)(nil), "docker.swarmkit.v1.PublishLogsResponse")
  201. proto.RegisterEnum("docker.swarmkit.v1.LogStream", LogStream_name, LogStream_value)
  202. }
  203. type authenticatedWrapperLogsServer struct {
  204. local LogsServer
  205. authorize func(context.Context, []string) error
  206. }
  207. func NewAuthenticatedWrapperLogsServer(local LogsServer, authorize func(context.Context, []string) error) LogsServer {
  208. return &authenticatedWrapperLogsServer{
  209. local: local,
  210. authorize: authorize,
  211. }
  212. }
  213. func (p *authenticatedWrapperLogsServer) SubscribeLogs(r *SubscribeLogsRequest, stream Logs_SubscribeLogsServer) error {
  214. if err := p.authorize(stream.Context(), []string{"swarm-manager"}); err != nil {
  215. return err
  216. }
  217. return p.local.SubscribeLogs(r, stream)
  218. }
  219. type authenticatedWrapperLogBrokerServer struct {
  220. local LogBrokerServer
  221. authorize func(context.Context, []string) error
  222. }
  223. func NewAuthenticatedWrapperLogBrokerServer(local LogBrokerServer, authorize func(context.Context, []string) error) LogBrokerServer {
  224. return &authenticatedWrapperLogBrokerServer{
  225. local: local,
  226. authorize: authorize,
  227. }
  228. }
  229. func (p *authenticatedWrapperLogBrokerServer) ListenSubscriptions(r *ListenSubscriptionsRequest, stream LogBroker_ListenSubscriptionsServer) error {
  230. if err := p.authorize(stream.Context(), []string{"swarm-worker", "swarm-manager"}); err != nil {
  231. return err
  232. }
  233. return p.local.ListenSubscriptions(r, stream)
  234. }
  235. func (p *authenticatedWrapperLogBrokerServer) PublishLogs(stream LogBroker_PublishLogsServer) error {
  236. if err := p.authorize(stream.Context(), []string{"swarm-worker", "swarm-manager"}); err != nil {
  237. return err
  238. }
  239. return p.local.PublishLogs(stream)
  240. }
  241. func (m *LogSubscriptionOptions) Copy() *LogSubscriptionOptions {
  242. if m == nil {
  243. return nil
  244. }
  245. o := &LogSubscriptionOptions{}
  246. o.CopyFrom(m)
  247. return o
  248. }
  249. func (m *LogSubscriptionOptions) CopyFrom(src interface{}) {
  250. o := src.(*LogSubscriptionOptions)
  251. *m = *o
  252. if o.Streams != nil {
  253. m.Streams = make([]LogStream, len(o.Streams))
  254. copy(m.Streams, o.Streams)
  255. }
  256. if o.Since != nil {
  257. m.Since = &google_protobuf.Timestamp{}
  258. github_com_docker_swarmkit_api_deepcopy.Copy(m.Since, o.Since)
  259. }
  260. }
  261. func (m *LogSelector) Copy() *LogSelector {
  262. if m == nil {
  263. return nil
  264. }
  265. o := &LogSelector{}
  266. o.CopyFrom(m)
  267. return o
  268. }
  269. func (m *LogSelector) CopyFrom(src interface{}) {
  270. o := src.(*LogSelector)
  271. *m = *o
  272. if o.ServiceIDs != nil {
  273. m.ServiceIDs = make([]string, len(o.ServiceIDs))
  274. copy(m.ServiceIDs, o.ServiceIDs)
  275. }
  276. if o.NodeIDs != nil {
  277. m.NodeIDs = make([]string, len(o.NodeIDs))
  278. copy(m.NodeIDs, o.NodeIDs)
  279. }
  280. if o.TaskIDs != nil {
  281. m.TaskIDs = make([]string, len(o.TaskIDs))
  282. copy(m.TaskIDs, o.TaskIDs)
  283. }
  284. }
  285. func (m *LogContext) Copy() *LogContext {
  286. if m == nil {
  287. return nil
  288. }
  289. o := &LogContext{}
  290. o.CopyFrom(m)
  291. return o
  292. }
  293. func (m *LogContext) CopyFrom(src interface{}) {
  294. o := src.(*LogContext)
  295. *m = *o
  296. }
  297. func (m *LogAttr) Copy() *LogAttr {
  298. if m == nil {
  299. return nil
  300. }
  301. o := &LogAttr{}
  302. o.CopyFrom(m)
  303. return o
  304. }
  305. func (m *LogAttr) CopyFrom(src interface{}) {
  306. o := src.(*LogAttr)
  307. *m = *o
  308. }
  309. func (m *LogMessage) Copy() *LogMessage {
  310. if m == nil {
  311. return nil
  312. }
  313. o := &LogMessage{}
  314. o.CopyFrom(m)
  315. return o
  316. }
  317. func (m *LogMessage) CopyFrom(src interface{}) {
  318. o := src.(*LogMessage)
  319. *m = *o
  320. github_com_docker_swarmkit_api_deepcopy.Copy(&m.Context, &o.Context)
  321. if o.Timestamp != nil {
  322. m.Timestamp = &google_protobuf.Timestamp{}
  323. github_com_docker_swarmkit_api_deepcopy.Copy(m.Timestamp, o.Timestamp)
  324. }
  325. if o.Data != nil {
  326. m.Data = make([]byte, len(o.Data))
  327. copy(m.Data, o.Data)
  328. }
  329. if o.Attrs != nil {
  330. m.Attrs = make([]LogAttr, len(o.Attrs))
  331. for i := range m.Attrs {
  332. github_com_docker_swarmkit_api_deepcopy.Copy(&m.Attrs[i], &o.Attrs[i])
  333. }
  334. }
  335. }
  336. func (m *SubscribeLogsRequest) Copy() *SubscribeLogsRequest {
  337. if m == nil {
  338. return nil
  339. }
  340. o := &SubscribeLogsRequest{}
  341. o.CopyFrom(m)
  342. return o
  343. }
  344. func (m *SubscribeLogsRequest) CopyFrom(src interface{}) {
  345. o := src.(*SubscribeLogsRequest)
  346. *m = *o
  347. if o.Selector != nil {
  348. m.Selector = &LogSelector{}
  349. github_com_docker_swarmkit_api_deepcopy.Copy(m.Selector, o.Selector)
  350. }
  351. if o.Options != nil {
  352. m.Options = &LogSubscriptionOptions{}
  353. github_com_docker_swarmkit_api_deepcopy.Copy(m.Options, o.Options)
  354. }
  355. }
  356. func (m *SubscribeLogsMessage) Copy() *SubscribeLogsMessage {
  357. if m == nil {
  358. return nil
  359. }
  360. o := &SubscribeLogsMessage{}
  361. o.CopyFrom(m)
  362. return o
  363. }
  364. func (m *SubscribeLogsMessage) CopyFrom(src interface{}) {
  365. o := src.(*SubscribeLogsMessage)
  366. *m = *o
  367. if o.Messages != nil {
  368. m.Messages = make([]LogMessage, len(o.Messages))
  369. for i := range m.Messages {
  370. github_com_docker_swarmkit_api_deepcopy.Copy(&m.Messages[i], &o.Messages[i])
  371. }
  372. }
  373. }
  374. func (m *ListenSubscriptionsRequest) Copy() *ListenSubscriptionsRequest {
  375. if m == nil {
  376. return nil
  377. }
  378. o := &ListenSubscriptionsRequest{}
  379. o.CopyFrom(m)
  380. return o
  381. }
  382. func (m *ListenSubscriptionsRequest) CopyFrom(src interface{}) {}
  383. func (m *SubscriptionMessage) Copy() *SubscriptionMessage {
  384. if m == nil {
  385. return nil
  386. }
  387. o := &SubscriptionMessage{}
  388. o.CopyFrom(m)
  389. return o
  390. }
  391. func (m *SubscriptionMessage) CopyFrom(src interface{}) {
  392. o := src.(*SubscriptionMessage)
  393. *m = *o
  394. if o.Selector != nil {
  395. m.Selector = &LogSelector{}
  396. github_com_docker_swarmkit_api_deepcopy.Copy(m.Selector, o.Selector)
  397. }
  398. if o.Options != nil {
  399. m.Options = &LogSubscriptionOptions{}
  400. github_com_docker_swarmkit_api_deepcopy.Copy(m.Options, o.Options)
  401. }
  402. }
  403. func (m *PublishLogsMessage) Copy() *PublishLogsMessage {
  404. if m == nil {
  405. return nil
  406. }
  407. o := &PublishLogsMessage{}
  408. o.CopyFrom(m)
  409. return o
  410. }
  411. func (m *PublishLogsMessage) CopyFrom(src interface{}) {
  412. o := src.(*PublishLogsMessage)
  413. *m = *o
  414. if o.Messages != nil {
  415. m.Messages = make([]LogMessage, len(o.Messages))
  416. for i := range m.Messages {
  417. github_com_docker_swarmkit_api_deepcopy.Copy(&m.Messages[i], &o.Messages[i])
  418. }
  419. }
  420. }
  421. func (m *PublishLogsResponse) Copy() *PublishLogsResponse {
  422. if m == nil {
  423. return nil
  424. }
  425. o := &PublishLogsResponse{}
  426. o.CopyFrom(m)
  427. return o
  428. }
  429. func (m *PublishLogsResponse) CopyFrom(src interface{}) {}
  430. // Reference imports to suppress errors if they are not otherwise used.
  431. var _ context.Context
  432. var _ grpc.ClientConn
  433. // This is a compile-time assertion to ensure that this generated file
  434. // is compatible with the grpc package it is being compiled against.
  435. const _ = grpc.SupportPackageIsVersion4
  436. // Client API for Logs service
  437. type LogsClient interface {
  438. // SubscribeLogs starts a subscription with the specified selector and options.
  439. //
  440. // The subscription will be distributed to relevant nodes and messages will
  441. // be collected and sent via the returned stream.
  442. //
  443. // The subscription will end with an EOF.
  444. SubscribeLogs(ctx context.Context, in *SubscribeLogsRequest, opts ...grpc.CallOption) (Logs_SubscribeLogsClient, error)
  445. }
  446. type logsClient struct {
  447. cc *grpc.ClientConn
  448. }
  449. func NewLogsClient(cc *grpc.ClientConn) LogsClient {
  450. return &logsClient{cc}
  451. }
  452. func (c *logsClient) SubscribeLogs(ctx context.Context, in *SubscribeLogsRequest, opts ...grpc.CallOption) (Logs_SubscribeLogsClient, error) {
  453. stream, err := grpc.NewClientStream(ctx, &_Logs_serviceDesc.Streams[0], c.cc, "/docker.swarmkit.v1.Logs/SubscribeLogs", opts...)
  454. if err != nil {
  455. return nil, err
  456. }
  457. x := &logsSubscribeLogsClient{stream}
  458. if err := x.ClientStream.SendMsg(in); err != nil {
  459. return nil, err
  460. }
  461. if err := x.ClientStream.CloseSend(); err != nil {
  462. return nil, err
  463. }
  464. return x, nil
  465. }
  466. type Logs_SubscribeLogsClient interface {
  467. Recv() (*SubscribeLogsMessage, error)
  468. grpc.ClientStream
  469. }
  470. type logsSubscribeLogsClient struct {
  471. grpc.ClientStream
  472. }
  473. func (x *logsSubscribeLogsClient) Recv() (*SubscribeLogsMessage, error) {
  474. m := new(SubscribeLogsMessage)
  475. if err := x.ClientStream.RecvMsg(m); err != nil {
  476. return nil, err
  477. }
  478. return m, nil
  479. }
  480. // Server API for Logs service
  481. type LogsServer interface {
  482. // SubscribeLogs starts a subscription with the specified selector and options.
  483. //
  484. // The subscription will be distributed to relevant nodes and messages will
  485. // be collected and sent via the returned stream.
  486. //
  487. // The subscription will end with an EOF.
  488. SubscribeLogs(*SubscribeLogsRequest, Logs_SubscribeLogsServer) error
  489. }
  490. func RegisterLogsServer(s *grpc.Server, srv LogsServer) {
  491. s.RegisterService(&_Logs_serviceDesc, srv)
  492. }
  493. func _Logs_SubscribeLogs_Handler(srv interface{}, stream grpc.ServerStream) error {
  494. m := new(SubscribeLogsRequest)
  495. if err := stream.RecvMsg(m); err != nil {
  496. return err
  497. }
  498. return srv.(LogsServer).SubscribeLogs(m, &logsSubscribeLogsServer{stream})
  499. }
  500. type Logs_SubscribeLogsServer interface {
  501. Send(*SubscribeLogsMessage) error
  502. grpc.ServerStream
  503. }
  504. type logsSubscribeLogsServer struct {
  505. grpc.ServerStream
  506. }
  507. func (x *logsSubscribeLogsServer) Send(m *SubscribeLogsMessage) error {
  508. return x.ServerStream.SendMsg(m)
  509. }
  510. var _Logs_serviceDesc = grpc.ServiceDesc{
  511. ServiceName: "docker.swarmkit.v1.Logs",
  512. HandlerType: (*LogsServer)(nil),
  513. Methods: []grpc.MethodDesc{},
  514. Streams: []grpc.StreamDesc{
  515. {
  516. StreamName: "SubscribeLogs",
  517. Handler: _Logs_SubscribeLogs_Handler,
  518. ServerStreams: true,
  519. },
  520. },
  521. Metadata: "logbroker.proto",
  522. }
  523. // Client API for LogBroker service
  524. type LogBrokerClient interface {
  525. // ListenSubscriptions starts a subscription stream for the node. For each
  526. // message received, the node should attempt to satisfy the subscription.
  527. //
  528. // Log messages that match the provided subscription should be sent via
  529. // PublishLogs.
  530. ListenSubscriptions(ctx context.Context, in *ListenSubscriptionsRequest, opts ...grpc.CallOption) (LogBroker_ListenSubscriptionsClient, error)
  531. // PublishLogs receives sets of log messages destined for a single
  532. // subscription identifier.
  533. PublishLogs(ctx context.Context, opts ...grpc.CallOption) (LogBroker_PublishLogsClient, error)
  534. }
  535. type logBrokerClient struct {
  536. cc *grpc.ClientConn
  537. }
  538. func NewLogBrokerClient(cc *grpc.ClientConn) LogBrokerClient {
  539. return &logBrokerClient{cc}
  540. }
  541. func (c *logBrokerClient) ListenSubscriptions(ctx context.Context, in *ListenSubscriptionsRequest, opts ...grpc.CallOption) (LogBroker_ListenSubscriptionsClient, error) {
  542. stream, err := grpc.NewClientStream(ctx, &_LogBroker_serviceDesc.Streams[0], c.cc, "/docker.swarmkit.v1.LogBroker/ListenSubscriptions", opts...)
  543. if err != nil {
  544. return nil, err
  545. }
  546. x := &logBrokerListenSubscriptionsClient{stream}
  547. if err := x.ClientStream.SendMsg(in); err != nil {
  548. return nil, err
  549. }
  550. if err := x.ClientStream.CloseSend(); err != nil {
  551. return nil, err
  552. }
  553. return x, nil
  554. }
  555. type LogBroker_ListenSubscriptionsClient interface {
  556. Recv() (*SubscriptionMessage, error)
  557. grpc.ClientStream
  558. }
  559. type logBrokerListenSubscriptionsClient struct {
  560. grpc.ClientStream
  561. }
  562. func (x *logBrokerListenSubscriptionsClient) Recv() (*SubscriptionMessage, error) {
  563. m := new(SubscriptionMessage)
  564. if err := x.ClientStream.RecvMsg(m); err != nil {
  565. return nil, err
  566. }
  567. return m, nil
  568. }
  569. func (c *logBrokerClient) PublishLogs(ctx context.Context, opts ...grpc.CallOption) (LogBroker_PublishLogsClient, error) {
  570. stream, err := grpc.NewClientStream(ctx, &_LogBroker_serviceDesc.Streams[1], c.cc, "/docker.swarmkit.v1.LogBroker/PublishLogs", opts...)
  571. if err != nil {
  572. return nil, err
  573. }
  574. x := &logBrokerPublishLogsClient{stream}
  575. return x, nil
  576. }
  577. type LogBroker_PublishLogsClient interface {
  578. Send(*PublishLogsMessage) error
  579. CloseAndRecv() (*PublishLogsResponse, error)
  580. grpc.ClientStream
  581. }
  582. type logBrokerPublishLogsClient struct {
  583. grpc.ClientStream
  584. }
  585. func (x *logBrokerPublishLogsClient) Send(m *PublishLogsMessage) error {
  586. return x.ClientStream.SendMsg(m)
  587. }
  588. func (x *logBrokerPublishLogsClient) CloseAndRecv() (*PublishLogsResponse, error) {
  589. if err := x.ClientStream.CloseSend(); err != nil {
  590. return nil, err
  591. }
  592. m := new(PublishLogsResponse)
  593. if err := x.ClientStream.RecvMsg(m); err != nil {
  594. return nil, err
  595. }
  596. return m, nil
  597. }
  598. // Server API for LogBroker service
  599. type LogBrokerServer interface {
  600. // ListenSubscriptions starts a subscription stream for the node. For each
  601. // message received, the node should attempt to satisfy the subscription.
  602. //
  603. // Log messages that match the provided subscription should be sent via
  604. // PublishLogs.
  605. ListenSubscriptions(*ListenSubscriptionsRequest, LogBroker_ListenSubscriptionsServer) error
  606. // PublishLogs receives sets of log messages destined for a single
  607. // subscription identifier.
  608. PublishLogs(LogBroker_PublishLogsServer) error
  609. }
  610. func RegisterLogBrokerServer(s *grpc.Server, srv LogBrokerServer) {
  611. s.RegisterService(&_LogBroker_serviceDesc, srv)
  612. }
  613. func _LogBroker_ListenSubscriptions_Handler(srv interface{}, stream grpc.ServerStream) error {
  614. m := new(ListenSubscriptionsRequest)
  615. if err := stream.RecvMsg(m); err != nil {
  616. return err
  617. }
  618. return srv.(LogBrokerServer).ListenSubscriptions(m, &logBrokerListenSubscriptionsServer{stream})
  619. }
  620. type LogBroker_ListenSubscriptionsServer interface {
  621. Send(*SubscriptionMessage) error
  622. grpc.ServerStream
  623. }
  624. type logBrokerListenSubscriptionsServer struct {
  625. grpc.ServerStream
  626. }
  627. func (x *logBrokerListenSubscriptionsServer) Send(m *SubscriptionMessage) error {
  628. return x.ServerStream.SendMsg(m)
  629. }
  630. func _LogBroker_PublishLogs_Handler(srv interface{}, stream grpc.ServerStream) error {
  631. return srv.(LogBrokerServer).PublishLogs(&logBrokerPublishLogsServer{stream})
  632. }
  633. type LogBroker_PublishLogsServer interface {
  634. SendAndClose(*PublishLogsResponse) error
  635. Recv() (*PublishLogsMessage, error)
  636. grpc.ServerStream
  637. }
  638. type logBrokerPublishLogsServer struct {
  639. grpc.ServerStream
  640. }
  641. func (x *logBrokerPublishLogsServer) SendAndClose(m *PublishLogsResponse) error {
  642. return x.ServerStream.SendMsg(m)
  643. }
  644. func (x *logBrokerPublishLogsServer) Recv() (*PublishLogsMessage, error) {
  645. m := new(PublishLogsMessage)
  646. if err := x.ServerStream.RecvMsg(m); err != nil {
  647. return nil, err
  648. }
  649. return m, nil
  650. }
  651. var _LogBroker_serviceDesc = grpc.ServiceDesc{
  652. ServiceName: "docker.swarmkit.v1.LogBroker",
  653. HandlerType: (*LogBrokerServer)(nil),
  654. Methods: []grpc.MethodDesc{},
  655. Streams: []grpc.StreamDesc{
  656. {
  657. StreamName: "ListenSubscriptions",
  658. Handler: _LogBroker_ListenSubscriptions_Handler,
  659. ServerStreams: true,
  660. },
  661. {
  662. StreamName: "PublishLogs",
  663. Handler: _LogBroker_PublishLogs_Handler,
  664. ClientStreams: true,
  665. },
  666. },
  667. Metadata: "logbroker.proto",
  668. }
  669. func (m *LogSubscriptionOptions) 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 *LogSubscriptionOptions) MarshalTo(dAtA []byte) (int, error) {
  679. var i int
  680. _ = i
  681. var l int
  682. _ = l
  683. if len(m.Streams) > 0 {
  684. for _, num := range m.Streams {
  685. dAtA[i] = 0x8
  686. i++
  687. i = encodeVarintLogbroker(dAtA, i, uint64(num))
  688. }
  689. }
  690. if m.Follow {
  691. dAtA[i] = 0x10
  692. i++
  693. if m.Follow {
  694. dAtA[i] = 1
  695. } else {
  696. dAtA[i] = 0
  697. }
  698. i++
  699. }
  700. if m.Tail != 0 {
  701. dAtA[i] = 0x18
  702. i++
  703. i = encodeVarintLogbroker(dAtA, i, uint64(m.Tail))
  704. }
  705. if m.Since != nil {
  706. dAtA[i] = 0x22
  707. i++
  708. i = encodeVarintLogbroker(dAtA, i, uint64(m.Since.Size()))
  709. n1, err := m.Since.MarshalTo(dAtA[i:])
  710. if err != nil {
  711. return 0, err
  712. }
  713. i += n1
  714. }
  715. return i, nil
  716. }
  717. func (m *LogSelector) 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 *LogSelector) MarshalTo(dAtA []byte) (int, error) {
  727. var i int
  728. _ = i
  729. var l int
  730. _ = l
  731. if len(m.ServiceIDs) > 0 {
  732. for _, s := range m.ServiceIDs {
  733. dAtA[i] = 0xa
  734. i++
  735. l = len(s)
  736. for l >= 1<<7 {
  737. dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
  738. l >>= 7
  739. i++
  740. }
  741. dAtA[i] = uint8(l)
  742. i++
  743. i += copy(dAtA[i:], s)
  744. }
  745. }
  746. if len(m.NodeIDs) > 0 {
  747. for _, s := range m.NodeIDs {
  748. dAtA[i] = 0x12
  749. i++
  750. l = len(s)
  751. for l >= 1<<7 {
  752. dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
  753. l >>= 7
  754. i++
  755. }
  756. dAtA[i] = uint8(l)
  757. i++
  758. i += copy(dAtA[i:], s)
  759. }
  760. }
  761. if len(m.TaskIDs) > 0 {
  762. for _, s := range m.TaskIDs {
  763. dAtA[i] = 0x1a
  764. i++
  765. l = len(s)
  766. for l >= 1<<7 {
  767. dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
  768. l >>= 7
  769. i++
  770. }
  771. dAtA[i] = uint8(l)
  772. i++
  773. i += copy(dAtA[i:], s)
  774. }
  775. }
  776. return i, nil
  777. }
  778. func (m *LogContext) Marshal() (dAtA []byte, err error) {
  779. size := m.Size()
  780. dAtA = make([]byte, size)
  781. n, err := m.MarshalTo(dAtA)
  782. if err != nil {
  783. return nil, err
  784. }
  785. return dAtA[:n], nil
  786. }
  787. func (m *LogContext) MarshalTo(dAtA []byte) (int, error) {
  788. var i int
  789. _ = i
  790. var l int
  791. _ = l
  792. if len(m.ServiceID) > 0 {
  793. dAtA[i] = 0xa
  794. i++
  795. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.ServiceID)))
  796. i += copy(dAtA[i:], m.ServiceID)
  797. }
  798. if len(m.NodeID) > 0 {
  799. dAtA[i] = 0x12
  800. i++
  801. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.NodeID)))
  802. i += copy(dAtA[i:], m.NodeID)
  803. }
  804. if len(m.TaskID) > 0 {
  805. dAtA[i] = 0x1a
  806. i++
  807. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.TaskID)))
  808. i += copy(dAtA[i:], m.TaskID)
  809. }
  810. return i, nil
  811. }
  812. func (m *LogAttr) Marshal() (dAtA []byte, err error) {
  813. size := m.Size()
  814. dAtA = make([]byte, size)
  815. n, err := m.MarshalTo(dAtA)
  816. if err != nil {
  817. return nil, err
  818. }
  819. return dAtA[:n], nil
  820. }
  821. func (m *LogAttr) MarshalTo(dAtA []byte) (int, error) {
  822. var i int
  823. _ = i
  824. var l int
  825. _ = l
  826. if len(m.Key) > 0 {
  827. dAtA[i] = 0xa
  828. i++
  829. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.Key)))
  830. i += copy(dAtA[i:], m.Key)
  831. }
  832. if len(m.Value) > 0 {
  833. dAtA[i] = 0x12
  834. i++
  835. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.Value)))
  836. i += copy(dAtA[i:], m.Value)
  837. }
  838. return i, nil
  839. }
  840. func (m *LogMessage) Marshal() (dAtA []byte, err error) {
  841. size := m.Size()
  842. dAtA = make([]byte, size)
  843. n, err := m.MarshalTo(dAtA)
  844. if err != nil {
  845. return nil, err
  846. }
  847. return dAtA[:n], nil
  848. }
  849. func (m *LogMessage) MarshalTo(dAtA []byte) (int, error) {
  850. var i int
  851. _ = i
  852. var l int
  853. _ = l
  854. dAtA[i] = 0xa
  855. i++
  856. i = encodeVarintLogbroker(dAtA, i, uint64(m.Context.Size()))
  857. n2, err := m.Context.MarshalTo(dAtA[i:])
  858. if err != nil {
  859. return 0, err
  860. }
  861. i += n2
  862. if m.Timestamp != nil {
  863. dAtA[i] = 0x12
  864. i++
  865. i = encodeVarintLogbroker(dAtA, i, uint64(m.Timestamp.Size()))
  866. n3, err := m.Timestamp.MarshalTo(dAtA[i:])
  867. if err != nil {
  868. return 0, err
  869. }
  870. i += n3
  871. }
  872. if m.Stream != 0 {
  873. dAtA[i] = 0x18
  874. i++
  875. i = encodeVarintLogbroker(dAtA, i, uint64(m.Stream))
  876. }
  877. if len(m.Data) > 0 {
  878. dAtA[i] = 0x22
  879. i++
  880. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.Data)))
  881. i += copy(dAtA[i:], m.Data)
  882. }
  883. if len(m.Attrs) > 0 {
  884. for _, msg := range m.Attrs {
  885. dAtA[i] = 0x2a
  886. i++
  887. i = encodeVarintLogbroker(dAtA, i, uint64(msg.Size()))
  888. n, err := msg.MarshalTo(dAtA[i:])
  889. if err != nil {
  890. return 0, err
  891. }
  892. i += n
  893. }
  894. }
  895. return i, nil
  896. }
  897. func (m *SubscribeLogsRequest) Marshal() (dAtA []byte, err error) {
  898. size := m.Size()
  899. dAtA = make([]byte, size)
  900. n, err := m.MarshalTo(dAtA)
  901. if err != nil {
  902. return nil, err
  903. }
  904. return dAtA[:n], nil
  905. }
  906. func (m *SubscribeLogsRequest) MarshalTo(dAtA []byte) (int, error) {
  907. var i int
  908. _ = i
  909. var l int
  910. _ = l
  911. if m.Selector != nil {
  912. dAtA[i] = 0xa
  913. i++
  914. i = encodeVarintLogbroker(dAtA, i, uint64(m.Selector.Size()))
  915. n4, err := m.Selector.MarshalTo(dAtA[i:])
  916. if err != nil {
  917. return 0, err
  918. }
  919. i += n4
  920. }
  921. if m.Options != nil {
  922. dAtA[i] = 0x12
  923. i++
  924. i = encodeVarintLogbroker(dAtA, i, uint64(m.Options.Size()))
  925. n5, err := m.Options.MarshalTo(dAtA[i:])
  926. if err != nil {
  927. return 0, err
  928. }
  929. i += n5
  930. }
  931. return i, nil
  932. }
  933. func (m *SubscribeLogsMessage) Marshal() (dAtA []byte, err error) {
  934. size := m.Size()
  935. dAtA = make([]byte, size)
  936. n, err := m.MarshalTo(dAtA)
  937. if err != nil {
  938. return nil, err
  939. }
  940. return dAtA[:n], nil
  941. }
  942. func (m *SubscribeLogsMessage) MarshalTo(dAtA []byte) (int, error) {
  943. var i int
  944. _ = i
  945. var l int
  946. _ = l
  947. if len(m.Messages) > 0 {
  948. for _, msg := range m.Messages {
  949. dAtA[i] = 0xa
  950. i++
  951. i = encodeVarintLogbroker(dAtA, i, uint64(msg.Size()))
  952. n, err := msg.MarshalTo(dAtA[i:])
  953. if err != nil {
  954. return 0, err
  955. }
  956. i += n
  957. }
  958. }
  959. return i, nil
  960. }
  961. func (m *ListenSubscriptionsRequest) Marshal() (dAtA []byte, err error) {
  962. size := m.Size()
  963. dAtA = make([]byte, size)
  964. n, err := m.MarshalTo(dAtA)
  965. if err != nil {
  966. return nil, err
  967. }
  968. return dAtA[:n], nil
  969. }
  970. func (m *ListenSubscriptionsRequest) MarshalTo(dAtA []byte) (int, error) {
  971. var i int
  972. _ = i
  973. var l int
  974. _ = l
  975. return i, nil
  976. }
  977. func (m *SubscriptionMessage) Marshal() (dAtA []byte, err error) {
  978. size := m.Size()
  979. dAtA = make([]byte, size)
  980. n, err := m.MarshalTo(dAtA)
  981. if err != nil {
  982. return nil, err
  983. }
  984. return dAtA[:n], nil
  985. }
  986. func (m *SubscriptionMessage) MarshalTo(dAtA []byte) (int, error) {
  987. var i int
  988. _ = i
  989. var l int
  990. _ = l
  991. if len(m.ID) > 0 {
  992. dAtA[i] = 0xa
  993. i++
  994. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.ID)))
  995. i += copy(dAtA[i:], m.ID)
  996. }
  997. if m.Selector != nil {
  998. dAtA[i] = 0x12
  999. i++
  1000. i = encodeVarintLogbroker(dAtA, i, uint64(m.Selector.Size()))
  1001. n6, err := m.Selector.MarshalTo(dAtA[i:])
  1002. if err != nil {
  1003. return 0, err
  1004. }
  1005. i += n6
  1006. }
  1007. if m.Options != nil {
  1008. dAtA[i] = 0x1a
  1009. i++
  1010. i = encodeVarintLogbroker(dAtA, i, uint64(m.Options.Size()))
  1011. n7, err := m.Options.MarshalTo(dAtA[i:])
  1012. if err != nil {
  1013. return 0, err
  1014. }
  1015. i += n7
  1016. }
  1017. if m.Close {
  1018. dAtA[i] = 0x20
  1019. i++
  1020. if m.Close {
  1021. dAtA[i] = 1
  1022. } else {
  1023. dAtA[i] = 0
  1024. }
  1025. i++
  1026. }
  1027. return i, nil
  1028. }
  1029. func (m *PublishLogsMessage) Marshal() (dAtA []byte, err error) {
  1030. size := m.Size()
  1031. dAtA = make([]byte, size)
  1032. n, err := m.MarshalTo(dAtA)
  1033. if err != nil {
  1034. return nil, err
  1035. }
  1036. return dAtA[:n], nil
  1037. }
  1038. func (m *PublishLogsMessage) MarshalTo(dAtA []byte) (int, error) {
  1039. var i int
  1040. _ = i
  1041. var l int
  1042. _ = l
  1043. if len(m.SubscriptionID) > 0 {
  1044. dAtA[i] = 0xa
  1045. i++
  1046. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.SubscriptionID)))
  1047. i += copy(dAtA[i:], m.SubscriptionID)
  1048. }
  1049. if len(m.Messages) > 0 {
  1050. for _, msg := range m.Messages {
  1051. dAtA[i] = 0x12
  1052. i++
  1053. i = encodeVarintLogbroker(dAtA, i, uint64(msg.Size()))
  1054. n, err := msg.MarshalTo(dAtA[i:])
  1055. if err != nil {
  1056. return 0, err
  1057. }
  1058. i += n
  1059. }
  1060. }
  1061. if m.Close {
  1062. dAtA[i] = 0x18
  1063. i++
  1064. if m.Close {
  1065. dAtA[i] = 1
  1066. } else {
  1067. dAtA[i] = 0
  1068. }
  1069. i++
  1070. }
  1071. return i, nil
  1072. }
  1073. func (m *PublishLogsResponse) Marshal() (dAtA []byte, err error) {
  1074. size := m.Size()
  1075. dAtA = make([]byte, size)
  1076. n, err := m.MarshalTo(dAtA)
  1077. if err != nil {
  1078. return nil, err
  1079. }
  1080. return dAtA[:n], nil
  1081. }
  1082. func (m *PublishLogsResponse) MarshalTo(dAtA []byte) (int, error) {
  1083. var i int
  1084. _ = i
  1085. var l int
  1086. _ = l
  1087. return i, nil
  1088. }
  1089. func encodeFixed64Logbroker(dAtA []byte, offset int, v uint64) int {
  1090. dAtA[offset] = uint8(v)
  1091. dAtA[offset+1] = uint8(v >> 8)
  1092. dAtA[offset+2] = uint8(v >> 16)
  1093. dAtA[offset+3] = uint8(v >> 24)
  1094. dAtA[offset+4] = uint8(v >> 32)
  1095. dAtA[offset+5] = uint8(v >> 40)
  1096. dAtA[offset+6] = uint8(v >> 48)
  1097. dAtA[offset+7] = uint8(v >> 56)
  1098. return offset + 8
  1099. }
  1100. func encodeFixed32Logbroker(dAtA []byte, offset int, v uint32) int {
  1101. dAtA[offset] = uint8(v)
  1102. dAtA[offset+1] = uint8(v >> 8)
  1103. dAtA[offset+2] = uint8(v >> 16)
  1104. dAtA[offset+3] = uint8(v >> 24)
  1105. return offset + 4
  1106. }
  1107. func encodeVarintLogbroker(dAtA []byte, offset int, v uint64) int {
  1108. for v >= 1<<7 {
  1109. dAtA[offset] = uint8(v&0x7f | 0x80)
  1110. v >>= 7
  1111. offset++
  1112. }
  1113. dAtA[offset] = uint8(v)
  1114. return offset + 1
  1115. }
  1116. type raftProxyLogsServer struct {
  1117. local LogsServer
  1118. connSelector raftselector.ConnProvider
  1119. localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error)
  1120. }
  1121. func NewRaftProxyLogsServer(local LogsServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) LogsServer {
  1122. redirectChecker := func(ctx context.Context) (context.Context, error) {
  1123. s, ok := transport.StreamFromContext(ctx)
  1124. if !ok {
  1125. return ctx, grpc.Errorf(codes.InvalidArgument, "remote addr is not found in context")
  1126. }
  1127. addr := s.ServerTransport().RemoteAddr().String()
  1128. md, ok := metadata.FromContext(ctx)
  1129. if ok && len(md["redirect"]) != 0 {
  1130. return ctx, grpc.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"])
  1131. }
  1132. if !ok {
  1133. md = metadata.New(map[string]string{})
  1134. }
  1135. md["redirect"] = append(md["redirect"], addr)
  1136. return metadata.NewContext(ctx, md), nil
  1137. }
  1138. remoteMods := []func(context.Context) (context.Context, error){redirectChecker}
  1139. remoteMods = append(remoteMods, remoteCtxMod)
  1140. var localMods []func(context.Context) (context.Context, error)
  1141. if localCtxMod != nil {
  1142. localMods = []func(context.Context) (context.Context, error){localCtxMod}
  1143. }
  1144. return &raftProxyLogsServer{
  1145. local: local,
  1146. connSelector: connSelector,
  1147. localCtxMods: localMods,
  1148. remoteCtxMods: remoteMods,
  1149. }
  1150. }
  1151. func (p *raftProxyLogsServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
  1152. var err error
  1153. for _, mod := range ctxMods {
  1154. ctx, err = mod(ctx)
  1155. if err != nil {
  1156. return ctx, err
  1157. }
  1158. }
  1159. return ctx, nil
  1160. }
  1161. func (p *raftProxyLogsServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
  1162. ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
  1163. defer ticker.Stop()
  1164. for {
  1165. select {
  1166. case <-ticker.C:
  1167. conn, err := p.connSelector.LeaderConn(ctx)
  1168. if err != nil {
  1169. return nil, err
  1170. }
  1171. client := NewHealthClient(conn)
  1172. resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"})
  1173. if err != nil || resp.Status != HealthCheckResponse_SERVING {
  1174. continue
  1175. }
  1176. return conn, nil
  1177. case <-ctx.Done():
  1178. return nil, ctx.Err()
  1179. }
  1180. }
  1181. }
  1182. type Logs_SubscribeLogsServerWrapper struct {
  1183. Logs_SubscribeLogsServer
  1184. ctx context.Context
  1185. }
  1186. func (s Logs_SubscribeLogsServerWrapper) Context() context.Context {
  1187. return s.ctx
  1188. }
  1189. func (p *raftProxyLogsServer) SubscribeLogs(r *SubscribeLogsRequest, stream Logs_SubscribeLogsServer) error {
  1190. ctx := stream.Context()
  1191. conn, err := p.connSelector.LeaderConn(ctx)
  1192. if err != nil {
  1193. if err == raftselector.ErrIsLeader {
  1194. ctx, err = p.runCtxMods(ctx, p.localCtxMods)
  1195. if err != nil {
  1196. return err
  1197. }
  1198. streamWrapper := Logs_SubscribeLogsServerWrapper{
  1199. Logs_SubscribeLogsServer: stream,
  1200. ctx: ctx,
  1201. }
  1202. return p.local.SubscribeLogs(r, streamWrapper)
  1203. }
  1204. return err
  1205. }
  1206. ctx, err = p.runCtxMods(ctx, p.remoteCtxMods)
  1207. if err != nil {
  1208. return err
  1209. }
  1210. clientStream, err := NewLogsClient(conn).SubscribeLogs(ctx, r)
  1211. if err != nil {
  1212. return err
  1213. }
  1214. for {
  1215. msg, err := clientStream.Recv()
  1216. if err == io.EOF {
  1217. break
  1218. }
  1219. if err != nil {
  1220. return err
  1221. }
  1222. if err := stream.Send(msg); err != nil {
  1223. return err
  1224. }
  1225. }
  1226. return nil
  1227. }
  1228. type raftProxyLogBrokerServer struct {
  1229. local LogBrokerServer
  1230. connSelector raftselector.ConnProvider
  1231. localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error)
  1232. }
  1233. func NewRaftProxyLogBrokerServer(local LogBrokerServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) LogBrokerServer {
  1234. redirectChecker := func(ctx context.Context) (context.Context, error) {
  1235. s, ok := transport.StreamFromContext(ctx)
  1236. if !ok {
  1237. return ctx, grpc.Errorf(codes.InvalidArgument, "remote addr is not found in context")
  1238. }
  1239. addr := s.ServerTransport().RemoteAddr().String()
  1240. md, ok := metadata.FromContext(ctx)
  1241. if ok && len(md["redirect"]) != 0 {
  1242. return ctx, grpc.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"])
  1243. }
  1244. if !ok {
  1245. md = metadata.New(map[string]string{})
  1246. }
  1247. md["redirect"] = append(md["redirect"], addr)
  1248. return metadata.NewContext(ctx, md), nil
  1249. }
  1250. remoteMods := []func(context.Context) (context.Context, error){redirectChecker}
  1251. remoteMods = append(remoteMods, remoteCtxMod)
  1252. var localMods []func(context.Context) (context.Context, error)
  1253. if localCtxMod != nil {
  1254. localMods = []func(context.Context) (context.Context, error){localCtxMod}
  1255. }
  1256. return &raftProxyLogBrokerServer{
  1257. local: local,
  1258. connSelector: connSelector,
  1259. localCtxMods: localMods,
  1260. remoteCtxMods: remoteMods,
  1261. }
  1262. }
  1263. func (p *raftProxyLogBrokerServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
  1264. var err error
  1265. for _, mod := range ctxMods {
  1266. ctx, err = mod(ctx)
  1267. if err != nil {
  1268. return ctx, err
  1269. }
  1270. }
  1271. return ctx, nil
  1272. }
  1273. func (p *raftProxyLogBrokerServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
  1274. ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
  1275. defer ticker.Stop()
  1276. for {
  1277. select {
  1278. case <-ticker.C:
  1279. conn, err := p.connSelector.LeaderConn(ctx)
  1280. if err != nil {
  1281. return nil, err
  1282. }
  1283. client := NewHealthClient(conn)
  1284. resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"})
  1285. if err != nil || resp.Status != HealthCheckResponse_SERVING {
  1286. continue
  1287. }
  1288. return conn, nil
  1289. case <-ctx.Done():
  1290. return nil, ctx.Err()
  1291. }
  1292. }
  1293. }
  1294. type LogBroker_ListenSubscriptionsServerWrapper struct {
  1295. LogBroker_ListenSubscriptionsServer
  1296. ctx context.Context
  1297. }
  1298. func (s LogBroker_ListenSubscriptionsServerWrapper) Context() context.Context {
  1299. return s.ctx
  1300. }
  1301. func (p *raftProxyLogBrokerServer) ListenSubscriptions(r *ListenSubscriptionsRequest, stream LogBroker_ListenSubscriptionsServer) error {
  1302. ctx := stream.Context()
  1303. conn, err := p.connSelector.LeaderConn(ctx)
  1304. if err != nil {
  1305. if err == raftselector.ErrIsLeader {
  1306. ctx, err = p.runCtxMods(ctx, p.localCtxMods)
  1307. if err != nil {
  1308. return err
  1309. }
  1310. streamWrapper := LogBroker_ListenSubscriptionsServerWrapper{
  1311. LogBroker_ListenSubscriptionsServer: stream,
  1312. ctx: ctx,
  1313. }
  1314. return p.local.ListenSubscriptions(r, streamWrapper)
  1315. }
  1316. return err
  1317. }
  1318. ctx, err = p.runCtxMods(ctx, p.remoteCtxMods)
  1319. if err != nil {
  1320. return err
  1321. }
  1322. clientStream, err := NewLogBrokerClient(conn).ListenSubscriptions(ctx, r)
  1323. if err != nil {
  1324. return err
  1325. }
  1326. for {
  1327. msg, err := clientStream.Recv()
  1328. if err == io.EOF {
  1329. break
  1330. }
  1331. if err != nil {
  1332. return err
  1333. }
  1334. if err := stream.Send(msg); err != nil {
  1335. return err
  1336. }
  1337. }
  1338. return nil
  1339. }
  1340. type LogBroker_PublishLogsServerWrapper struct {
  1341. LogBroker_PublishLogsServer
  1342. ctx context.Context
  1343. }
  1344. func (s LogBroker_PublishLogsServerWrapper) Context() context.Context {
  1345. return s.ctx
  1346. }
  1347. func (p *raftProxyLogBrokerServer) PublishLogs(stream LogBroker_PublishLogsServer) error {
  1348. ctx := stream.Context()
  1349. conn, err := p.connSelector.LeaderConn(ctx)
  1350. if err != nil {
  1351. if err == raftselector.ErrIsLeader {
  1352. ctx, err = p.runCtxMods(ctx, p.localCtxMods)
  1353. if err != nil {
  1354. return err
  1355. }
  1356. streamWrapper := LogBroker_PublishLogsServerWrapper{
  1357. LogBroker_PublishLogsServer: stream,
  1358. ctx: ctx,
  1359. }
  1360. return p.local.PublishLogs(streamWrapper)
  1361. }
  1362. return err
  1363. }
  1364. ctx, err = p.runCtxMods(ctx, p.remoteCtxMods)
  1365. if err != nil {
  1366. return err
  1367. }
  1368. clientStream, err := NewLogBrokerClient(conn).PublishLogs(ctx)
  1369. if err != nil {
  1370. return err
  1371. }
  1372. for {
  1373. msg, err := stream.Recv()
  1374. if err == io.EOF {
  1375. break
  1376. }
  1377. if err != nil {
  1378. return err
  1379. }
  1380. if err := clientStream.Send(msg); err != nil {
  1381. return err
  1382. }
  1383. }
  1384. reply, err := clientStream.CloseAndRecv()
  1385. if err != nil {
  1386. return err
  1387. }
  1388. return stream.SendAndClose(reply)
  1389. }
  1390. func (m *LogSubscriptionOptions) Size() (n int) {
  1391. var l int
  1392. _ = l
  1393. if len(m.Streams) > 0 {
  1394. for _, e := range m.Streams {
  1395. n += 1 + sovLogbroker(uint64(e))
  1396. }
  1397. }
  1398. if m.Follow {
  1399. n += 2
  1400. }
  1401. if m.Tail != 0 {
  1402. n += 1 + sovLogbroker(uint64(m.Tail))
  1403. }
  1404. if m.Since != nil {
  1405. l = m.Since.Size()
  1406. n += 1 + l + sovLogbroker(uint64(l))
  1407. }
  1408. return n
  1409. }
  1410. func (m *LogSelector) Size() (n int) {
  1411. var l int
  1412. _ = l
  1413. if len(m.ServiceIDs) > 0 {
  1414. for _, s := range m.ServiceIDs {
  1415. l = len(s)
  1416. n += 1 + l + sovLogbroker(uint64(l))
  1417. }
  1418. }
  1419. if len(m.NodeIDs) > 0 {
  1420. for _, s := range m.NodeIDs {
  1421. l = len(s)
  1422. n += 1 + l + sovLogbroker(uint64(l))
  1423. }
  1424. }
  1425. if len(m.TaskIDs) > 0 {
  1426. for _, s := range m.TaskIDs {
  1427. l = len(s)
  1428. n += 1 + l + sovLogbroker(uint64(l))
  1429. }
  1430. }
  1431. return n
  1432. }
  1433. func (m *LogContext) Size() (n int) {
  1434. var l int
  1435. _ = l
  1436. l = len(m.ServiceID)
  1437. if l > 0 {
  1438. n += 1 + l + sovLogbroker(uint64(l))
  1439. }
  1440. l = len(m.NodeID)
  1441. if l > 0 {
  1442. n += 1 + l + sovLogbroker(uint64(l))
  1443. }
  1444. l = len(m.TaskID)
  1445. if l > 0 {
  1446. n += 1 + l + sovLogbroker(uint64(l))
  1447. }
  1448. return n
  1449. }
  1450. func (m *LogAttr) Size() (n int) {
  1451. var l int
  1452. _ = l
  1453. l = len(m.Key)
  1454. if l > 0 {
  1455. n += 1 + l + sovLogbroker(uint64(l))
  1456. }
  1457. l = len(m.Value)
  1458. if l > 0 {
  1459. n += 1 + l + sovLogbroker(uint64(l))
  1460. }
  1461. return n
  1462. }
  1463. func (m *LogMessage) Size() (n int) {
  1464. var l int
  1465. _ = l
  1466. l = m.Context.Size()
  1467. n += 1 + l + sovLogbroker(uint64(l))
  1468. if m.Timestamp != nil {
  1469. l = m.Timestamp.Size()
  1470. n += 1 + l + sovLogbroker(uint64(l))
  1471. }
  1472. if m.Stream != 0 {
  1473. n += 1 + sovLogbroker(uint64(m.Stream))
  1474. }
  1475. l = len(m.Data)
  1476. if l > 0 {
  1477. n += 1 + l + sovLogbroker(uint64(l))
  1478. }
  1479. if len(m.Attrs) > 0 {
  1480. for _, e := range m.Attrs {
  1481. l = e.Size()
  1482. n += 1 + l + sovLogbroker(uint64(l))
  1483. }
  1484. }
  1485. return n
  1486. }
  1487. func (m *SubscribeLogsRequest) Size() (n int) {
  1488. var l int
  1489. _ = l
  1490. if m.Selector != nil {
  1491. l = m.Selector.Size()
  1492. n += 1 + l + sovLogbroker(uint64(l))
  1493. }
  1494. if m.Options != nil {
  1495. l = m.Options.Size()
  1496. n += 1 + l + sovLogbroker(uint64(l))
  1497. }
  1498. return n
  1499. }
  1500. func (m *SubscribeLogsMessage) Size() (n int) {
  1501. var l int
  1502. _ = l
  1503. if len(m.Messages) > 0 {
  1504. for _, e := range m.Messages {
  1505. l = e.Size()
  1506. n += 1 + l + sovLogbroker(uint64(l))
  1507. }
  1508. }
  1509. return n
  1510. }
  1511. func (m *ListenSubscriptionsRequest) Size() (n int) {
  1512. var l int
  1513. _ = l
  1514. return n
  1515. }
  1516. func (m *SubscriptionMessage) Size() (n int) {
  1517. var l int
  1518. _ = l
  1519. l = len(m.ID)
  1520. if l > 0 {
  1521. n += 1 + l + sovLogbroker(uint64(l))
  1522. }
  1523. if m.Selector != nil {
  1524. l = m.Selector.Size()
  1525. n += 1 + l + sovLogbroker(uint64(l))
  1526. }
  1527. if m.Options != nil {
  1528. l = m.Options.Size()
  1529. n += 1 + l + sovLogbroker(uint64(l))
  1530. }
  1531. if m.Close {
  1532. n += 2
  1533. }
  1534. return n
  1535. }
  1536. func (m *PublishLogsMessage) Size() (n int) {
  1537. var l int
  1538. _ = l
  1539. l = len(m.SubscriptionID)
  1540. if l > 0 {
  1541. n += 1 + l + sovLogbroker(uint64(l))
  1542. }
  1543. if len(m.Messages) > 0 {
  1544. for _, e := range m.Messages {
  1545. l = e.Size()
  1546. n += 1 + l + sovLogbroker(uint64(l))
  1547. }
  1548. }
  1549. if m.Close {
  1550. n += 2
  1551. }
  1552. return n
  1553. }
  1554. func (m *PublishLogsResponse) Size() (n int) {
  1555. var l int
  1556. _ = l
  1557. return n
  1558. }
  1559. func sovLogbroker(x uint64) (n int) {
  1560. for {
  1561. n++
  1562. x >>= 7
  1563. if x == 0 {
  1564. break
  1565. }
  1566. }
  1567. return n
  1568. }
  1569. func sozLogbroker(x uint64) (n int) {
  1570. return sovLogbroker(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  1571. }
  1572. func (this *LogSubscriptionOptions) String() string {
  1573. if this == nil {
  1574. return "nil"
  1575. }
  1576. s := strings.Join([]string{`&LogSubscriptionOptions{`,
  1577. `Streams:` + fmt.Sprintf("%v", this.Streams) + `,`,
  1578. `Follow:` + fmt.Sprintf("%v", this.Follow) + `,`,
  1579. `Tail:` + fmt.Sprintf("%v", this.Tail) + `,`,
  1580. `Since:` + strings.Replace(fmt.Sprintf("%v", this.Since), "Timestamp", "google_protobuf.Timestamp", 1) + `,`,
  1581. `}`,
  1582. }, "")
  1583. return s
  1584. }
  1585. func (this *LogSelector) String() string {
  1586. if this == nil {
  1587. return "nil"
  1588. }
  1589. s := strings.Join([]string{`&LogSelector{`,
  1590. `ServiceIDs:` + fmt.Sprintf("%v", this.ServiceIDs) + `,`,
  1591. `NodeIDs:` + fmt.Sprintf("%v", this.NodeIDs) + `,`,
  1592. `TaskIDs:` + fmt.Sprintf("%v", this.TaskIDs) + `,`,
  1593. `}`,
  1594. }, "")
  1595. return s
  1596. }
  1597. func (this *LogContext) String() string {
  1598. if this == nil {
  1599. return "nil"
  1600. }
  1601. s := strings.Join([]string{`&LogContext{`,
  1602. `ServiceID:` + fmt.Sprintf("%v", this.ServiceID) + `,`,
  1603. `NodeID:` + fmt.Sprintf("%v", this.NodeID) + `,`,
  1604. `TaskID:` + fmt.Sprintf("%v", this.TaskID) + `,`,
  1605. `}`,
  1606. }, "")
  1607. return s
  1608. }
  1609. func (this *LogAttr) String() string {
  1610. if this == nil {
  1611. return "nil"
  1612. }
  1613. s := strings.Join([]string{`&LogAttr{`,
  1614. `Key:` + fmt.Sprintf("%v", this.Key) + `,`,
  1615. `Value:` + fmt.Sprintf("%v", this.Value) + `,`,
  1616. `}`,
  1617. }, "")
  1618. return s
  1619. }
  1620. func (this *LogMessage) String() string {
  1621. if this == nil {
  1622. return "nil"
  1623. }
  1624. s := strings.Join([]string{`&LogMessage{`,
  1625. `Context:` + strings.Replace(strings.Replace(this.Context.String(), "LogContext", "LogContext", 1), `&`, ``, 1) + `,`,
  1626. `Timestamp:` + strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Timestamp", "google_protobuf.Timestamp", 1) + `,`,
  1627. `Stream:` + fmt.Sprintf("%v", this.Stream) + `,`,
  1628. `Data:` + fmt.Sprintf("%v", this.Data) + `,`,
  1629. `Attrs:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Attrs), "LogAttr", "LogAttr", 1), `&`, ``, 1) + `,`,
  1630. `}`,
  1631. }, "")
  1632. return s
  1633. }
  1634. func (this *SubscribeLogsRequest) String() string {
  1635. if this == nil {
  1636. return "nil"
  1637. }
  1638. s := strings.Join([]string{`&SubscribeLogsRequest{`,
  1639. `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LogSelector", "LogSelector", 1) + `,`,
  1640. `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "LogSubscriptionOptions", "LogSubscriptionOptions", 1) + `,`,
  1641. `}`,
  1642. }, "")
  1643. return s
  1644. }
  1645. func (this *SubscribeLogsMessage) String() string {
  1646. if this == nil {
  1647. return "nil"
  1648. }
  1649. s := strings.Join([]string{`&SubscribeLogsMessage{`,
  1650. `Messages:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Messages), "LogMessage", "LogMessage", 1), `&`, ``, 1) + `,`,
  1651. `}`,
  1652. }, "")
  1653. return s
  1654. }
  1655. func (this *ListenSubscriptionsRequest) String() string {
  1656. if this == nil {
  1657. return "nil"
  1658. }
  1659. s := strings.Join([]string{`&ListenSubscriptionsRequest{`,
  1660. `}`,
  1661. }, "")
  1662. return s
  1663. }
  1664. func (this *SubscriptionMessage) String() string {
  1665. if this == nil {
  1666. return "nil"
  1667. }
  1668. s := strings.Join([]string{`&SubscriptionMessage{`,
  1669. `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
  1670. `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LogSelector", "LogSelector", 1) + `,`,
  1671. `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "LogSubscriptionOptions", "LogSubscriptionOptions", 1) + `,`,
  1672. `Close:` + fmt.Sprintf("%v", this.Close) + `,`,
  1673. `}`,
  1674. }, "")
  1675. return s
  1676. }
  1677. func (this *PublishLogsMessage) String() string {
  1678. if this == nil {
  1679. return "nil"
  1680. }
  1681. s := strings.Join([]string{`&PublishLogsMessage{`,
  1682. `SubscriptionID:` + fmt.Sprintf("%v", this.SubscriptionID) + `,`,
  1683. `Messages:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Messages), "LogMessage", "LogMessage", 1), `&`, ``, 1) + `,`,
  1684. `Close:` + fmt.Sprintf("%v", this.Close) + `,`,
  1685. `}`,
  1686. }, "")
  1687. return s
  1688. }
  1689. func (this *PublishLogsResponse) String() string {
  1690. if this == nil {
  1691. return "nil"
  1692. }
  1693. s := strings.Join([]string{`&PublishLogsResponse{`,
  1694. `}`,
  1695. }, "")
  1696. return s
  1697. }
  1698. func valueToStringLogbroker(v interface{}) string {
  1699. rv := reflect.ValueOf(v)
  1700. if rv.IsNil() {
  1701. return "nil"
  1702. }
  1703. pv := reflect.Indirect(rv).Interface()
  1704. return fmt.Sprintf("*%v", pv)
  1705. }
  1706. func (m *LogSubscriptionOptions) Unmarshal(dAtA []byte) error {
  1707. l := len(dAtA)
  1708. iNdEx := 0
  1709. for iNdEx < l {
  1710. preIndex := iNdEx
  1711. var wire uint64
  1712. for shift := uint(0); ; shift += 7 {
  1713. if shift >= 64 {
  1714. return ErrIntOverflowLogbroker
  1715. }
  1716. if iNdEx >= l {
  1717. return io.ErrUnexpectedEOF
  1718. }
  1719. b := dAtA[iNdEx]
  1720. iNdEx++
  1721. wire |= (uint64(b) & 0x7F) << shift
  1722. if b < 0x80 {
  1723. break
  1724. }
  1725. }
  1726. fieldNum := int32(wire >> 3)
  1727. wireType := int(wire & 0x7)
  1728. if wireType == 4 {
  1729. return fmt.Errorf("proto: LogSubscriptionOptions: wiretype end group for non-group")
  1730. }
  1731. if fieldNum <= 0 {
  1732. return fmt.Errorf("proto: LogSubscriptionOptions: illegal tag %d (wire type %d)", fieldNum, wire)
  1733. }
  1734. switch fieldNum {
  1735. case 1:
  1736. if wireType == 0 {
  1737. var v LogStream
  1738. for shift := uint(0); ; shift += 7 {
  1739. if shift >= 64 {
  1740. return ErrIntOverflowLogbroker
  1741. }
  1742. if iNdEx >= l {
  1743. return io.ErrUnexpectedEOF
  1744. }
  1745. b := dAtA[iNdEx]
  1746. iNdEx++
  1747. v |= (LogStream(b) & 0x7F) << shift
  1748. if b < 0x80 {
  1749. break
  1750. }
  1751. }
  1752. m.Streams = append(m.Streams, v)
  1753. } else if wireType == 2 {
  1754. var packedLen int
  1755. for shift := uint(0); ; shift += 7 {
  1756. if shift >= 64 {
  1757. return ErrIntOverflowLogbroker
  1758. }
  1759. if iNdEx >= l {
  1760. return io.ErrUnexpectedEOF
  1761. }
  1762. b := dAtA[iNdEx]
  1763. iNdEx++
  1764. packedLen |= (int(b) & 0x7F) << shift
  1765. if b < 0x80 {
  1766. break
  1767. }
  1768. }
  1769. if packedLen < 0 {
  1770. return ErrInvalidLengthLogbroker
  1771. }
  1772. postIndex := iNdEx + packedLen
  1773. if postIndex > l {
  1774. return io.ErrUnexpectedEOF
  1775. }
  1776. for iNdEx < postIndex {
  1777. var v LogStream
  1778. for shift := uint(0); ; shift += 7 {
  1779. if shift >= 64 {
  1780. return ErrIntOverflowLogbroker
  1781. }
  1782. if iNdEx >= l {
  1783. return io.ErrUnexpectedEOF
  1784. }
  1785. b := dAtA[iNdEx]
  1786. iNdEx++
  1787. v |= (LogStream(b) & 0x7F) << shift
  1788. if b < 0x80 {
  1789. break
  1790. }
  1791. }
  1792. m.Streams = append(m.Streams, v)
  1793. }
  1794. } else {
  1795. return fmt.Errorf("proto: wrong wireType = %d for field Streams", wireType)
  1796. }
  1797. case 2:
  1798. if wireType != 0 {
  1799. return fmt.Errorf("proto: wrong wireType = %d for field Follow", wireType)
  1800. }
  1801. var v int
  1802. for shift := uint(0); ; shift += 7 {
  1803. if shift >= 64 {
  1804. return ErrIntOverflowLogbroker
  1805. }
  1806. if iNdEx >= l {
  1807. return io.ErrUnexpectedEOF
  1808. }
  1809. b := dAtA[iNdEx]
  1810. iNdEx++
  1811. v |= (int(b) & 0x7F) << shift
  1812. if b < 0x80 {
  1813. break
  1814. }
  1815. }
  1816. m.Follow = bool(v != 0)
  1817. case 3:
  1818. if wireType != 0 {
  1819. return fmt.Errorf("proto: wrong wireType = %d for field Tail", wireType)
  1820. }
  1821. m.Tail = 0
  1822. for shift := uint(0); ; shift += 7 {
  1823. if shift >= 64 {
  1824. return ErrIntOverflowLogbroker
  1825. }
  1826. if iNdEx >= l {
  1827. return io.ErrUnexpectedEOF
  1828. }
  1829. b := dAtA[iNdEx]
  1830. iNdEx++
  1831. m.Tail |= (int64(b) & 0x7F) << shift
  1832. if b < 0x80 {
  1833. break
  1834. }
  1835. }
  1836. case 4:
  1837. if wireType != 2 {
  1838. return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType)
  1839. }
  1840. var msglen int
  1841. for shift := uint(0); ; shift += 7 {
  1842. if shift >= 64 {
  1843. return ErrIntOverflowLogbroker
  1844. }
  1845. if iNdEx >= l {
  1846. return io.ErrUnexpectedEOF
  1847. }
  1848. b := dAtA[iNdEx]
  1849. iNdEx++
  1850. msglen |= (int(b) & 0x7F) << shift
  1851. if b < 0x80 {
  1852. break
  1853. }
  1854. }
  1855. if msglen < 0 {
  1856. return ErrInvalidLengthLogbroker
  1857. }
  1858. postIndex := iNdEx + msglen
  1859. if postIndex > l {
  1860. return io.ErrUnexpectedEOF
  1861. }
  1862. if m.Since == nil {
  1863. m.Since = &google_protobuf.Timestamp{}
  1864. }
  1865. if err := m.Since.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  1866. return err
  1867. }
  1868. iNdEx = postIndex
  1869. default:
  1870. iNdEx = preIndex
  1871. skippy, err := skipLogbroker(dAtA[iNdEx:])
  1872. if err != nil {
  1873. return err
  1874. }
  1875. if skippy < 0 {
  1876. return ErrInvalidLengthLogbroker
  1877. }
  1878. if (iNdEx + skippy) > l {
  1879. return io.ErrUnexpectedEOF
  1880. }
  1881. iNdEx += skippy
  1882. }
  1883. }
  1884. if iNdEx > l {
  1885. return io.ErrUnexpectedEOF
  1886. }
  1887. return nil
  1888. }
  1889. func (m *LogSelector) Unmarshal(dAtA []byte) error {
  1890. l := len(dAtA)
  1891. iNdEx := 0
  1892. for iNdEx < l {
  1893. preIndex := iNdEx
  1894. var wire uint64
  1895. for shift := uint(0); ; shift += 7 {
  1896. if shift >= 64 {
  1897. return ErrIntOverflowLogbroker
  1898. }
  1899. if iNdEx >= l {
  1900. return io.ErrUnexpectedEOF
  1901. }
  1902. b := dAtA[iNdEx]
  1903. iNdEx++
  1904. wire |= (uint64(b) & 0x7F) << shift
  1905. if b < 0x80 {
  1906. break
  1907. }
  1908. }
  1909. fieldNum := int32(wire >> 3)
  1910. wireType := int(wire & 0x7)
  1911. if wireType == 4 {
  1912. return fmt.Errorf("proto: LogSelector: wiretype end group for non-group")
  1913. }
  1914. if fieldNum <= 0 {
  1915. return fmt.Errorf("proto: LogSelector: illegal tag %d (wire type %d)", fieldNum, wire)
  1916. }
  1917. switch fieldNum {
  1918. case 1:
  1919. if wireType != 2 {
  1920. return fmt.Errorf("proto: wrong wireType = %d for field ServiceIDs", wireType)
  1921. }
  1922. var stringLen uint64
  1923. for shift := uint(0); ; shift += 7 {
  1924. if shift >= 64 {
  1925. return ErrIntOverflowLogbroker
  1926. }
  1927. if iNdEx >= l {
  1928. return io.ErrUnexpectedEOF
  1929. }
  1930. b := dAtA[iNdEx]
  1931. iNdEx++
  1932. stringLen |= (uint64(b) & 0x7F) << shift
  1933. if b < 0x80 {
  1934. break
  1935. }
  1936. }
  1937. intStringLen := int(stringLen)
  1938. if intStringLen < 0 {
  1939. return ErrInvalidLengthLogbroker
  1940. }
  1941. postIndex := iNdEx + intStringLen
  1942. if postIndex > l {
  1943. return io.ErrUnexpectedEOF
  1944. }
  1945. m.ServiceIDs = append(m.ServiceIDs, string(dAtA[iNdEx:postIndex]))
  1946. iNdEx = postIndex
  1947. case 2:
  1948. if wireType != 2 {
  1949. return fmt.Errorf("proto: wrong wireType = %d for field NodeIDs", wireType)
  1950. }
  1951. var stringLen uint64
  1952. for shift := uint(0); ; shift += 7 {
  1953. if shift >= 64 {
  1954. return ErrIntOverflowLogbroker
  1955. }
  1956. if iNdEx >= l {
  1957. return io.ErrUnexpectedEOF
  1958. }
  1959. b := dAtA[iNdEx]
  1960. iNdEx++
  1961. stringLen |= (uint64(b) & 0x7F) << shift
  1962. if b < 0x80 {
  1963. break
  1964. }
  1965. }
  1966. intStringLen := int(stringLen)
  1967. if intStringLen < 0 {
  1968. return ErrInvalidLengthLogbroker
  1969. }
  1970. postIndex := iNdEx + intStringLen
  1971. if postIndex > l {
  1972. return io.ErrUnexpectedEOF
  1973. }
  1974. m.NodeIDs = append(m.NodeIDs, string(dAtA[iNdEx:postIndex]))
  1975. iNdEx = postIndex
  1976. case 3:
  1977. if wireType != 2 {
  1978. return fmt.Errorf("proto: wrong wireType = %d for field TaskIDs", wireType)
  1979. }
  1980. var stringLen uint64
  1981. for shift := uint(0); ; shift += 7 {
  1982. if shift >= 64 {
  1983. return ErrIntOverflowLogbroker
  1984. }
  1985. if iNdEx >= l {
  1986. return io.ErrUnexpectedEOF
  1987. }
  1988. b := dAtA[iNdEx]
  1989. iNdEx++
  1990. stringLen |= (uint64(b) & 0x7F) << shift
  1991. if b < 0x80 {
  1992. break
  1993. }
  1994. }
  1995. intStringLen := int(stringLen)
  1996. if intStringLen < 0 {
  1997. return ErrInvalidLengthLogbroker
  1998. }
  1999. postIndex := iNdEx + intStringLen
  2000. if postIndex > l {
  2001. return io.ErrUnexpectedEOF
  2002. }
  2003. m.TaskIDs = append(m.TaskIDs, string(dAtA[iNdEx:postIndex]))
  2004. iNdEx = postIndex
  2005. default:
  2006. iNdEx = preIndex
  2007. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2008. if err != nil {
  2009. return err
  2010. }
  2011. if skippy < 0 {
  2012. return ErrInvalidLengthLogbroker
  2013. }
  2014. if (iNdEx + skippy) > l {
  2015. return io.ErrUnexpectedEOF
  2016. }
  2017. iNdEx += skippy
  2018. }
  2019. }
  2020. if iNdEx > l {
  2021. return io.ErrUnexpectedEOF
  2022. }
  2023. return nil
  2024. }
  2025. func (m *LogContext) Unmarshal(dAtA []byte) error {
  2026. l := len(dAtA)
  2027. iNdEx := 0
  2028. for iNdEx < l {
  2029. preIndex := iNdEx
  2030. var wire uint64
  2031. for shift := uint(0); ; shift += 7 {
  2032. if shift >= 64 {
  2033. return ErrIntOverflowLogbroker
  2034. }
  2035. if iNdEx >= l {
  2036. return io.ErrUnexpectedEOF
  2037. }
  2038. b := dAtA[iNdEx]
  2039. iNdEx++
  2040. wire |= (uint64(b) & 0x7F) << shift
  2041. if b < 0x80 {
  2042. break
  2043. }
  2044. }
  2045. fieldNum := int32(wire >> 3)
  2046. wireType := int(wire & 0x7)
  2047. if wireType == 4 {
  2048. return fmt.Errorf("proto: LogContext: wiretype end group for non-group")
  2049. }
  2050. if fieldNum <= 0 {
  2051. return fmt.Errorf("proto: LogContext: illegal tag %d (wire type %d)", fieldNum, wire)
  2052. }
  2053. switch fieldNum {
  2054. case 1:
  2055. if wireType != 2 {
  2056. return fmt.Errorf("proto: wrong wireType = %d for field ServiceID", wireType)
  2057. }
  2058. var stringLen uint64
  2059. for shift := uint(0); ; shift += 7 {
  2060. if shift >= 64 {
  2061. return ErrIntOverflowLogbroker
  2062. }
  2063. if iNdEx >= l {
  2064. return io.ErrUnexpectedEOF
  2065. }
  2066. b := dAtA[iNdEx]
  2067. iNdEx++
  2068. stringLen |= (uint64(b) & 0x7F) << shift
  2069. if b < 0x80 {
  2070. break
  2071. }
  2072. }
  2073. intStringLen := int(stringLen)
  2074. if intStringLen < 0 {
  2075. return ErrInvalidLengthLogbroker
  2076. }
  2077. postIndex := iNdEx + intStringLen
  2078. if postIndex > l {
  2079. return io.ErrUnexpectedEOF
  2080. }
  2081. m.ServiceID = string(dAtA[iNdEx:postIndex])
  2082. iNdEx = postIndex
  2083. case 2:
  2084. if wireType != 2 {
  2085. return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType)
  2086. }
  2087. var stringLen uint64
  2088. for shift := uint(0); ; shift += 7 {
  2089. if shift >= 64 {
  2090. return ErrIntOverflowLogbroker
  2091. }
  2092. if iNdEx >= l {
  2093. return io.ErrUnexpectedEOF
  2094. }
  2095. b := dAtA[iNdEx]
  2096. iNdEx++
  2097. stringLen |= (uint64(b) & 0x7F) << shift
  2098. if b < 0x80 {
  2099. break
  2100. }
  2101. }
  2102. intStringLen := int(stringLen)
  2103. if intStringLen < 0 {
  2104. return ErrInvalidLengthLogbroker
  2105. }
  2106. postIndex := iNdEx + intStringLen
  2107. if postIndex > l {
  2108. return io.ErrUnexpectedEOF
  2109. }
  2110. m.NodeID = string(dAtA[iNdEx:postIndex])
  2111. iNdEx = postIndex
  2112. case 3:
  2113. if wireType != 2 {
  2114. return fmt.Errorf("proto: wrong wireType = %d for field TaskID", wireType)
  2115. }
  2116. var stringLen uint64
  2117. for shift := uint(0); ; shift += 7 {
  2118. if shift >= 64 {
  2119. return ErrIntOverflowLogbroker
  2120. }
  2121. if iNdEx >= l {
  2122. return io.ErrUnexpectedEOF
  2123. }
  2124. b := dAtA[iNdEx]
  2125. iNdEx++
  2126. stringLen |= (uint64(b) & 0x7F) << shift
  2127. if b < 0x80 {
  2128. break
  2129. }
  2130. }
  2131. intStringLen := int(stringLen)
  2132. if intStringLen < 0 {
  2133. return ErrInvalidLengthLogbroker
  2134. }
  2135. postIndex := iNdEx + intStringLen
  2136. if postIndex > l {
  2137. return io.ErrUnexpectedEOF
  2138. }
  2139. m.TaskID = string(dAtA[iNdEx:postIndex])
  2140. iNdEx = postIndex
  2141. default:
  2142. iNdEx = preIndex
  2143. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2144. if err != nil {
  2145. return err
  2146. }
  2147. if skippy < 0 {
  2148. return ErrInvalidLengthLogbroker
  2149. }
  2150. if (iNdEx + skippy) > l {
  2151. return io.ErrUnexpectedEOF
  2152. }
  2153. iNdEx += skippy
  2154. }
  2155. }
  2156. if iNdEx > l {
  2157. return io.ErrUnexpectedEOF
  2158. }
  2159. return nil
  2160. }
  2161. func (m *LogAttr) Unmarshal(dAtA []byte) error {
  2162. l := len(dAtA)
  2163. iNdEx := 0
  2164. for iNdEx < l {
  2165. preIndex := iNdEx
  2166. var wire uint64
  2167. for shift := uint(0); ; shift += 7 {
  2168. if shift >= 64 {
  2169. return ErrIntOverflowLogbroker
  2170. }
  2171. if iNdEx >= l {
  2172. return io.ErrUnexpectedEOF
  2173. }
  2174. b := dAtA[iNdEx]
  2175. iNdEx++
  2176. wire |= (uint64(b) & 0x7F) << shift
  2177. if b < 0x80 {
  2178. break
  2179. }
  2180. }
  2181. fieldNum := int32(wire >> 3)
  2182. wireType := int(wire & 0x7)
  2183. if wireType == 4 {
  2184. return fmt.Errorf("proto: LogAttr: wiretype end group for non-group")
  2185. }
  2186. if fieldNum <= 0 {
  2187. return fmt.Errorf("proto: LogAttr: illegal tag %d (wire type %d)", fieldNum, wire)
  2188. }
  2189. switch fieldNum {
  2190. case 1:
  2191. if wireType != 2 {
  2192. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  2193. }
  2194. var stringLen uint64
  2195. for shift := uint(0); ; shift += 7 {
  2196. if shift >= 64 {
  2197. return ErrIntOverflowLogbroker
  2198. }
  2199. if iNdEx >= l {
  2200. return io.ErrUnexpectedEOF
  2201. }
  2202. b := dAtA[iNdEx]
  2203. iNdEx++
  2204. stringLen |= (uint64(b) & 0x7F) << shift
  2205. if b < 0x80 {
  2206. break
  2207. }
  2208. }
  2209. intStringLen := int(stringLen)
  2210. if intStringLen < 0 {
  2211. return ErrInvalidLengthLogbroker
  2212. }
  2213. postIndex := iNdEx + intStringLen
  2214. if postIndex > l {
  2215. return io.ErrUnexpectedEOF
  2216. }
  2217. m.Key = string(dAtA[iNdEx:postIndex])
  2218. iNdEx = postIndex
  2219. case 2:
  2220. if wireType != 2 {
  2221. return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
  2222. }
  2223. var stringLen uint64
  2224. for shift := uint(0); ; shift += 7 {
  2225. if shift >= 64 {
  2226. return ErrIntOverflowLogbroker
  2227. }
  2228. if iNdEx >= l {
  2229. return io.ErrUnexpectedEOF
  2230. }
  2231. b := dAtA[iNdEx]
  2232. iNdEx++
  2233. stringLen |= (uint64(b) & 0x7F) << shift
  2234. if b < 0x80 {
  2235. break
  2236. }
  2237. }
  2238. intStringLen := int(stringLen)
  2239. if intStringLen < 0 {
  2240. return ErrInvalidLengthLogbroker
  2241. }
  2242. postIndex := iNdEx + intStringLen
  2243. if postIndex > l {
  2244. return io.ErrUnexpectedEOF
  2245. }
  2246. m.Value = string(dAtA[iNdEx:postIndex])
  2247. iNdEx = postIndex
  2248. default:
  2249. iNdEx = preIndex
  2250. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2251. if err != nil {
  2252. return err
  2253. }
  2254. if skippy < 0 {
  2255. return ErrInvalidLengthLogbroker
  2256. }
  2257. if (iNdEx + skippy) > l {
  2258. return io.ErrUnexpectedEOF
  2259. }
  2260. iNdEx += skippy
  2261. }
  2262. }
  2263. if iNdEx > l {
  2264. return io.ErrUnexpectedEOF
  2265. }
  2266. return nil
  2267. }
  2268. func (m *LogMessage) Unmarshal(dAtA []byte) error {
  2269. l := len(dAtA)
  2270. iNdEx := 0
  2271. for iNdEx < l {
  2272. preIndex := iNdEx
  2273. var wire uint64
  2274. for shift := uint(0); ; shift += 7 {
  2275. if shift >= 64 {
  2276. return ErrIntOverflowLogbroker
  2277. }
  2278. if iNdEx >= l {
  2279. return io.ErrUnexpectedEOF
  2280. }
  2281. b := dAtA[iNdEx]
  2282. iNdEx++
  2283. wire |= (uint64(b) & 0x7F) << shift
  2284. if b < 0x80 {
  2285. break
  2286. }
  2287. }
  2288. fieldNum := int32(wire >> 3)
  2289. wireType := int(wire & 0x7)
  2290. if wireType == 4 {
  2291. return fmt.Errorf("proto: LogMessage: wiretype end group for non-group")
  2292. }
  2293. if fieldNum <= 0 {
  2294. return fmt.Errorf("proto: LogMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2295. }
  2296. switch fieldNum {
  2297. case 1:
  2298. if wireType != 2 {
  2299. return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType)
  2300. }
  2301. var msglen int
  2302. for shift := uint(0); ; shift += 7 {
  2303. if shift >= 64 {
  2304. return ErrIntOverflowLogbroker
  2305. }
  2306. if iNdEx >= l {
  2307. return io.ErrUnexpectedEOF
  2308. }
  2309. b := dAtA[iNdEx]
  2310. iNdEx++
  2311. msglen |= (int(b) & 0x7F) << shift
  2312. if b < 0x80 {
  2313. break
  2314. }
  2315. }
  2316. if msglen < 0 {
  2317. return ErrInvalidLengthLogbroker
  2318. }
  2319. postIndex := iNdEx + msglen
  2320. if postIndex > l {
  2321. return io.ErrUnexpectedEOF
  2322. }
  2323. if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2324. return err
  2325. }
  2326. iNdEx = postIndex
  2327. case 2:
  2328. if wireType != 2 {
  2329. return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
  2330. }
  2331. var msglen int
  2332. for shift := uint(0); ; shift += 7 {
  2333. if shift >= 64 {
  2334. return ErrIntOverflowLogbroker
  2335. }
  2336. if iNdEx >= l {
  2337. return io.ErrUnexpectedEOF
  2338. }
  2339. b := dAtA[iNdEx]
  2340. iNdEx++
  2341. msglen |= (int(b) & 0x7F) << shift
  2342. if b < 0x80 {
  2343. break
  2344. }
  2345. }
  2346. if msglen < 0 {
  2347. return ErrInvalidLengthLogbroker
  2348. }
  2349. postIndex := iNdEx + msglen
  2350. if postIndex > l {
  2351. return io.ErrUnexpectedEOF
  2352. }
  2353. if m.Timestamp == nil {
  2354. m.Timestamp = &google_protobuf.Timestamp{}
  2355. }
  2356. if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2357. return err
  2358. }
  2359. iNdEx = postIndex
  2360. case 3:
  2361. if wireType != 0 {
  2362. return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType)
  2363. }
  2364. m.Stream = 0
  2365. for shift := uint(0); ; shift += 7 {
  2366. if shift >= 64 {
  2367. return ErrIntOverflowLogbroker
  2368. }
  2369. if iNdEx >= l {
  2370. return io.ErrUnexpectedEOF
  2371. }
  2372. b := dAtA[iNdEx]
  2373. iNdEx++
  2374. m.Stream |= (LogStream(b) & 0x7F) << shift
  2375. if b < 0x80 {
  2376. break
  2377. }
  2378. }
  2379. case 4:
  2380. if wireType != 2 {
  2381. return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
  2382. }
  2383. var byteLen int
  2384. for shift := uint(0); ; shift += 7 {
  2385. if shift >= 64 {
  2386. return ErrIntOverflowLogbroker
  2387. }
  2388. if iNdEx >= l {
  2389. return io.ErrUnexpectedEOF
  2390. }
  2391. b := dAtA[iNdEx]
  2392. iNdEx++
  2393. byteLen |= (int(b) & 0x7F) << shift
  2394. if b < 0x80 {
  2395. break
  2396. }
  2397. }
  2398. if byteLen < 0 {
  2399. return ErrInvalidLengthLogbroker
  2400. }
  2401. postIndex := iNdEx + byteLen
  2402. if postIndex > l {
  2403. return io.ErrUnexpectedEOF
  2404. }
  2405. m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
  2406. if m.Data == nil {
  2407. m.Data = []byte{}
  2408. }
  2409. iNdEx = postIndex
  2410. case 5:
  2411. if wireType != 2 {
  2412. return fmt.Errorf("proto: wrong wireType = %d for field Attrs", wireType)
  2413. }
  2414. var msglen int
  2415. for shift := uint(0); ; shift += 7 {
  2416. if shift >= 64 {
  2417. return ErrIntOverflowLogbroker
  2418. }
  2419. if iNdEx >= l {
  2420. return io.ErrUnexpectedEOF
  2421. }
  2422. b := dAtA[iNdEx]
  2423. iNdEx++
  2424. msglen |= (int(b) & 0x7F) << shift
  2425. if b < 0x80 {
  2426. break
  2427. }
  2428. }
  2429. if msglen < 0 {
  2430. return ErrInvalidLengthLogbroker
  2431. }
  2432. postIndex := iNdEx + msglen
  2433. if postIndex > l {
  2434. return io.ErrUnexpectedEOF
  2435. }
  2436. m.Attrs = append(m.Attrs, LogAttr{})
  2437. if err := m.Attrs[len(m.Attrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2438. return err
  2439. }
  2440. iNdEx = postIndex
  2441. default:
  2442. iNdEx = preIndex
  2443. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2444. if err != nil {
  2445. return err
  2446. }
  2447. if skippy < 0 {
  2448. return ErrInvalidLengthLogbroker
  2449. }
  2450. if (iNdEx + skippy) > l {
  2451. return io.ErrUnexpectedEOF
  2452. }
  2453. iNdEx += skippy
  2454. }
  2455. }
  2456. if iNdEx > l {
  2457. return io.ErrUnexpectedEOF
  2458. }
  2459. return nil
  2460. }
  2461. func (m *SubscribeLogsRequest) Unmarshal(dAtA []byte) error {
  2462. l := len(dAtA)
  2463. iNdEx := 0
  2464. for iNdEx < l {
  2465. preIndex := iNdEx
  2466. var wire uint64
  2467. for shift := uint(0); ; shift += 7 {
  2468. if shift >= 64 {
  2469. return ErrIntOverflowLogbroker
  2470. }
  2471. if iNdEx >= l {
  2472. return io.ErrUnexpectedEOF
  2473. }
  2474. b := dAtA[iNdEx]
  2475. iNdEx++
  2476. wire |= (uint64(b) & 0x7F) << shift
  2477. if b < 0x80 {
  2478. break
  2479. }
  2480. }
  2481. fieldNum := int32(wire >> 3)
  2482. wireType := int(wire & 0x7)
  2483. if wireType == 4 {
  2484. return fmt.Errorf("proto: SubscribeLogsRequest: wiretype end group for non-group")
  2485. }
  2486. if fieldNum <= 0 {
  2487. return fmt.Errorf("proto: SubscribeLogsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
  2488. }
  2489. switch fieldNum {
  2490. case 1:
  2491. if wireType != 2 {
  2492. return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType)
  2493. }
  2494. var msglen int
  2495. for shift := uint(0); ; shift += 7 {
  2496. if shift >= 64 {
  2497. return ErrIntOverflowLogbroker
  2498. }
  2499. if iNdEx >= l {
  2500. return io.ErrUnexpectedEOF
  2501. }
  2502. b := dAtA[iNdEx]
  2503. iNdEx++
  2504. msglen |= (int(b) & 0x7F) << shift
  2505. if b < 0x80 {
  2506. break
  2507. }
  2508. }
  2509. if msglen < 0 {
  2510. return ErrInvalidLengthLogbroker
  2511. }
  2512. postIndex := iNdEx + msglen
  2513. if postIndex > l {
  2514. return io.ErrUnexpectedEOF
  2515. }
  2516. if m.Selector == nil {
  2517. m.Selector = &LogSelector{}
  2518. }
  2519. if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2520. return err
  2521. }
  2522. iNdEx = postIndex
  2523. case 2:
  2524. if wireType != 2 {
  2525. return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType)
  2526. }
  2527. var msglen int
  2528. for shift := uint(0); ; shift += 7 {
  2529. if shift >= 64 {
  2530. return ErrIntOverflowLogbroker
  2531. }
  2532. if iNdEx >= l {
  2533. return io.ErrUnexpectedEOF
  2534. }
  2535. b := dAtA[iNdEx]
  2536. iNdEx++
  2537. msglen |= (int(b) & 0x7F) << shift
  2538. if b < 0x80 {
  2539. break
  2540. }
  2541. }
  2542. if msglen < 0 {
  2543. return ErrInvalidLengthLogbroker
  2544. }
  2545. postIndex := iNdEx + msglen
  2546. if postIndex > l {
  2547. return io.ErrUnexpectedEOF
  2548. }
  2549. if m.Options == nil {
  2550. m.Options = &LogSubscriptionOptions{}
  2551. }
  2552. if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2553. return err
  2554. }
  2555. iNdEx = postIndex
  2556. default:
  2557. iNdEx = preIndex
  2558. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2559. if err != nil {
  2560. return err
  2561. }
  2562. if skippy < 0 {
  2563. return ErrInvalidLengthLogbroker
  2564. }
  2565. if (iNdEx + skippy) > l {
  2566. return io.ErrUnexpectedEOF
  2567. }
  2568. iNdEx += skippy
  2569. }
  2570. }
  2571. if iNdEx > l {
  2572. return io.ErrUnexpectedEOF
  2573. }
  2574. return nil
  2575. }
  2576. func (m *SubscribeLogsMessage) Unmarshal(dAtA []byte) error {
  2577. l := len(dAtA)
  2578. iNdEx := 0
  2579. for iNdEx < l {
  2580. preIndex := iNdEx
  2581. var wire uint64
  2582. for shift := uint(0); ; shift += 7 {
  2583. if shift >= 64 {
  2584. return ErrIntOverflowLogbroker
  2585. }
  2586. if iNdEx >= l {
  2587. return io.ErrUnexpectedEOF
  2588. }
  2589. b := dAtA[iNdEx]
  2590. iNdEx++
  2591. wire |= (uint64(b) & 0x7F) << shift
  2592. if b < 0x80 {
  2593. break
  2594. }
  2595. }
  2596. fieldNum := int32(wire >> 3)
  2597. wireType := int(wire & 0x7)
  2598. if wireType == 4 {
  2599. return fmt.Errorf("proto: SubscribeLogsMessage: wiretype end group for non-group")
  2600. }
  2601. if fieldNum <= 0 {
  2602. return fmt.Errorf("proto: SubscribeLogsMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2603. }
  2604. switch fieldNum {
  2605. case 1:
  2606. if wireType != 2 {
  2607. return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType)
  2608. }
  2609. var msglen int
  2610. for shift := uint(0); ; shift += 7 {
  2611. if shift >= 64 {
  2612. return ErrIntOverflowLogbroker
  2613. }
  2614. if iNdEx >= l {
  2615. return io.ErrUnexpectedEOF
  2616. }
  2617. b := dAtA[iNdEx]
  2618. iNdEx++
  2619. msglen |= (int(b) & 0x7F) << shift
  2620. if b < 0x80 {
  2621. break
  2622. }
  2623. }
  2624. if msglen < 0 {
  2625. return ErrInvalidLengthLogbroker
  2626. }
  2627. postIndex := iNdEx + msglen
  2628. if postIndex > l {
  2629. return io.ErrUnexpectedEOF
  2630. }
  2631. m.Messages = append(m.Messages, LogMessage{})
  2632. if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2633. return err
  2634. }
  2635. iNdEx = postIndex
  2636. default:
  2637. iNdEx = preIndex
  2638. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2639. if err != nil {
  2640. return err
  2641. }
  2642. if skippy < 0 {
  2643. return ErrInvalidLengthLogbroker
  2644. }
  2645. if (iNdEx + skippy) > l {
  2646. return io.ErrUnexpectedEOF
  2647. }
  2648. iNdEx += skippy
  2649. }
  2650. }
  2651. if iNdEx > l {
  2652. return io.ErrUnexpectedEOF
  2653. }
  2654. return nil
  2655. }
  2656. func (m *ListenSubscriptionsRequest) Unmarshal(dAtA []byte) error {
  2657. l := len(dAtA)
  2658. iNdEx := 0
  2659. for iNdEx < l {
  2660. preIndex := iNdEx
  2661. var wire uint64
  2662. for shift := uint(0); ; shift += 7 {
  2663. if shift >= 64 {
  2664. return ErrIntOverflowLogbroker
  2665. }
  2666. if iNdEx >= l {
  2667. return io.ErrUnexpectedEOF
  2668. }
  2669. b := dAtA[iNdEx]
  2670. iNdEx++
  2671. wire |= (uint64(b) & 0x7F) << shift
  2672. if b < 0x80 {
  2673. break
  2674. }
  2675. }
  2676. fieldNum := int32(wire >> 3)
  2677. wireType := int(wire & 0x7)
  2678. if wireType == 4 {
  2679. return fmt.Errorf("proto: ListenSubscriptionsRequest: wiretype end group for non-group")
  2680. }
  2681. if fieldNum <= 0 {
  2682. return fmt.Errorf("proto: ListenSubscriptionsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
  2683. }
  2684. switch fieldNum {
  2685. default:
  2686. iNdEx = preIndex
  2687. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2688. if err != nil {
  2689. return err
  2690. }
  2691. if skippy < 0 {
  2692. return ErrInvalidLengthLogbroker
  2693. }
  2694. if (iNdEx + skippy) > l {
  2695. return io.ErrUnexpectedEOF
  2696. }
  2697. iNdEx += skippy
  2698. }
  2699. }
  2700. if iNdEx > l {
  2701. return io.ErrUnexpectedEOF
  2702. }
  2703. return nil
  2704. }
  2705. func (m *SubscriptionMessage) Unmarshal(dAtA []byte) error {
  2706. l := len(dAtA)
  2707. iNdEx := 0
  2708. for iNdEx < l {
  2709. preIndex := iNdEx
  2710. var wire uint64
  2711. for shift := uint(0); ; shift += 7 {
  2712. if shift >= 64 {
  2713. return ErrIntOverflowLogbroker
  2714. }
  2715. if iNdEx >= l {
  2716. return io.ErrUnexpectedEOF
  2717. }
  2718. b := dAtA[iNdEx]
  2719. iNdEx++
  2720. wire |= (uint64(b) & 0x7F) << shift
  2721. if b < 0x80 {
  2722. break
  2723. }
  2724. }
  2725. fieldNum := int32(wire >> 3)
  2726. wireType := int(wire & 0x7)
  2727. if wireType == 4 {
  2728. return fmt.Errorf("proto: SubscriptionMessage: wiretype end group for non-group")
  2729. }
  2730. if fieldNum <= 0 {
  2731. return fmt.Errorf("proto: SubscriptionMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2732. }
  2733. switch fieldNum {
  2734. case 1:
  2735. if wireType != 2 {
  2736. return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
  2737. }
  2738. var stringLen uint64
  2739. for shift := uint(0); ; shift += 7 {
  2740. if shift >= 64 {
  2741. return ErrIntOverflowLogbroker
  2742. }
  2743. if iNdEx >= l {
  2744. return io.ErrUnexpectedEOF
  2745. }
  2746. b := dAtA[iNdEx]
  2747. iNdEx++
  2748. stringLen |= (uint64(b) & 0x7F) << shift
  2749. if b < 0x80 {
  2750. break
  2751. }
  2752. }
  2753. intStringLen := int(stringLen)
  2754. if intStringLen < 0 {
  2755. return ErrInvalidLengthLogbroker
  2756. }
  2757. postIndex := iNdEx + intStringLen
  2758. if postIndex > l {
  2759. return io.ErrUnexpectedEOF
  2760. }
  2761. m.ID = string(dAtA[iNdEx:postIndex])
  2762. iNdEx = postIndex
  2763. case 2:
  2764. if wireType != 2 {
  2765. return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType)
  2766. }
  2767. var msglen int
  2768. for shift := uint(0); ; shift += 7 {
  2769. if shift >= 64 {
  2770. return ErrIntOverflowLogbroker
  2771. }
  2772. if iNdEx >= l {
  2773. return io.ErrUnexpectedEOF
  2774. }
  2775. b := dAtA[iNdEx]
  2776. iNdEx++
  2777. msglen |= (int(b) & 0x7F) << shift
  2778. if b < 0x80 {
  2779. break
  2780. }
  2781. }
  2782. if msglen < 0 {
  2783. return ErrInvalidLengthLogbroker
  2784. }
  2785. postIndex := iNdEx + msglen
  2786. if postIndex > l {
  2787. return io.ErrUnexpectedEOF
  2788. }
  2789. if m.Selector == nil {
  2790. m.Selector = &LogSelector{}
  2791. }
  2792. if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2793. return err
  2794. }
  2795. iNdEx = postIndex
  2796. case 3:
  2797. if wireType != 2 {
  2798. return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType)
  2799. }
  2800. var msglen int
  2801. for shift := uint(0); ; shift += 7 {
  2802. if shift >= 64 {
  2803. return ErrIntOverflowLogbroker
  2804. }
  2805. if iNdEx >= l {
  2806. return io.ErrUnexpectedEOF
  2807. }
  2808. b := dAtA[iNdEx]
  2809. iNdEx++
  2810. msglen |= (int(b) & 0x7F) << shift
  2811. if b < 0x80 {
  2812. break
  2813. }
  2814. }
  2815. if msglen < 0 {
  2816. return ErrInvalidLengthLogbroker
  2817. }
  2818. postIndex := iNdEx + msglen
  2819. if postIndex > l {
  2820. return io.ErrUnexpectedEOF
  2821. }
  2822. if m.Options == nil {
  2823. m.Options = &LogSubscriptionOptions{}
  2824. }
  2825. if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2826. return err
  2827. }
  2828. iNdEx = postIndex
  2829. case 4:
  2830. if wireType != 0 {
  2831. return fmt.Errorf("proto: wrong wireType = %d for field Close", wireType)
  2832. }
  2833. var v int
  2834. for shift := uint(0); ; shift += 7 {
  2835. if shift >= 64 {
  2836. return ErrIntOverflowLogbroker
  2837. }
  2838. if iNdEx >= l {
  2839. return io.ErrUnexpectedEOF
  2840. }
  2841. b := dAtA[iNdEx]
  2842. iNdEx++
  2843. v |= (int(b) & 0x7F) << shift
  2844. if b < 0x80 {
  2845. break
  2846. }
  2847. }
  2848. m.Close = bool(v != 0)
  2849. default:
  2850. iNdEx = preIndex
  2851. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2852. if err != nil {
  2853. return err
  2854. }
  2855. if skippy < 0 {
  2856. return ErrInvalidLengthLogbroker
  2857. }
  2858. if (iNdEx + skippy) > l {
  2859. return io.ErrUnexpectedEOF
  2860. }
  2861. iNdEx += skippy
  2862. }
  2863. }
  2864. if iNdEx > l {
  2865. return io.ErrUnexpectedEOF
  2866. }
  2867. return nil
  2868. }
  2869. func (m *PublishLogsMessage) Unmarshal(dAtA []byte) error {
  2870. l := len(dAtA)
  2871. iNdEx := 0
  2872. for iNdEx < l {
  2873. preIndex := iNdEx
  2874. var wire uint64
  2875. for shift := uint(0); ; shift += 7 {
  2876. if shift >= 64 {
  2877. return ErrIntOverflowLogbroker
  2878. }
  2879. if iNdEx >= l {
  2880. return io.ErrUnexpectedEOF
  2881. }
  2882. b := dAtA[iNdEx]
  2883. iNdEx++
  2884. wire |= (uint64(b) & 0x7F) << shift
  2885. if b < 0x80 {
  2886. break
  2887. }
  2888. }
  2889. fieldNum := int32(wire >> 3)
  2890. wireType := int(wire & 0x7)
  2891. if wireType == 4 {
  2892. return fmt.Errorf("proto: PublishLogsMessage: wiretype end group for non-group")
  2893. }
  2894. if fieldNum <= 0 {
  2895. return fmt.Errorf("proto: PublishLogsMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2896. }
  2897. switch fieldNum {
  2898. case 1:
  2899. if wireType != 2 {
  2900. return fmt.Errorf("proto: wrong wireType = %d for field SubscriptionID", wireType)
  2901. }
  2902. var stringLen uint64
  2903. for shift := uint(0); ; shift += 7 {
  2904. if shift >= 64 {
  2905. return ErrIntOverflowLogbroker
  2906. }
  2907. if iNdEx >= l {
  2908. return io.ErrUnexpectedEOF
  2909. }
  2910. b := dAtA[iNdEx]
  2911. iNdEx++
  2912. stringLen |= (uint64(b) & 0x7F) << shift
  2913. if b < 0x80 {
  2914. break
  2915. }
  2916. }
  2917. intStringLen := int(stringLen)
  2918. if intStringLen < 0 {
  2919. return ErrInvalidLengthLogbroker
  2920. }
  2921. postIndex := iNdEx + intStringLen
  2922. if postIndex > l {
  2923. return io.ErrUnexpectedEOF
  2924. }
  2925. m.SubscriptionID = string(dAtA[iNdEx:postIndex])
  2926. iNdEx = postIndex
  2927. case 2:
  2928. if wireType != 2 {
  2929. return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType)
  2930. }
  2931. var msglen int
  2932. for shift := uint(0); ; shift += 7 {
  2933. if shift >= 64 {
  2934. return ErrIntOverflowLogbroker
  2935. }
  2936. if iNdEx >= l {
  2937. return io.ErrUnexpectedEOF
  2938. }
  2939. b := dAtA[iNdEx]
  2940. iNdEx++
  2941. msglen |= (int(b) & 0x7F) << shift
  2942. if b < 0x80 {
  2943. break
  2944. }
  2945. }
  2946. if msglen < 0 {
  2947. return ErrInvalidLengthLogbroker
  2948. }
  2949. postIndex := iNdEx + msglen
  2950. if postIndex > l {
  2951. return io.ErrUnexpectedEOF
  2952. }
  2953. m.Messages = append(m.Messages, LogMessage{})
  2954. if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2955. return err
  2956. }
  2957. iNdEx = postIndex
  2958. case 3:
  2959. if wireType != 0 {
  2960. return fmt.Errorf("proto: wrong wireType = %d for field Close", wireType)
  2961. }
  2962. var v int
  2963. for shift := uint(0); ; shift += 7 {
  2964. if shift >= 64 {
  2965. return ErrIntOverflowLogbroker
  2966. }
  2967. if iNdEx >= l {
  2968. return io.ErrUnexpectedEOF
  2969. }
  2970. b := dAtA[iNdEx]
  2971. iNdEx++
  2972. v |= (int(b) & 0x7F) << shift
  2973. if b < 0x80 {
  2974. break
  2975. }
  2976. }
  2977. m.Close = bool(v != 0)
  2978. default:
  2979. iNdEx = preIndex
  2980. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2981. if err != nil {
  2982. return err
  2983. }
  2984. if skippy < 0 {
  2985. return ErrInvalidLengthLogbroker
  2986. }
  2987. if (iNdEx + skippy) > l {
  2988. return io.ErrUnexpectedEOF
  2989. }
  2990. iNdEx += skippy
  2991. }
  2992. }
  2993. if iNdEx > l {
  2994. return io.ErrUnexpectedEOF
  2995. }
  2996. return nil
  2997. }
  2998. func (m *PublishLogsResponse) Unmarshal(dAtA []byte) error {
  2999. l := len(dAtA)
  3000. iNdEx := 0
  3001. for iNdEx < l {
  3002. preIndex := iNdEx
  3003. var wire uint64
  3004. for shift := uint(0); ; shift += 7 {
  3005. if shift >= 64 {
  3006. return ErrIntOverflowLogbroker
  3007. }
  3008. if iNdEx >= l {
  3009. return io.ErrUnexpectedEOF
  3010. }
  3011. b := dAtA[iNdEx]
  3012. iNdEx++
  3013. wire |= (uint64(b) & 0x7F) << shift
  3014. if b < 0x80 {
  3015. break
  3016. }
  3017. }
  3018. fieldNum := int32(wire >> 3)
  3019. wireType := int(wire & 0x7)
  3020. if wireType == 4 {
  3021. return fmt.Errorf("proto: PublishLogsResponse: wiretype end group for non-group")
  3022. }
  3023. if fieldNum <= 0 {
  3024. return fmt.Errorf("proto: PublishLogsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
  3025. }
  3026. switch fieldNum {
  3027. default:
  3028. iNdEx = preIndex
  3029. skippy, err := skipLogbroker(dAtA[iNdEx:])
  3030. if err != nil {
  3031. return err
  3032. }
  3033. if skippy < 0 {
  3034. return ErrInvalidLengthLogbroker
  3035. }
  3036. if (iNdEx + skippy) > l {
  3037. return io.ErrUnexpectedEOF
  3038. }
  3039. iNdEx += skippy
  3040. }
  3041. }
  3042. if iNdEx > l {
  3043. return io.ErrUnexpectedEOF
  3044. }
  3045. return nil
  3046. }
  3047. func skipLogbroker(dAtA []byte) (n int, err error) {
  3048. l := len(dAtA)
  3049. iNdEx := 0
  3050. for iNdEx < l {
  3051. var wire uint64
  3052. for shift := uint(0); ; shift += 7 {
  3053. if shift >= 64 {
  3054. return 0, ErrIntOverflowLogbroker
  3055. }
  3056. if iNdEx >= l {
  3057. return 0, io.ErrUnexpectedEOF
  3058. }
  3059. b := dAtA[iNdEx]
  3060. iNdEx++
  3061. wire |= (uint64(b) & 0x7F) << shift
  3062. if b < 0x80 {
  3063. break
  3064. }
  3065. }
  3066. wireType := int(wire & 0x7)
  3067. switch wireType {
  3068. case 0:
  3069. for shift := uint(0); ; shift += 7 {
  3070. if shift >= 64 {
  3071. return 0, ErrIntOverflowLogbroker
  3072. }
  3073. if iNdEx >= l {
  3074. return 0, io.ErrUnexpectedEOF
  3075. }
  3076. iNdEx++
  3077. if dAtA[iNdEx-1] < 0x80 {
  3078. break
  3079. }
  3080. }
  3081. return iNdEx, nil
  3082. case 1:
  3083. iNdEx += 8
  3084. return iNdEx, nil
  3085. case 2:
  3086. var length int
  3087. for shift := uint(0); ; shift += 7 {
  3088. if shift >= 64 {
  3089. return 0, ErrIntOverflowLogbroker
  3090. }
  3091. if iNdEx >= l {
  3092. return 0, io.ErrUnexpectedEOF
  3093. }
  3094. b := dAtA[iNdEx]
  3095. iNdEx++
  3096. length |= (int(b) & 0x7F) << shift
  3097. if b < 0x80 {
  3098. break
  3099. }
  3100. }
  3101. iNdEx += length
  3102. if length < 0 {
  3103. return 0, ErrInvalidLengthLogbroker
  3104. }
  3105. return iNdEx, nil
  3106. case 3:
  3107. for {
  3108. var innerWire uint64
  3109. var start int = iNdEx
  3110. for shift := uint(0); ; shift += 7 {
  3111. if shift >= 64 {
  3112. return 0, ErrIntOverflowLogbroker
  3113. }
  3114. if iNdEx >= l {
  3115. return 0, io.ErrUnexpectedEOF
  3116. }
  3117. b := dAtA[iNdEx]
  3118. iNdEx++
  3119. innerWire |= (uint64(b) & 0x7F) << shift
  3120. if b < 0x80 {
  3121. break
  3122. }
  3123. }
  3124. innerWireType := int(innerWire & 0x7)
  3125. if innerWireType == 4 {
  3126. break
  3127. }
  3128. next, err := skipLogbroker(dAtA[start:])
  3129. if err != nil {
  3130. return 0, err
  3131. }
  3132. iNdEx = start + next
  3133. }
  3134. return iNdEx, nil
  3135. case 4:
  3136. return iNdEx, nil
  3137. case 5:
  3138. iNdEx += 4
  3139. return iNdEx, nil
  3140. default:
  3141. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  3142. }
  3143. }
  3144. panic("unreachable")
  3145. }
  3146. var (
  3147. ErrInvalidLengthLogbroker = fmt.Errorf("proto: negative length found during unmarshaling")
  3148. ErrIntOverflowLogbroker = fmt.Errorf("proto: integer overflow")
  3149. )
  3150. func init() { proto.RegisterFile("logbroker.proto", fileDescriptorLogbroker) }
  3151. var fileDescriptorLogbroker = []byte{
  3152. // 944 bytes of a gzipped FileDescriptorProto
  3153. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x41, 0x6f, 0x1b, 0x45,
  3154. 0x14, 0xc7, 0x3d, 0xeb, 0xc4, 0x8e, 0x9f, 0x9b, 0xc4, 0x1d, 0xa7, 0x91, 0x65, 0xa8, 0x6d, 0x6d,
  3155. 0xa5, 0x62, 0x45, 0xc5, 0x6e, 0x8d, 0x10, 0x48, 0x91, 0x10, 0x35, 0xae, 0x90, 0x85, 0x9b, 0xa0,
  3156. 0xb1, 0x23, 0xb8, 0x45, 0x6b, 0xef, 0x74, 0x59, 0x79, 0xbd, 0x63, 0x76, 0xc6, 0x09, 0x48, 0x1c,
  3157. 0x38, 0x14, 0x09, 0xe5, 0xc0, 0x0d, 0x09, 0x0e, 0x3d, 0xd1, 0x0b, 0x42, 0xe2, 0xc2, 0x8d, 0x0f,
  3158. 0x80, 0x22, 0x4e, 0x1c, 0x39, 0x59, 0x74, 0x3f, 0x00, 0x9f, 0x01, 0xed, 0xcc, 0xd8, 0xde, 0x60,
  3159. 0xbb, 0x45, 0xe5, 0x92, 0xcc, 0xec, 0xfc, 0xdf, 0xbe, 0xdf, 0xfb, 0xcf, 0x7b, 0x6b, 0xd8, 0xf5,
  3160. 0x98, 0xd3, 0x0f, 0xd8, 0x90, 0x06, 0xb5, 0x71, 0xc0, 0x04, 0xc3, 0xd8, 0x66, 0x83, 0x68, 0xc7,
  3161. 0xcf, 0xad, 0x60, 0x34, 0x74, 0x45, 0xed, 0xec, 0x5e, 0x71, 0xcf, 0x61, 0x0e, 0x93, 0xc7, 0xf5,
  3162. 0x68, 0xa5, 0x94, 0xc5, 0xb2, 0xc3, 0x98, 0xe3, 0xd1, 0xba, 0xdc, 0xf5, 0x27, 0x8f, 0xea, 0xc2,
  3163. 0x1d, 0x51, 0x2e, 0xac, 0xd1, 0x58, 0x0b, 0xf2, 0x63, 0x6f, 0xe2, 0xb8, 0x7e, 0x5d, 0xfd, 0x53,
  3164. 0x0f, 0xcd, 0x5f, 0x10, 0xec, 0x77, 0x98, 0xd3, 0x9d, 0xf4, 0xf9, 0x20, 0x70, 0xc7, 0xc2, 0x65,
  3165. 0xfe, 0xb1, 0xfc, 0xcb, 0xf1, 0x21, 0xa4, 0xb9, 0x08, 0xa8, 0x35, 0xe2, 0x05, 0x54, 0x49, 0x56,
  3166. 0x77, 0x1a, 0x37, 0x6b, 0xcb, 0x30, 0xb5, 0x28, 0x58, 0xaa, 0x9a, 0x46, 0x2e, 0x41, 0x66, 0x11,
  3167. 0x78, 0x1f, 0x52, 0x8f, 0x98, 0xe7, 0xb1, 0xf3, 0x82, 0x51, 0x41, 0xd5, 0x2d, 0xa2, 0x77, 0x18,
  3168. 0xc3, 0x86, 0xb0, 0x5c, 0xaf, 0x90, 0xac, 0xa0, 0x6a, 0x92, 0xc8, 0x35, 0xbe, 0x0b, 0x9b, 0xdc,
  3169. 0xf5, 0x07, 0xb4, 0xb0, 0x51, 0x41, 0xd5, 0x6c, 0xa3, 0x58, 0x53, 0x95, 0xd4, 0x66, 0x95, 0xd4,
  3170. 0x7a, 0xb3, 0x4a, 0x88, 0x12, 0x9a, 0xdf, 0x20, 0xc8, 0x46, 0x89, 0xa9, 0x47, 0x07, 0x82, 0x05,
  3171. 0xb8, 0x0e, 0x59, 0x4e, 0x83, 0x33, 0x77, 0x40, 0x4f, 0x5d, 0x5b, 0xe1, 0x66, 0x9a, 0x3b, 0xe1,
  3172. 0xb4, 0x0c, 0x5d, 0xf5, 0xb8, 0xdd, 0xe2, 0x04, 0xb4, 0xa4, 0x6d, 0x73, 0x7c, 0x1b, 0xb6, 0x7c,
  3173. 0x66, 0x2b, 0xb5, 0x21, 0xd5, 0xd9, 0x70, 0x5a, 0x4e, 0x1f, 0x31, 0x5b, 0x4a, 0xd3, 0xd1, 0xa1,
  3174. 0xd6, 0x09, 0x8b, 0x0f, 0xa5, 0x2e, 0xb9, 0xd0, 0xf5, 0x2c, 0x3e, 0x94, 0xba, 0xe8, 0xb0, 0x6d,
  3175. 0x73, 0xf3, 0x31, 0x02, 0xe8, 0x30, 0xe7, 0x3d, 0xe6, 0x0b, 0xfa, 0x99, 0xc0, 0x77, 0x00, 0x16,
  3176. 0x3c, 0x05, 0x54, 0x41, 0xd5, 0x4c, 0x73, 0x3b, 0x9c, 0x96, 0x33, 0x73, 0x1c, 0x92, 0x99, 0xd3,
  3177. 0xe0, 0x5b, 0x90, 0xd6, 0x30, 0xd2, 0xac, 0x4c, 0x13, 0xc2, 0x69, 0x39, 0xa5, 0x58, 0x48, 0x4a,
  3178. 0xa1, 0x44, 0x22, 0x4d, 0x22, 0xbd, 0xd3, 0x22, 0x05, 0x42, 0x52, 0x8a, 0xc3, 0xbc, 0x07, 0xe9,
  3179. 0x0e, 0x73, 0xee, 0x0b, 0x11, 0xe0, 0x1c, 0x24, 0x87, 0xf4, 0x73, 0x95, 0x9b, 0x44, 0x4b, 0xbc,
  3180. 0x07, 0x9b, 0x67, 0x96, 0x37, 0xa1, 0x2a, 0x09, 0x51, 0x1b, 0xf3, 0xc2, 0x90, 0xe4, 0x0f, 0x29,
  3181. 0xe7, 0x96, 0x43, 0xf1, 0x3b, 0x90, 0x1e, 0xa8, 0x22, 0x64, 0x68, 0xb6, 0x51, 0x5a, 0x73, 0xe9,
  3182. 0xba, 0xd4, 0xe6, 0xc6, 0xe5, 0xb4, 0x9c, 0x20, 0xb3, 0x20, 0xfc, 0x36, 0x64, 0xe6, 0x7d, 0x27,
  3183. 0x13, 0x3d, 0xff, 0x3e, 0x17, 0x62, 0xfc, 0x26, 0xa4, 0x54, 0xf3, 0xc8, 0xfa, 0x5e, 0xd4, 0x6d,
  3184. 0x44, 0x8b, 0xa3, 0x86, 0xb2, 0x2d, 0x61, 0xc9, 0xde, 0xb9, 0x46, 0xe4, 0x1a, 0xbf, 0x05, 0x9b,
  3185. 0x96, 0x10, 0x01, 0x2f, 0x6c, 0x56, 0x92, 0xd5, 0x6c, 0xe3, 0x95, 0x35, 0x6f, 0x8a, 0x7c, 0xd2,
  3186. 0xfc, 0x4a, 0x6f, 0x7e, 0x8f, 0x60, 0x4f, 0x8f, 0x42, 0x9f, 0x76, 0x98, 0xc3, 0x09, 0xfd, 0x74,
  3187. 0x42, 0xb9, 0xc0, 0x87, 0xb0, 0xc5, 0x75, 0xb3, 0x69, 0x5f, 0xca, 0xeb, 0xf0, 0xb4, 0x8c, 0xcc,
  3188. 0x03, 0x70, 0x0b, 0xd2, 0x4c, 0xcd, 0x94, 0x76, 0xe4, 0x60, 0x5d, 0xec, 0xf2, 0x14, 0x92, 0x59,
  3189. 0xa8, 0xf9, 0xf1, 0xbf, 0xd0, 0x66, 0x37, 0xf6, 0x2e, 0x6c, 0x8d, 0xd4, 0x52, 0x35, 0xfe, 0xfa,
  3190. 0x2b, 0xd3, 0x11, 0xba, 0xe4, 0x79, 0x94, 0xf9, 0x2a, 0x14, 0x3b, 0x2e, 0x17, 0xd4, 0x8f, 0xe7,
  3191. 0x9f, 0x95, 0x6e, 0xfe, 0x86, 0x20, 0x1f, 0x3f, 0x98, 0xe5, 0xdd, 0x07, 0x63, 0xde, 0xdb, 0xa9,
  3192. 0x70, 0x5a, 0x36, 0xda, 0x2d, 0x62, 0xb8, 0xf6, 0x15, 0xab, 0x8c, 0xff, 0x61, 0x55, 0xf2, 0xa5,
  3193. 0xad, 0x8a, 0x3a, 0x7d, 0xe0, 0x31, 0xae, 0x3e, 0x28, 0x5b, 0x44, 0x6d, 0xcc, 0x1f, 0x11, 0xe0,
  3194. 0x0f, 0x27, 0x7d, 0xcf, 0xe5, 0x9f, 0xc4, 0xfd, 0x3b, 0x84, 0x5d, 0x1e, 0x7b, 0xd9, 0x62, 0x60,
  3195. 0x71, 0x38, 0x2d, 0xef, 0xc4, 0xf3, 0xb4, 0x5b, 0x64, 0x27, 0x2e, 0x6d, 0xdb, 0x57, 0xcc, 0x37,
  3196. 0x5e, 0xc6, 0xfc, 0x05, 0x6b, 0x32, 0xce, 0x7a, 0x03, 0xf2, 0x31, 0x54, 0x42, 0xf9, 0x98, 0xf9,
  3197. 0x9c, 0x1e, 0x3c, 0x45, 0x90, 0x99, 0x8f, 0x00, 0xbe, 0x03, 0xb8, 0x73, 0xfc, 0xfe, 0x69, 0xb7,
  3198. 0x47, 0x1e, 0xdc, 0x7f, 0x78, 0x7a, 0x72, 0xf4, 0xc1, 0xd1, 0xf1, 0x47, 0x47, 0xb9, 0x44, 0x71,
  3199. 0xef, 0xe2, 0x49, 0x25, 0x37, 0x97, 0x9d, 0xf8, 0x43, 0x9f, 0x9d, 0xfb, 0xf8, 0x00, 0xae, 0xc7,
  3200. 0xd4, 0xdd, 0x5e, 0xeb, 0xf8, 0xa4, 0x97, 0x43, 0xc5, 0xfc, 0xc5, 0x93, 0xca, 0xee, 0x5c, 0xdc,
  3201. 0x15, 0x36, 0x9b, 0x88, 0x65, 0xed, 0x03, 0x42, 0x72, 0xc6, 0xb2, 0x96, 0x06, 0x41, 0xf1, 0xfa,
  3202. 0xd7, 0x3f, 0x94, 0x12, 0xbf, 0x3e, 0x2d, 0x2d, 0xc0, 0x1a, 0x8f, 0x11, 0x6c, 0x44, 0xdc, 0xf8,
  3203. 0x0b, 0xd8, 0xbe, 0xd2, 0xb3, 0xb8, 0xba, 0xca, 0x9d, 0x55, 0x13, 0x57, 0x7c, 0xb1, 0x52, 0x3b,
  3204. 0x6a, 0xde, 0xf8, 0xfd, 0xe7, 0xbf, 0xbf, 0x33, 0x76, 0x61, 0x5b, 0x2a, 0x5f, 0x1f, 0x59, 0xbe,
  3205. 0xe5, 0xd0, 0xe0, 0x2e, 0x6a, 0xfc, 0x64, 0x48, 0xb7, 0x9a, 0xf2, 0xf7, 0x14, 0x7f, 0x8b, 0x20,
  3206. 0xbf, 0xa2, 0xcd, 0x71, 0x6d, 0xe5, 0x85, 0xad, 0x9d, 0x87, 0xe2, 0x6b, 0xcf, 0x01, 0x8b, 0x0f,
  3207. 0x88, 0x79, 0x4b, 0x72, 0xdd, 0x84, 0x6b, 0x8a, 0xeb, 0x9c, 0x05, 0x43, 0x1a, 0x2c, 0x51, 0xe2,
  3208. 0xaf, 0x10, 0x64, 0x63, 0x77, 0x8d, 0x6f, 0xaf, 0x7a, 0xff, 0x72, 0xdf, 0xae, 0xe6, 0x58, 0xd1,
  3209. 0x34, 0xff, 0x89, 0xa3, 0x8a, 0x9a, 0x85, 0xcb, 0x67, 0xa5, 0xc4, 0x9f, 0xcf, 0x4a, 0x89, 0x2f,
  3210. 0xc3, 0x12, 0xba, 0x0c, 0x4b, 0xe8, 0x8f, 0xb0, 0x84, 0xfe, 0x0a, 0x4b, 0xa8, 0x9f, 0x92, 0x1f,
  3211. 0xee, 0x37, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x08, 0xa1, 0xea, 0xc7, 0x9d, 0x08, 0x00, 0x00,
  3212. }