logbroker.pb.go 86 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428
  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,packed,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. dAtA2 := make([]byte, len(m.Streams)*10)
  685. var j1 int
  686. for _, num := range m.Streams {
  687. for num >= 1<<7 {
  688. dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80)
  689. num >>= 7
  690. j1++
  691. }
  692. dAtA2[j1] = uint8(num)
  693. j1++
  694. }
  695. dAtA[i] = 0xa
  696. i++
  697. i = encodeVarintLogbroker(dAtA, i, uint64(j1))
  698. i += copy(dAtA[i:], dAtA2[:j1])
  699. }
  700. if m.Follow {
  701. dAtA[i] = 0x10
  702. i++
  703. if m.Follow {
  704. dAtA[i] = 1
  705. } else {
  706. dAtA[i] = 0
  707. }
  708. i++
  709. }
  710. if m.Tail != 0 {
  711. dAtA[i] = 0x18
  712. i++
  713. i = encodeVarintLogbroker(dAtA, i, uint64(m.Tail))
  714. }
  715. if m.Since != nil {
  716. dAtA[i] = 0x22
  717. i++
  718. i = encodeVarintLogbroker(dAtA, i, uint64(m.Since.Size()))
  719. n3, err := m.Since.MarshalTo(dAtA[i:])
  720. if err != nil {
  721. return 0, err
  722. }
  723. i += n3
  724. }
  725. return i, nil
  726. }
  727. func (m *LogSelector) Marshal() (dAtA []byte, err error) {
  728. size := m.Size()
  729. dAtA = make([]byte, size)
  730. n, err := m.MarshalTo(dAtA)
  731. if err != nil {
  732. return nil, err
  733. }
  734. return dAtA[:n], nil
  735. }
  736. func (m *LogSelector) MarshalTo(dAtA []byte) (int, error) {
  737. var i int
  738. _ = i
  739. var l int
  740. _ = l
  741. if len(m.ServiceIDs) > 0 {
  742. for _, s := range m.ServiceIDs {
  743. dAtA[i] = 0xa
  744. i++
  745. l = len(s)
  746. for l >= 1<<7 {
  747. dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
  748. l >>= 7
  749. i++
  750. }
  751. dAtA[i] = uint8(l)
  752. i++
  753. i += copy(dAtA[i:], s)
  754. }
  755. }
  756. if len(m.NodeIDs) > 0 {
  757. for _, s := range m.NodeIDs {
  758. dAtA[i] = 0x12
  759. i++
  760. l = len(s)
  761. for l >= 1<<7 {
  762. dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
  763. l >>= 7
  764. i++
  765. }
  766. dAtA[i] = uint8(l)
  767. i++
  768. i += copy(dAtA[i:], s)
  769. }
  770. }
  771. if len(m.TaskIDs) > 0 {
  772. for _, s := range m.TaskIDs {
  773. dAtA[i] = 0x1a
  774. i++
  775. l = len(s)
  776. for l >= 1<<7 {
  777. dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
  778. l >>= 7
  779. i++
  780. }
  781. dAtA[i] = uint8(l)
  782. i++
  783. i += copy(dAtA[i:], s)
  784. }
  785. }
  786. return i, nil
  787. }
  788. func (m *LogContext) Marshal() (dAtA []byte, err error) {
  789. size := m.Size()
  790. dAtA = make([]byte, size)
  791. n, err := m.MarshalTo(dAtA)
  792. if err != nil {
  793. return nil, err
  794. }
  795. return dAtA[:n], nil
  796. }
  797. func (m *LogContext) MarshalTo(dAtA []byte) (int, error) {
  798. var i int
  799. _ = i
  800. var l int
  801. _ = l
  802. if len(m.ServiceID) > 0 {
  803. dAtA[i] = 0xa
  804. i++
  805. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.ServiceID)))
  806. i += copy(dAtA[i:], m.ServiceID)
  807. }
  808. if len(m.NodeID) > 0 {
  809. dAtA[i] = 0x12
  810. i++
  811. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.NodeID)))
  812. i += copy(dAtA[i:], m.NodeID)
  813. }
  814. if len(m.TaskID) > 0 {
  815. dAtA[i] = 0x1a
  816. i++
  817. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.TaskID)))
  818. i += copy(dAtA[i:], m.TaskID)
  819. }
  820. return i, nil
  821. }
  822. func (m *LogAttr) Marshal() (dAtA []byte, err error) {
  823. size := m.Size()
  824. dAtA = make([]byte, size)
  825. n, err := m.MarshalTo(dAtA)
  826. if err != nil {
  827. return nil, err
  828. }
  829. return dAtA[:n], nil
  830. }
  831. func (m *LogAttr) MarshalTo(dAtA []byte) (int, error) {
  832. var i int
  833. _ = i
  834. var l int
  835. _ = l
  836. if len(m.Key) > 0 {
  837. dAtA[i] = 0xa
  838. i++
  839. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.Key)))
  840. i += copy(dAtA[i:], m.Key)
  841. }
  842. if len(m.Value) > 0 {
  843. dAtA[i] = 0x12
  844. i++
  845. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.Value)))
  846. i += copy(dAtA[i:], m.Value)
  847. }
  848. return i, nil
  849. }
  850. func (m *LogMessage) Marshal() (dAtA []byte, err error) {
  851. size := m.Size()
  852. dAtA = make([]byte, size)
  853. n, err := m.MarshalTo(dAtA)
  854. if err != nil {
  855. return nil, err
  856. }
  857. return dAtA[:n], nil
  858. }
  859. func (m *LogMessage) MarshalTo(dAtA []byte) (int, error) {
  860. var i int
  861. _ = i
  862. var l int
  863. _ = l
  864. dAtA[i] = 0xa
  865. i++
  866. i = encodeVarintLogbroker(dAtA, i, uint64(m.Context.Size()))
  867. n4, err := m.Context.MarshalTo(dAtA[i:])
  868. if err != nil {
  869. return 0, err
  870. }
  871. i += n4
  872. if m.Timestamp != nil {
  873. dAtA[i] = 0x12
  874. i++
  875. i = encodeVarintLogbroker(dAtA, i, uint64(m.Timestamp.Size()))
  876. n5, err := m.Timestamp.MarshalTo(dAtA[i:])
  877. if err != nil {
  878. return 0, err
  879. }
  880. i += n5
  881. }
  882. if m.Stream != 0 {
  883. dAtA[i] = 0x18
  884. i++
  885. i = encodeVarintLogbroker(dAtA, i, uint64(m.Stream))
  886. }
  887. if len(m.Data) > 0 {
  888. dAtA[i] = 0x22
  889. i++
  890. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.Data)))
  891. i += copy(dAtA[i:], m.Data)
  892. }
  893. if len(m.Attrs) > 0 {
  894. for _, msg := range m.Attrs {
  895. dAtA[i] = 0x2a
  896. i++
  897. i = encodeVarintLogbroker(dAtA, i, uint64(msg.Size()))
  898. n, err := msg.MarshalTo(dAtA[i:])
  899. if err != nil {
  900. return 0, err
  901. }
  902. i += n
  903. }
  904. }
  905. return i, nil
  906. }
  907. func (m *SubscribeLogsRequest) Marshal() (dAtA []byte, err error) {
  908. size := m.Size()
  909. dAtA = make([]byte, size)
  910. n, err := m.MarshalTo(dAtA)
  911. if err != nil {
  912. return nil, err
  913. }
  914. return dAtA[:n], nil
  915. }
  916. func (m *SubscribeLogsRequest) MarshalTo(dAtA []byte) (int, error) {
  917. var i int
  918. _ = i
  919. var l int
  920. _ = l
  921. if m.Selector != nil {
  922. dAtA[i] = 0xa
  923. i++
  924. i = encodeVarintLogbroker(dAtA, i, uint64(m.Selector.Size()))
  925. n6, err := m.Selector.MarshalTo(dAtA[i:])
  926. if err != nil {
  927. return 0, err
  928. }
  929. i += n6
  930. }
  931. if m.Options != nil {
  932. dAtA[i] = 0x12
  933. i++
  934. i = encodeVarintLogbroker(dAtA, i, uint64(m.Options.Size()))
  935. n7, err := m.Options.MarshalTo(dAtA[i:])
  936. if err != nil {
  937. return 0, err
  938. }
  939. i += n7
  940. }
  941. return i, nil
  942. }
  943. func (m *SubscribeLogsMessage) Marshal() (dAtA []byte, err error) {
  944. size := m.Size()
  945. dAtA = make([]byte, size)
  946. n, err := m.MarshalTo(dAtA)
  947. if err != nil {
  948. return nil, err
  949. }
  950. return dAtA[:n], nil
  951. }
  952. func (m *SubscribeLogsMessage) MarshalTo(dAtA []byte) (int, error) {
  953. var i int
  954. _ = i
  955. var l int
  956. _ = l
  957. if len(m.Messages) > 0 {
  958. for _, msg := range m.Messages {
  959. dAtA[i] = 0xa
  960. i++
  961. i = encodeVarintLogbroker(dAtA, i, uint64(msg.Size()))
  962. n, err := msg.MarshalTo(dAtA[i:])
  963. if err != nil {
  964. return 0, err
  965. }
  966. i += n
  967. }
  968. }
  969. return i, nil
  970. }
  971. func (m *ListenSubscriptionsRequest) Marshal() (dAtA []byte, err error) {
  972. size := m.Size()
  973. dAtA = make([]byte, size)
  974. n, err := m.MarshalTo(dAtA)
  975. if err != nil {
  976. return nil, err
  977. }
  978. return dAtA[:n], nil
  979. }
  980. func (m *ListenSubscriptionsRequest) MarshalTo(dAtA []byte) (int, error) {
  981. var i int
  982. _ = i
  983. var l int
  984. _ = l
  985. return i, nil
  986. }
  987. func (m *SubscriptionMessage) Marshal() (dAtA []byte, err error) {
  988. size := m.Size()
  989. dAtA = make([]byte, size)
  990. n, err := m.MarshalTo(dAtA)
  991. if err != nil {
  992. return nil, err
  993. }
  994. return dAtA[:n], nil
  995. }
  996. func (m *SubscriptionMessage) MarshalTo(dAtA []byte) (int, error) {
  997. var i int
  998. _ = i
  999. var l int
  1000. _ = l
  1001. if len(m.ID) > 0 {
  1002. dAtA[i] = 0xa
  1003. i++
  1004. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.ID)))
  1005. i += copy(dAtA[i:], m.ID)
  1006. }
  1007. if m.Selector != nil {
  1008. dAtA[i] = 0x12
  1009. i++
  1010. i = encodeVarintLogbroker(dAtA, i, uint64(m.Selector.Size()))
  1011. n8, err := m.Selector.MarshalTo(dAtA[i:])
  1012. if err != nil {
  1013. return 0, err
  1014. }
  1015. i += n8
  1016. }
  1017. if m.Options != nil {
  1018. dAtA[i] = 0x1a
  1019. i++
  1020. i = encodeVarintLogbroker(dAtA, i, uint64(m.Options.Size()))
  1021. n9, err := m.Options.MarshalTo(dAtA[i:])
  1022. if err != nil {
  1023. return 0, err
  1024. }
  1025. i += n9
  1026. }
  1027. if m.Close {
  1028. dAtA[i] = 0x20
  1029. i++
  1030. if m.Close {
  1031. dAtA[i] = 1
  1032. } else {
  1033. dAtA[i] = 0
  1034. }
  1035. i++
  1036. }
  1037. return i, nil
  1038. }
  1039. func (m *PublishLogsMessage) Marshal() (dAtA []byte, err error) {
  1040. size := m.Size()
  1041. dAtA = make([]byte, size)
  1042. n, err := m.MarshalTo(dAtA)
  1043. if err != nil {
  1044. return nil, err
  1045. }
  1046. return dAtA[:n], nil
  1047. }
  1048. func (m *PublishLogsMessage) MarshalTo(dAtA []byte) (int, error) {
  1049. var i int
  1050. _ = i
  1051. var l int
  1052. _ = l
  1053. if len(m.SubscriptionID) > 0 {
  1054. dAtA[i] = 0xa
  1055. i++
  1056. i = encodeVarintLogbroker(dAtA, i, uint64(len(m.SubscriptionID)))
  1057. i += copy(dAtA[i:], m.SubscriptionID)
  1058. }
  1059. if len(m.Messages) > 0 {
  1060. for _, msg := range m.Messages {
  1061. dAtA[i] = 0x12
  1062. i++
  1063. i = encodeVarintLogbroker(dAtA, i, uint64(msg.Size()))
  1064. n, err := msg.MarshalTo(dAtA[i:])
  1065. if err != nil {
  1066. return 0, err
  1067. }
  1068. i += n
  1069. }
  1070. }
  1071. if m.Close {
  1072. dAtA[i] = 0x18
  1073. i++
  1074. if m.Close {
  1075. dAtA[i] = 1
  1076. } else {
  1077. dAtA[i] = 0
  1078. }
  1079. i++
  1080. }
  1081. return i, nil
  1082. }
  1083. func (m *PublishLogsResponse) Marshal() (dAtA []byte, err error) {
  1084. size := m.Size()
  1085. dAtA = make([]byte, size)
  1086. n, err := m.MarshalTo(dAtA)
  1087. if err != nil {
  1088. return nil, err
  1089. }
  1090. return dAtA[:n], nil
  1091. }
  1092. func (m *PublishLogsResponse) MarshalTo(dAtA []byte) (int, error) {
  1093. var i int
  1094. _ = i
  1095. var l int
  1096. _ = l
  1097. return i, nil
  1098. }
  1099. func encodeFixed64Logbroker(dAtA []byte, offset int, v uint64) int {
  1100. dAtA[offset] = uint8(v)
  1101. dAtA[offset+1] = uint8(v >> 8)
  1102. dAtA[offset+2] = uint8(v >> 16)
  1103. dAtA[offset+3] = uint8(v >> 24)
  1104. dAtA[offset+4] = uint8(v >> 32)
  1105. dAtA[offset+5] = uint8(v >> 40)
  1106. dAtA[offset+6] = uint8(v >> 48)
  1107. dAtA[offset+7] = uint8(v >> 56)
  1108. return offset + 8
  1109. }
  1110. func encodeFixed32Logbroker(dAtA []byte, offset int, v uint32) int {
  1111. dAtA[offset] = uint8(v)
  1112. dAtA[offset+1] = uint8(v >> 8)
  1113. dAtA[offset+2] = uint8(v >> 16)
  1114. dAtA[offset+3] = uint8(v >> 24)
  1115. return offset + 4
  1116. }
  1117. func encodeVarintLogbroker(dAtA []byte, offset int, v uint64) int {
  1118. for v >= 1<<7 {
  1119. dAtA[offset] = uint8(v&0x7f | 0x80)
  1120. v >>= 7
  1121. offset++
  1122. }
  1123. dAtA[offset] = uint8(v)
  1124. return offset + 1
  1125. }
  1126. type raftProxyLogsServer struct {
  1127. local LogsServer
  1128. connSelector raftselector.ConnProvider
  1129. localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error)
  1130. }
  1131. func NewRaftProxyLogsServer(local LogsServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) LogsServer {
  1132. redirectChecker := func(ctx context.Context) (context.Context, error) {
  1133. s, ok := transport.StreamFromContext(ctx)
  1134. if !ok {
  1135. return ctx, grpc.Errorf(codes.InvalidArgument, "remote addr is not found in context")
  1136. }
  1137. addr := s.ServerTransport().RemoteAddr().String()
  1138. md, ok := metadata.FromContext(ctx)
  1139. if ok && len(md["redirect"]) != 0 {
  1140. return ctx, grpc.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"])
  1141. }
  1142. if !ok {
  1143. md = metadata.New(map[string]string{})
  1144. }
  1145. md["redirect"] = append(md["redirect"], addr)
  1146. return metadata.NewContext(ctx, md), nil
  1147. }
  1148. remoteMods := []func(context.Context) (context.Context, error){redirectChecker}
  1149. remoteMods = append(remoteMods, remoteCtxMod)
  1150. var localMods []func(context.Context) (context.Context, error)
  1151. if localCtxMod != nil {
  1152. localMods = []func(context.Context) (context.Context, error){localCtxMod}
  1153. }
  1154. return &raftProxyLogsServer{
  1155. local: local,
  1156. connSelector: connSelector,
  1157. localCtxMods: localMods,
  1158. remoteCtxMods: remoteMods,
  1159. }
  1160. }
  1161. func (p *raftProxyLogsServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
  1162. var err error
  1163. for _, mod := range ctxMods {
  1164. ctx, err = mod(ctx)
  1165. if err != nil {
  1166. return ctx, err
  1167. }
  1168. }
  1169. return ctx, nil
  1170. }
  1171. func (p *raftProxyLogsServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
  1172. ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
  1173. defer ticker.Stop()
  1174. for {
  1175. select {
  1176. case <-ticker.C:
  1177. conn, err := p.connSelector.LeaderConn(ctx)
  1178. if err != nil {
  1179. return nil, err
  1180. }
  1181. client := NewHealthClient(conn)
  1182. resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"})
  1183. if err != nil || resp.Status != HealthCheckResponse_SERVING {
  1184. continue
  1185. }
  1186. return conn, nil
  1187. case <-ctx.Done():
  1188. return nil, ctx.Err()
  1189. }
  1190. }
  1191. }
  1192. type Logs_SubscribeLogsServerWrapper struct {
  1193. Logs_SubscribeLogsServer
  1194. ctx context.Context
  1195. }
  1196. func (s Logs_SubscribeLogsServerWrapper) Context() context.Context {
  1197. return s.ctx
  1198. }
  1199. func (p *raftProxyLogsServer) SubscribeLogs(r *SubscribeLogsRequest, stream Logs_SubscribeLogsServer) error {
  1200. ctx := stream.Context()
  1201. conn, err := p.connSelector.LeaderConn(ctx)
  1202. if err != nil {
  1203. if err == raftselector.ErrIsLeader {
  1204. ctx, err = p.runCtxMods(ctx, p.localCtxMods)
  1205. if err != nil {
  1206. return err
  1207. }
  1208. streamWrapper := Logs_SubscribeLogsServerWrapper{
  1209. Logs_SubscribeLogsServer: stream,
  1210. ctx: ctx,
  1211. }
  1212. return p.local.SubscribeLogs(r, streamWrapper)
  1213. }
  1214. return err
  1215. }
  1216. ctx, err = p.runCtxMods(ctx, p.remoteCtxMods)
  1217. if err != nil {
  1218. return err
  1219. }
  1220. clientStream, err := NewLogsClient(conn).SubscribeLogs(ctx, r)
  1221. if err != nil {
  1222. return err
  1223. }
  1224. for {
  1225. msg, err := clientStream.Recv()
  1226. if err == io.EOF {
  1227. break
  1228. }
  1229. if err != nil {
  1230. return err
  1231. }
  1232. if err := stream.Send(msg); err != nil {
  1233. return err
  1234. }
  1235. }
  1236. return nil
  1237. }
  1238. type raftProxyLogBrokerServer struct {
  1239. local LogBrokerServer
  1240. connSelector raftselector.ConnProvider
  1241. localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error)
  1242. }
  1243. func NewRaftProxyLogBrokerServer(local LogBrokerServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) LogBrokerServer {
  1244. redirectChecker := func(ctx context.Context) (context.Context, error) {
  1245. s, ok := transport.StreamFromContext(ctx)
  1246. if !ok {
  1247. return ctx, grpc.Errorf(codes.InvalidArgument, "remote addr is not found in context")
  1248. }
  1249. addr := s.ServerTransport().RemoteAddr().String()
  1250. md, ok := metadata.FromContext(ctx)
  1251. if ok && len(md["redirect"]) != 0 {
  1252. return ctx, grpc.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"])
  1253. }
  1254. if !ok {
  1255. md = metadata.New(map[string]string{})
  1256. }
  1257. md["redirect"] = append(md["redirect"], addr)
  1258. return metadata.NewContext(ctx, md), nil
  1259. }
  1260. remoteMods := []func(context.Context) (context.Context, error){redirectChecker}
  1261. remoteMods = append(remoteMods, remoteCtxMod)
  1262. var localMods []func(context.Context) (context.Context, error)
  1263. if localCtxMod != nil {
  1264. localMods = []func(context.Context) (context.Context, error){localCtxMod}
  1265. }
  1266. return &raftProxyLogBrokerServer{
  1267. local: local,
  1268. connSelector: connSelector,
  1269. localCtxMods: localMods,
  1270. remoteCtxMods: remoteMods,
  1271. }
  1272. }
  1273. func (p *raftProxyLogBrokerServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
  1274. var err error
  1275. for _, mod := range ctxMods {
  1276. ctx, err = mod(ctx)
  1277. if err != nil {
  1278. return ctx, err
  1279. }
  1280. }
  1281. return ctx, nil
  1282. }
  1283. func (p *raftProxyLogBrokerServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
  1284. ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
  1285. defer ticker.Stop()
  1286. for {
  1287. select {
  1288. case <-ticker.C:
  1289. conn, err := p.connSelector.LeaderConn(ctx)
  1290. if err != nil {
  1291. return nil, err
  1292. }
  1293. client := NewHealthClient(conn)
  1294. resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"})
  1295. if err != nil || resp.Status != HealthCheckResponse_SERVING {
  1296. continue
  1297. }
  1298. return conn, nil
  1299. case <-ctx.Done():
  1300. return nil, ctx.Err()
  1301. }
  1302. }
  1303. }
  1304. type LogBroker_ListenSubscriptionsServerWrapper struct {
  1305. LogBroker_ListenSubscriptionsServer
  1306. ctx context.Context
  1307. }
  1308. func (s LogBroker_ListenSubscriptionsServerWrapper) Context() context.Context {
  1309. return s.ctx
  1310. }
  1311. func (p *raftProxyLogBrokerServer) ListenSubscriptions(r *ListenSubscriptionsRequest, stream LogBroker_ListenSubscriptionsServer) error {
  1312. ctx := stream.Context()
  1313. conn, err := p.connSelector.LeaderConn(ctx)
  1314. if err != nil {
  1315. if err == raftselector.ErrIsLeader {
  1316. ctx, err = p.runCtxMods(ctx, p.localCtxMods)
  1317. if err != nil {
  1318. return err
  1319. }
  1320. streamWrapper := LogBroker_ListenSubscriptionsServerWrapper{
  1321. LogBroker_ListenSubscriptionsServer: stream,
  1322. ctx: ctx,
  1323. }
  1324. return p.local.ListenSubscriptions(r, streamWrapper)
  1325. }
  1326. return err
  1327. }
  1328. ctx, err = p.runCtxMods(ctx, p.remoteCtxMods)
  1329. if err != nil {
  1330. return err
  1331. }
  1332. clientStream, err := NewLogBrokerClient(conn).ListenSubscriptions(ctx, r)
  1333. if err != nil {
  1334. return err
  1335. }
  1336. for {
  1337. msg, err := clientStream.Recv()
  1338. if err == io.EOF {
  1339. break
  1340. }
  1341. if err != nil {
  1342. return err
  1343. }
  1344. if err := stream.Send(msg); err != nil {
  1345. return err
  1346. }
  1347. }
  1348. return nil
  1349. }
  1350. type LogBroker_PublishLogsServerWrapper struct {
  1351. LogBroker_PublishLogsServer
  1352. ctx context.Context
  1353. }
  1354. func (s LogBroker_PublishLogsServerWrapper) Context() context.Context {
  1355. return s.ctx
  1356. }
  1357. func (p *raftProxyLogBrokerServer) PublishLogs(stream LogBroker_PublishLogsServer) error {
  1358. ctx := stream.Context()
  1359. conn, err := p.connSelector.LeaderConn(ctx)
  1360. if err != nil {
  1361. if err == raftselector.ErrIsLeader {
  1362. ctx, err = p.runCtxMods(ctx, p.localCtxMods)
  1363. if err != nil {
  1364. return err
  1365. }
  1366. streamWrapper := LogBroker_PublishLogsServerWrapper{
  1367. LogBroker_PublishLogsServer: stream,
  1368. ctx: ctx,
  1369. }
  1370. return p.local.PublishLogs(streamWrapper)
  1371. }
  1372. return err
  1373. }
  1374. ctx, err = p.runCtxMods(ctx, p.remoteCtxMods)
  1375. if err != nil {
  1376. return err
  1377. }
  1378. clientStream, err := NewLogBrokerClient(conn).PublishLogs(ctx)
  1379. if err != nil {
  1380. return err
  1381. }
  1382. for {
  1383. msg, err := stream.Recv()
  1384. if err == io.EOF {
  1385. break
  1386. }
  1387. if err != nil {
  1388. return err
  1389. }
  1390. if err := clientStream.Send(msg); err != nil {
  1391. return err
  1392. }
  1393. }
  1394. reply, err := clientStream.CloseAndRecv()
  1395. if err != nil {
  1396. return err
  1397. }
  1398. return stream.SendAndClose(reply)
  1399. }
  1400. func (m *LogSubscriptionOptions) Size() (n int) {
  1401. var l int
  1402. _ = l
  1403. if len(m.Streams) > 0 {
  1404. l = 0
  1405. for _, e := range m.Streams {
  1406. l += sovLogbroker(uint64(e))
  1407. }
  1408. n += 1 + sovLogbroker(uint64(l)) + l
  1409. }
  1410. if m.Follow {
  1411. n += 2
  1412. }
  1413. if m.Tail != 0 {
  1414. n += 1 + sovLogbroker(uint64(m.Tail))
  1415. }
  1416. if m.Since != nil {
  1417. l = m.Since.Size()
  1418. n += 1 + l + sovLogbroker(uint64(l))
  1419. }
  1420. return n
  1421. }
  1422. func (m *LogSelector) Size() (n int) {
  1423. var l int
  1424. _ = l
  1425. if len(m.ServiceIDs) > 0 {
  1426. for _, s := range m.ServiceIDs {
  1427. l = len(s)
  1428. n += 1 + l + sovLogbroker(uint64(l))
  1429. }
  1430. }
  1431. if len(m.NodeIDs) > 0 {
  1432. for _, s := range m.NodeIDs {
  1433. l = len(s)
  1434. n += 1 + l + sovLogbroker(uint64(l))
  1435. }
  1436. }
  1437. if len(m.TaskIDs) > 0 {
  1438. for _, s := range m.TaskIDs {
  1439. l = len(s)
  1440. n += 1 + l + sovLogbroker(uint64(l))
  1441. }
  1442. }
  1443. return n
  1444. }
  1445. func (m *LogContext) Size() (n int) {
  1446. var l int
  1447. _ = l
  1448. l = len(m.ServiceID)
  1449. if l > 0 {
  1450. n += 1 + l + sovLogbroker(uint64(l))
  1451. }
  1452. l = len(m.NodeID)
  1453. if l > 0 {
  1454. n += 1 + l + sovLogbroker(uint64(l))
  1455. }
  1456. l = len(m.TaskID)
  1457. if l > 0 {
  1458. n += 1 + l + sovLogbroker(uint64(l))
  1459. }
  1460. return n
  1461. }
  1462. func (m *LogAttr) Size() (n int) {
  1463. var l int
  1464. _ = l
  1465. l = len(m.Key)
  1466. if l > 0 {
  1467. n += 1 + l + sovLogbroker(uint64(l))
  1468. }
  1469. l = len(m.Value)
  1470. if l > 0 {
  1471. n += 1 + l + sovLogbroker(uint64(l))
  1472. }
  1473. return n
  1474. }
  1475. func (m *LogMessage) Size() (n int) {
  1476. var l int
  1477. _ = l
  1478. l = m.Context.Size()
  1479. n += 1 + l + sovLogbroker(uint64(l))
  1480. if m.Timestamp != nil {
  1481. l = m.Timestamp.Size()
  1482. n += 1 + l + sovLogbroker(uint64(l))
  1483. }
  1484. if m.Stream != 0 {
  1485. n += 1 + sovLogbroker(uint64(m.Stream))
  1486. }
  1487. l = len(m.Data)
  1488. if l > 0 {
  1489. n += 1 + l + sovLogbroker(uint64(l))
  1490. }
  1491. if len(m.Attrs) > 0 {
  1492. for _, e := range m.Attrs {
  1493. l = e.Size()
  1494. n += 1 + l + sovLogbroker(uint64(l))
  1495. }
  1496. }
  1497. return n
  1498. }
  1499. func (m *SubscribeLogsRequest) Size() (n int) {
  1500. var l int
  1501. _ = l
  1502. if m.Selector != nil {
  1503. l = m.Selector.Size()
  1504. n += 1 + l + sovLogbroker(uint64(l))
  1505. }
  1506. if m.Options != nil {
  1507. l = m.Options.Size()
  1508. n += 1 + l + sovLogbroker(uint64(l))
  1509. }
  1510. return n
  1511. }
  1512. func (m *SubscribeLogsMessage) Size() (n int) {
  1513. var l int
  1514. _ = l
  1515. if len(m.Messages) > 0 {
  1516. for _, e := range m.Messages {
  1517. l = e.Size()
  1518. n += 1 + l + sovLogbroker(uint64(l))
  1519. }
  1520. }
  1521. return n
  1522. }
  1523. func (m *ListenSubscriptionsRequest) Size() (n int) {
  1524. var l int
  1525. _ = l
  1526. return n
  1527. }
  1528. func (m *SubscriptionMessage) Size() (n int) {
  1529. var l int
  1530. _ = l
  1531. l = len(m.ID)
  1532. if l > 0 {
  1533. n += 1 + l + sovLogbroker(uint64(l))
  1534. }
  1535. if m.Selector != nil {
  1536. l = m.Selector.Size()
  1537. n += 1 + l + sovLogbroker(uint64(l))
  1538. }
  1539. if m.Options != nil {
  1540. l = m.Options.Size()
  1541. n += 1 + l + sovLogbroker(uint64(l))
  1542. }
  1543. if m.Close {
  1544. n += 2
  1545. }
  1546. return n
  1547. }
  1548. func (m *PublishLogsMessage) Size() (n int) {
  1549. var l int
  1550. _ = l
  1551. l = len(m.SubscriptionID)
  1552. if l > 0 {
  1553. n += 1 + l + sovLogbroker(uint64(l))
  1554. }
  1555. if len(m.Messages) > 0 {
  1556. for _, e := range m.Messages {
  1557. l = e.Size()
  1558. n += 1 + l + sovLogbroker(uint64(l))
  1559. }
  1560. }
  1561. if m.Close {
  1562. n += 2
  1563. }
  1564. return n
  1565. }
  1566. func (m *PublishLogsResponse) Size() (n int) {
  1567. var l int
  1568. _ = l
  1569. return n
  1570. }
  1571. func sovLogbroker(x uint64) (n int) {
  1572. for {
  1573. n++
  1574. x >>= 7
  1575. if x == 0 {
  1576. break
  1577. }
  1578. }
  1579. return n
  1580. }
  1581. func sozLogbroker(x uint64) (n int) {
  1582. return sovLogbroker(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  1583. }
  1584. func (this *LogSubscriptionOptions) String() string {
  1585. if this == nil {
  1586. return "nil"
  1587. }
  1588. s := strings.Join([]string{`&LogSubscriptionOptions{`,
  1589. `Streams:` + fmt.Sprintf("%v", this.Streams) + `,`,
  1590. `Follow:` + fmt.Sprintf("%v", this.Follow) + `,`,
  1591. `Tail:` + fmt.Sprintf("%v", this.Tail) + `,`,
  1592. `Since:` + strings.Replace(fmt.Sprintf("%v", this.Since), "Timestamp", "google_protobuf.Timestamp", 1) + `,`,
  1593. `}`,
  1594. }, "")
  1595. return s
  1596. }
  1597. func (this *LogSelector) String() string {
  1598. if this == nil {
  1599. return "nil"
  1600. }
  1601. s := strings.Join([]string{`&LogSelector{`,
  1602. `ServiceIDs:` + fmt.Sprintf("%v", this.ServiceIDs) + `,`,
  1603. `NodeIDs:` + fmt.Sprintf("%v", this.NodeIDs) + `,`,
  1604. `TaskIDs:` + fmt.Sprintf("%v", this.TaskIDs) + `,`,
  1605. `}`,
  1606. }, "")
  1607. return s
  1608. }
  1609. func (this *LogContext) String() string {
  1610. if this == nil {
  1611. return "nil"
  1612. }
  1613. s := strings.Join([]string{`&LogContext{`,
  1614. `ServiceID:` + fmt.Sprintf("%v", this.ServiceID) + `,`,
  1615. `NodeID:` + fmt.Sprintf("%v", this.NodeID) + `,`,
  1616. `TaskID:` + fmt.Sprintf("%v", this.TaskID) + `,`,
  1617. `}`,
  1618. }, "")
  1619. return s
  1620. }
  1621. func (this *LogAttr) String() string {
  1622. if this == nil {
  1623. return "nil"
  1624. }
  1625. s := strings.Join([]string{`&LogAttr{`,
  1626. `Key:` + fmt.Sprintf("%v", this.Key) + `,`,
  1627. `Value:` + fmt.Sprintf("%v", this.Value) + `,`,
  1628. `}`,
  1629. }, "")
  1630. return s
  1631. }
  1632. func (this *LogMessage) String() string {
  1633. if this == nil {
  1634. return "nil"
  1635. }
  1636. s := strings.Join([]string{`&LogMessage{`,
  1637. `Context:` + strings.Replace(strings.Replace(this.Context.String(), "LogContext", "LogContext", 1), `&`, ``, 1) + `,`,
  1638. `Timestamp:` + strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Timestamp", "google_protobuf.Timestamp", 1) + `,`,
  1639. `Stream:` + fmt.Sprintf("%v", this.Stream) + `,`,
  1640. `Data:` + fmt.Sprintf("%v", this.Data) + `,`,
  1641. `Attrs:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Attrs), "LogAttr", "LogAttr", 1), `&`, ``, 1) + `,`,
  1642. `}`,
  1643. }, "")
  1644. return s
  1645. }
  1646. func (this *SubscribeLogsRequest) String() string {
  1647. if this == nil {
  1648. return "nil"
  1649. }
  1650. s := strings.Join([]string{`&SubscribeLogsRequest{`,
  1651. `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LogSelector", "LogSelector", 1) + `,`,
  1652. `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "LogSubscriptionOptions", "LogSubscriptionOptions", 1) + `,`,
  1653. `}`,
  1654. }, "")
  1655. return s
  1656. }
  1657. func (this *SubscribeLogsMessage) String() string {
  1658. if this == nil {
  1659. return "nil"
  1660. }
  1661. s := strings.Join([]string{`&SubscribeLogsMessage{`,
  1662. `Messages:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Messages), "LogMessage", "LogMessage", 1), `&`, ``, 1) + `,`,
  1663. `}`,
  1664. }, "")
  1665. return s
  1666. }
  1667. func (this *ListenSubscriptionsRequest) String() string {
  1668. if this == nil {
  1669. return "nil"
  1670. }
  1671. s := strings.Join([]string{`&ListenSubscriptionsRequest{`,
  1672. `}`,
  1673. }, "")
  1674. return s
  1675. }
  1676. func (this *SubscriptionMessage) String() string {
  1677. if this == nil {
  1678. return "nil"
  1679. }
  1680. s := strings.Join([]string{`&SubscriptionMessage{`,
  1681. `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
  1682. `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LogSelector", "LogSelector", 1) + `,`,
  1683. `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "LogSubscriptionOptions", "LogSubscriptionOptions", 1) + `,`,
  1684. `Close:` + fmt.Sprintf("%v", this.Close) + `,`,
  1685. `}`,
  1686. }, "")
  1687. return s
  1688. }
  1689. func (this *PublishLogsMessage) String() string {
  1690. if this == nil {
  1691. return "nil"
  1692. }
  1693. s := strings.Join([]string{`&PublishLogsMessage{`,
  1694. `SubscriptionID:` + fmt.Sprintf("%v", this.SubscriptionID) + `,`,
  1695. `Messages:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Messages), "LogMessage", "LogMessage", 1), `&`, ``, 1) + `,`,
  1696. `Close:` + fmt.Sprintf("%v", this.Close) + `,`,
  1697. `}`,
  1698. }, "")
  1699. return s
  1700. }
  1701. func (this *PublishLogsResponse) String() string {
  1702. if this == nil {
  1703. return "nil"
  1704. }
  1705. s := strings.Join([]string{`&PublishLogsResponse{`,
  1706. `}`,
  1707. }, "")
  1708. return s
  1709. }
  1710. func valueToStringLogbroker(v interface{}) string {
  1711. rv := reflect.ValueOf(v)
  1712. if rv.IsNil() {
  1713. return "nil"
  1714. }
  1715. pv := reflect.Indirect(rv).Interface()
  1716. return fmt.Sprintf("*%v", pv)
  1717. }
  1718. func (m *LogSubscriptionOptions) Unmarshal(dAtA []byte) error {
  1719. l := len(dAtA)
  1720. iNdEx := 0
  1721. for iNdEx < l {
  1722. preIndex := iNdEx
  1723. var wire uint64
  1724. for shift := uint(0); ; shift += 7 {
  1725. if shift >= 64 {
  1726. return ErrIntOverflowLogbroker
  1727. }
  1728. if iNdEx >= l {
  1729. return io.ErrUnexpectedEOF
  1730. }
  1731. b := dAtA[iNdEx]
  1732. iNdEx++
  1733. wire |= (uint64(b) & 0x7F) << shift
  1734. if b < 0x80 {
  1735. break
  1736. }
  1737. }
  1738. fieldNum := int32(wire >> 3)
  1739. wireType := int(wire & 0x7)
  1740. if wireType == 4 {
  1741. return fmt.Errorf("proto: LogSubscriptionOptions: wiretype end group for non-group")
  1742. }
  1743. if fieldNum <= 0 {
  1744. return fmt.Errorf("proto: LogSubscriptionOptions: illegal tag %d (wire type %d)", fieldNum, wire)
  1745. }
  1746. switch fieldNum {
  1747. case 1:
  1748. if wireType == 2 {
  1749. var packedLen int
  1750. for shift := uint(0); ; shift += 7 {
  1751. if shift >= 64 {
  1752. return ErrIntOverflowLogbroker
  1753. }
  1754. if iNdEx >= l {
  1755. return io.ErrUnexpectedEOF
  1756. }
  1757. b := dAtA[iNdEx]
  1758. iNdEx++
  1759. packedLen |= (int(b) & 0x7F) << shift
  1760. if b < 0x80 {
  1761. break
  1762. }
  1763. }
  1764. if packedLen < 0 {
  1765. return ErrInvalidLengthLogbroker
  1766. }
  1767. postIndex := iNdEx + packedLen
  1768. if postIndex > l {
  1769. return io.ErrUnexpectedEOF
  1770. }
  1771. for iNdEx < postIndex {
  1772. var v LogStream
  1773. for shift := uint(0); ; shift += 7 {
  1774. if shift >= 64 {
  1775. return ErrIntOverflowLogbroker
  1776. }
  1777. if iNdEx >= l {
  1778. return io.ErrUnexpectedEOF
  1779. }
  1780. b := dAtA[iNdEx]
  1781. iNdEx++
  1782. v |= (LogStream(b) & 0x7F) << shift
  1783. if b < 0x80 {
  1784. break
  1785. }
  1786. }
  1787. m.Streams = append(m.Streams, v)
  1788. }
  1789. } else if wireType == 0 {
  1790. var v LogStream
  1791. for shift := uint(0); ; shift += 7 {
  1792. if shift >= 64 {
  1793. return ErrIntOverflowLogbroker
  1794. }
  1795. if iNdEx >= l {
  1796. return io.ErrUnexpectedEOF
  1797. }
  1798. b := dAtA[iNdEx]
  1799. iNdEx++
  1800. v |= (LogStream(b) & 0x7F) << shift
  1801. if b < 0x80 {
  1802. break
  1803. }
  1804. }
  1805. m.Streams = append(m.Streams, v)
  1806. } else {
  1807. return fmt.Errorf("proto: wrong wireType = %d for field Streams", wireType)
  1808. }
  1809. case 2:
  1810. if wireType != 0 {
  1811. return fmt.Errorf("proto: wrong wireType = %d for field Follow", wireType)
  1812. }
  1813. var v int
  1814. for shift := uint(0); ; shift += 7 {
  1815. if shift >= 64 {
  1816. return ErrIntOverflowLogbroker
  1817. }
  1818. if iNdEx >= l {
  1819. return io.ErrUnexpectedEOF
  1820. }
  1821. b := dAtA[iNdEx]
  1822. iNdEx++
  1823. v |= (int(b) & 0x7F) << shift
  1824. if b < 0x80 {
  1825. break
  1826. }
  1827. }
  1828. m.Follow = bool(v != 0)
  1829. case 3:
  1830. if wireType != 0 {
  1831. return fmt.Errorf("proto: wrong wireType = %d for field Tail", wireType)
  1832. }
  1833. m.Tail = 0
  1834. for shift := uint(0); ; shift += 7 {
  1835. if shift >= 64 {
  1836. return ErrIntOverflowLogbroker
  1837. }
  1838. if iNdEx >= l {
  1839. return io.ErrUnexpectedEOF
  1840. }
  1841. b := dAtA[iNdEx]
  1842. iNdEx++
  1843. m.Tail |= (int64(b) & 0x7F) << shift
  1844. if b < 0x80 {
  1845. break
  1846. }
  1847. }
  1848. case 4:
  1849. if wireType != 2 {
  1850. return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType)
  1851. }
  1852. var msglen int
  1853. for shift := uint(0); ; shift += 7 {
  1854. if shift >= 64 {
  1855. return ErrIntOverflowLogbroker
  1856. }
  1857. if iNdEx >= l {
  1858. return io.ErrUnexpectedEOF
  1859. }
  1860. b := dAtA[iNdEx]
  1861. iNdEx++
  1862. msglen |= (int(b) & 0x7F) << shift
  1863. if b < 0x80 {
  1864. break
  1865. }
  1866. }
  1867. if msglen < 0 {
  1868. return ErrInvalidLengthLogbroker
  1869. }
  1870. postIndex := iNdEx + msglen
  1871. if postIndex > l {
  1872. return io.ErrUnexpectedEOF
  1873. }
  1874. if m.Since == nil {
  1875. m.Since = &google_protobuf.Timestamp{}
  1876. }
  1877. if err := m.Since.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  1878. return err
  1879. }
  1880. iNdEx = postIndex
  1881. default:
  1882. iNdEx = preIndex
  1883. skippy, err := skipLogbroker(dAtA[iNdEx:])
  1884. if err != nil {
  1885. return err
  1886. }
  1887. if skippy < 0 {
  1888. return ErrInvalidLengthLogbroker
  1889. }
  1890. if (iNdEx + skippy) > l {
  1891. return io.ErrUnexpectedEOF
  1892. }
  1893. iNdEx += skippy
  1894. }
  1895. }
  1896. if iNdEx > l {
  1897. return io.ErrUnexpectedEOF
  1898. }
  1899. return nil
  1900. }
  1901. func (m *LogSelector) Unmarshal(dAtA []byte) error {
  1902. l := len(dAtA)
  1903. iNdEx := 0
  1904. for iNdEx < l {
  1905. preIndex := iNdEx
  1906. var wire uint64
  1907. for shift := uint(0); ; shift += 7 {
  1908. if shift >= 64 {
  1909. return ErrIntOverflowLogbroker
  1910. }
  1911. if iNdEx >= l {
  1912. return io.ErrUnexpectedEOF
  1913. }
  1914. b := dAtA[iNdEx]
  1915. iNdEx++
  1916. wire |= (uint64(b) & 0x7F) << shift
  1917. if b < 0x80 {
  1918. break
  1919. }
  1920. }
  1921. fieldNum := int32(wire >> 3)
  1922. wireType := int(wire & 0x7)
  1923. if wireType == 4 {
  1924. return fmt.Errorf("proto: LogSelector: wiretype end group for non-group")
  1925. }
  1926. if fieldNum <= 0 {
  1927. return fmt.Errorf("proto: LogSelector: illegal tag %d (wire type %d)", fieldNum, wire)
  1928. }
  1929. switch fieldNum {
  1930. case 1:
  1931. if wireType != 2 {
  1932. return fmt.Errorf("proto: wrong wireType = %d for field ServiceIDs", wireType)
  1933. }
  1934. var stringLen uint64
  1935. for shift := uint(0); ; shift += 7 {
  1936. if shift >= 64 {
  1937. return ErrIntOverflowLogbroker
  1938. }
  1939. if iNdEx >= l {
  1940. return io.ErrUnexpectedEOF
  1941. }
  1942. b := dAtA[iNdEx]
  1943. iNdEx++
  1944. stringLen |= (uint64(b) & 0x7F) << shift
  1945. if b < 0x80 {
  1946. break
  1947. }
  1948. }
  1949. intStringLen := int(stringLen)
  1950. if intStringLen < 0 {
  1951. return ErrInvalidLengthLogbroker
  1952. }
  1953. postIndex := iNdEx + intStringLen
  1954. if postIndex > l {
  1955. return io.ErrUnexpectedEOF
  1956. }
  1957. m.ServiceIDs = append(m.ServiceIDs, string(dAtA[iNdEx:postIndex]))
  1958. iNdEx = postIndex
  1959. case 2:
  1960. if wireType != 2 {
  1961. return fmt.Errorf("proto: wrong wireType = %d for field NodeIDs", wireType)
  1962. }
  1963. var stringLen uint64
  1964. for shift := uint(0); ; shift += 7 {
  1965. if shift >= 64 {
  1966. return ErrIntOverflowLogbroker
  1967. }
  1968. if iNdEx >= l {
  1969. return io.ErrUnexpectedEOF
  1970. }
  1971. b := dAtA[iNdEx]
  1972. iNdEx++
  1973. stringLen |= (uint64(b) & 0x7F) << shift
  1974. if b < 0x80 {
  1975. break
  1976. }
  1977. }
  1978. intStringLen := int(stringLen)
  1979. if intStringLen < 0 {
  1980. return ErrInvalidLengthLogbroker
  1981. }
  1982. postIndex := iNdEx + intStringLen
  1983. if postIndex > l {
  1984. return io.ErrUnexpectedEOF
  1985. }
  1986. m.NodeIDs = append(m.NodeIDs, string(dAtA[iNdEx:postIndex]))
  1987. iNdEx = postIndex
  1988. case 3:
  1989. if wireType != 2 {
  1990. return fmt.Errorf("proto: wrong wireType = %d for field TaskIDs", wireType)
  1991. }
  1992. var stringLen uint64
  1993. for shift := uint(0); ; shift += 7 {
  1994. if shift >= 64 {
  1995. return ErrIntOverflowLogbroker
  1996. }
  1997. if iNdEx >= l {
  1998. return io.ErrUnexpectedEOF
  1999. }
  2000. b := dAtA[iNdEx]
  2001. iNdEx++
  2002. stringLen |= (uint64(b) & 0x7F) << shift
  2003. if b < 0x80 {
  2004. break
  2005. }
  2006. }
  2007. intStringLen := int(stringLen)
  2008. if intStringLen < 0 {
  2009. return ErrInvalidLengthLogbroker
  2010. }
  2011. postIndex := iNdEx + intStringLen
  2012. if postIndex > l {
  2013. return io.ErrUnexpectedEOF
  2014. }
  2015. m.TaskIDs = append(m.TaskIDs, string(dAtA[iNdEx:postIndex]))
  2016. iNdEx = postIndex
  2017. default:
  2018. iNdEx = preIndex
  2019. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2020. if err != nil {
  2021. return err
  2022. }
  2023. if skippy < 0 {
  2024. return ErrInvalidLengthLogbroker
  2025. }
  2026. if (iNdEx + skippy) > l {
  2027. return io.ErrUnexpectedEOF
  2028. }
  2029. iNdEx += skippy
  2030. }
  2031. }
  2032. if iNdEx > l {
  2033. return io.ErrUnexpectedEOF
  2034. }
  2035. return nil
  2036. }
  2037. func (m *LogContext) Unmarshal(dAtA []byte) error {
  2038. l := len(dAtA)
  2039. iNdEx := 0
  2040. for iNdEx < l {
  2041. preIndex := iNdEx
  2042. var wire uint64
  2043. for shift := uint(0); ; shift += 7 {
  2044. if shift >= 64 {
  2045. return ErrIntOverflowLogbroker
  2046. }
  2047. if iNdEx >= l {
  2048. return io.ErrUnexpectedEOF
  2049. }
  2050. b := dAtA[iNdEx]
  2051. iNdEx++
  2052. wire |= (uint64(b) & 0x7F) << shift
  2053. if b < 0x80 {
  2054. break
  2055. }
  2056. }
  2057. fieldNum := int32(wire >> 3)
  2058. wireType := int(wire & 0x7)
  2059. if wireType == 4 {
  2060. return fmt.Errorf("proto: LogContext: wiretype end group for non-group")
  2061. }
  2062. if fieldNum <= 0 {
  2063. return fmt.Errorf("proto: LogContext: illegal tag %d (wire type %d)", fieldNum, wire)
  2064. }
  2065. switch fieldNum {
  2066. case 1:
  2067. if wireType != 2 {
  2068. return fmt.Errorf("proto: wrong wireType = %d for field ServiceID", wireType)
  2069. }
  2070. var stringLen uint64
  2071. for shift := uint(0); ; shift += 7 {
  2072. if shift >= 64 {
  2073. return ErrIntOverflowLogbroker
  2074. }
  2075. if iNdEx >= l {
  2076. return io.ErrUnexpectedEOF
  2077. }
  2078. b := dAtA[iNdEx]
  2079. iNdEx++
  2080. stringLen |= (uint64(b) & 0x7F) << shift
  2081. if b < 0x80 {
  2082. break
  2083. }
  2084. }
  2085. intStringLen := int(stringLen)
  2086. if intStringLen < 0 {
  2087. return ErrInvalidLengthLogbroker
  2088. }
  2089. postIndex := iNdEx + intStringLen
  2090. if postIndex > l {
  2091. return io.ErrUnexpectedEOF
  2092. }
  2093. m.ServiceID = string(dAtA[iNdEx:postIndex])
  2094. iNdEx = postIndex
  2095. case 2:
  2096. if wireType != 2 {
  2097. return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType)
  2098. }
  2099. var stringLen uint64
  2100. for shift := uint(0); ; shift += 7 {
  2101. if shift >= 64 {
  2102. return ErrIntOverflowLogbroker
  2103. }
  2104. if iNdEx >= l {
  2105. return io.ErrUnexpectedEOF
  2106. }
  2107. b := dAtA[iNdEx]
  2108. iNdEx++
  2109. stringLen |= (uint64(b) & 0x7F) << shift
  2110. if b < 0x80 {
  2111. break
  2112. }
  2113. }
  2114. intStringLen := int(stringLen)
  2115. if intStringLen < 0 {
  2116. return ErrInvalidLengthLogbroker
  2117. }
  2118. postIndex := iNdEx + intStringLen
  2119. if postIndex > l {
  2120. return io.ErrUnexpectedEOF
  2121. }
  2122. m.NodeID = string(dAtA[iNdEx:postIndex])
  2123. iNdEx = postIndex
  2124. case 3:
  2125. if wireType != 2 {
  2126. return fmt.Errorf("proto: wrong wireType = %d for field TaskID", wireType)
  2127. }
  2128. var stringLen uint64
  2129. for shift := uint(0); ; shift += 7 {
  2130. if shift >= 64 {
  2131. return ErrIntOverflowLogbroker
  2132. }
  2133. if iNdEx >= l {
  2134. return io.ErrUnexpectedEOF
  2135. }
  2136. b := dAtA[iNdEx]
  2137. iNdEx++
  2138. stringLen |= (uint64(b) & 0x7F) << shift
  2139. if b < 0x80 {
  2140. break
  2141. }
  2142. }
  2143. intStringLen := int(stringLen)
  2144. if intStringLen < 0 {
  2145. return ErrInvalidLengthLogbroker
  2146. }
  2147. postIndex := iNdEx + intStringLen
  2148. if postIndex > l {
  2149. return io.ErrUnexpectedEOF
  2150. }
  2151. m.TaskID = string(dAtA[iNdEx:postIndex])
  2152. iNdEx = postIndex
  2153. default:
  2154. iNdEx = preIndex
  2155. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2156. if err != nil {
  2157. return err
  2158. }
  2159. if skippy < 0 {
  2160. return ErrInvalidLengthLogbroker
  2161. }
  2162. if (iNdEx + skippy) > l {
  2163. return io.ErrUnexpectedEOF
  2164. }
  2165. iNdEx += skippy
  2166. }
  2167. }
  2168. if iNdEx > l {
  2169. return io.ErrUnexpectedEOF
  2170. }
  2171. return nil
  2172. }
  2173. func (m *LogAttr) Unmarshal(dAtA []byte) error {
  2174. l := len(dAtA)
  2175. iNdEx := 0
  2176. for iNdEx < l {
  2177. preIndex := iNdEx
  2178. var wire uint64
  2179. for shift := uint(0); ; shift += 7 {
  2180. if shift >= 64 {
  2181. return ErrIntOverflowLogbroker
  2182. }
  2183. if iNdEx >= l {
  2184. return io.ErrUnexpectedEOF
  2185. }
  2186. b := dAtA[iNdEx]
  2187. iNdEx++
  2188. wire |= (uint64(b) & 0x7F) << shift
  2189. if b < 0x80 {
  2190. break
  2191. }
  2192. }
  2193. fieldNum := int32(wire >> 3)
  2194. wireType := int(wire & 0x7)
  2195. if wireType == 4 {
  2196. return fmt.Errorf("proto: LogAttr: wiretype end group for non-group")
  2197. }
  2198. if fieldNum <= 0 {
  2199. return fmt.Errorf("proto: LogAttr: illegal tag %d (wire type %d)", fieldNum, wire)
  2200. }
  2201. switch fieldNum {
  2202. case 1:
  2203. if wireType != 2 {
  2204. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  2205. }
  2206. var stringLen uint64
  2207. for shift := uint(0); ; shift += 7 {
  2208. if shift >= 64 {
  2209. return ErrIntOverflowLogbroker
  2210. }
  2211. if iNdEx >= l {
  2212. return io.ErrUnexpectedEOF
  2213. }
  2214. b := dAtA[iNdEx]
  2215. iNdEx++
  2216. stringLen |= (uint64(b) & 0x7F) << shift
  2217. if b < 0x80 {
  2218. break
  2219. }
  2220. }
  2221. intStringLen := int(stringLen)
  2222. if intStringLen < 0 {
  2223. return ErrInvalidLengthLogbroker
  2224. }
  2225. postIndex := iNdEx + intStringLen
  2226. if postIndex > l {
  2227. return io.ErrUnexpectedEOF
  2228. }
  2229. m.Key = string(dAtA[iNdEx:postIndex])
  2230. iNdEx = postIndex
  2231. case 2:
  2232. if wireType != 2 {
  2233. return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
  2234. }
  2235. var stringLen uint64
  2236. for shift := uint(0); ; shift += 7 {
  2237. if shift >= 64 {
  2238. return ErrIntOverflowLogbroker
  2239. }
  2240. if iNdEx >= l {
  2241. return io.ErrUnexpectedEOF
  2242. }
  2243. b := dAtA[iNdEx]
  2244. iNdEx++
  2245. stringLen |= (uint64(b) & 0x7F) << shift
  2246. if b < 0x80 {
  2247. break
  2248. }
  2249. }
  2250. intStringLen := int(stringLen)
  2251. if intStringLen < 0 {
  2252. return ErrInvalidLengthLogbroker
  2253. }
  2254. postIndex := iNdEx + intStringLen
  2255. if postIndex > l {
  2256. return io.ErrUnexpectedEOF
  2257. }
  2258. m.Value = string(dAtA[iNdEx:postIndex])
  2259. iNdEx = postIndex
  2260. default:
  2261. iNdEx = preIndex
  2262. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2263. if err != nil {
  2264. return err
  2265. }
  2266. if skippy < 0 {
  2267. return ErrInvalidLengthLogbroker
  2268. }
  2269. if (iNdEx + skippy) > l {
  2270. return io.ErrUnexpectedEOF
  2271. }
  2272. iNdEx += skippy
  2273. }
  2274. }
  2275. if iNdEx > l {
  2276. return io.ErrUnexpectedEOF
  2277. }
  2278. return nil
  2279. }
  2280. func (m *LogMessage) Unmarshal(dAtA []byte) error {
  2281. l := len(dAtA)
  2282. iNdEx := 0
  2283. for iNdEx < l {
  2284. preIndex := iNdEx
  2285. var wire uint64
  2286. for shift := uint(0); ; shift += 7 {
  2287. if shift >= 64 {
  2288. return ErrIntOverflowLogbroker
  2289. }
  2290. if iNdEx >= l {
  2291. return io.ErrUnexpectedEOF
  2292. }
  2293. b := dAtA[iNdEx]
  2294. iNdEx++
  2295. wire |= (uint64(b) & 0x7F) << shift
  2296. if b < 0x80 {
  2297. break
  2298. }
  2299. }
  2300. fieldNum := int32(wire >> 3)
  2301. wireType := int(wire & 0x7)
  2302. if wireType == 4 {
  2303. return fmt.Errorf("proto: LogMessage: wiretype end group for non-group")
  2304. }
  2305. if fieldNum <= 0 {
  2306. return fmt.Errorf("proto: LogMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2307. }
  2308. switch fieldNum {
  2309. case 1:
  2310. if wireType != 2 {
  2311. return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType)
  2312. }
  2313. var msglen int
  2314. for shift := uint(0); ; shift += 7 {
  2315. if shift >= 64 {
  2316. return ErrIntOverflowLogbroker
  2317. }
  2318. if iNdEx >= l {
  2319. return io.ErrUnexpectedEOF
  2320. }
  2321. b := dAtA[iNdEx]
  2322. iNdEx++
  2323. msglen |= (int(b) & 0x7F) << shift
  2324. if b < 0x80 {
  2325. break
  2326. }
  2327. }
  2328. if msglen < 0 {
  2329. return ErrInvalidLengthLogbroker
  2330. }
  2331. postIndex := iNdEx + msglen
  2332. if postIndex > l {
  2333. return io.ErrUnexpectedEOF
  2334. }
  2335. if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2336. return err
  2337. }
  2338. iNdEx = postIndex
  2339. case 2:
  2340. if wireType != 2 {
  2341. return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
  2342. }
  2343. var msglen int
  2344. for shift := uint(0); ; shift += 7 {
  2345. if shift >= 64 {
  2346. return ErrIntOverflowLogbroker
  2347. }
  2348. if iNdEx >= l {
  2349. return io.ErrUnexpectedEOF
  2350. }
  2351. b := dAtA[iNdEx]
  2352. iNdEx++
  2353. msglen |= (int(b) & 0x7F) << shift
  2354. if b < 0x80 {
  2355. break
  2356. }
  2357. }
  2358. if msglen < 0 {
  2359. return ErrInvalidLengthLogbroker
  2360. }
  2361. postIndex := iNdEx + msglen
  2362. if postIndex > l {
  2363. return io.ErrUnexpectedEOF
  2364. }
  2365. if m.Timestamp == nil {
  2366. m.Timestamp = &google_protobuf.Timestamp{}
  2367. }
  2368. if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2369. return err
  2370. }
  2371. iNdEx = postIndex
  2372. case 3:
  2373. if wireType != 0 {
  2374. return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType)
  2375. }
  2376. m.Stream = 0
  2377. for shift := uint(0); ; shift += 7 {
  2378. if shift >= 64 {
  2379. return ErrIntOverflowLogbroker
  2380. }
  2381. if iNdEx >= l {
  2382. return io.ErrUnexpectedEOF
  2383. }
  2384. b := dAtA[iNdEx]
  2385. iNdEx++
  2386. m.Stream |= (LogStream(b) & 0x7F) << shift
  2387. if b < 0x80 {
  2388. break
  2389. }
  2390. }
  2391. case 4:
  2392. if wireType != 2 {
  2393. return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
  2394. }
  2395. var byteLen int
  2396. for shift := uint(0); ; shift += 7 {
  2397. if shift >= 64 {
  2398. return ErrIntOverflowLogbroker
  2399. }
  2400. if iNdEx >= l {
  2401. return io.ErrUnexpectedEOF
  2402. }
  2403. b := dAtA[iNdEx]
  2404. iNdEx++
  2405. byteLen |= (int(b) & 0x7F) << shift
  2406. if b < 0x80 {
  2407. break
  2408. }
  2409. }
  2410. if byteLen < 0 {
  2411. return ErrInvalidLengthLogbroker
  2412. }
  2413. postIndex := iNdEx + byteLen
  2414. if postIndex > l {
  2415. return io.ErrUnexpectedEOF
  2416. }
  2417. m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
  2418. if m.Data == nil {
  2419. m.Data = []byte{}
  2420. }
  2421. iNdEx = postIndex
  2422. case 5:
  2423. if wireType != 2 {
  2424. return fmt.Errorf("proto: wrong wireType = %d for field Attrs", wireType)
  2425. }
  2426. var msglen int
  2427. for shift := uint(0); ; shift += 7 {
  2428. if shift >= 64 {
  2429. return ErrIntOverflowLogbroker
  2430. }
  2431. if iNdEx >= l {
  2432. return io.ErrUnexpectedEOF
  2433. }
  2434. b := dAtA[iNdEx]
  2435. iNdEx++
  2436. msglen |= (int(b) & 0x7F) << shift
  2437. if b < 0x80 {
  2438. break
  2439. }
  2440. }
  2441. if msglen < 0 {
  2442. return ErrInvalidLengthLogbroker
  2443. }
  2444. postIndex := iNdEx + msglen
  2445. if postIndex > l {
  2446. return io.ErrUnexpectedEOF
  2447. }
  2448. m.Attrs = append(m.Attrs, LogAttr{})
  2449. if err := m.Attrs[len(m.Attrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2450. return err
  2451. }
  2452. iNdEx = postIndex
  2453. default:
  2454. iNdEx = preIndex
  2455. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2456. if err != nil {
  2457. return err
  2458. }
  2459. if skippy < 0 {
  2460. return ErrInvalidLengthLogbroker
  2461. }
  2462. if (iNdEx + skippy) > l {
  2463. return io.ErrUnexpectedEOF
  2464. }
  2465. iNdEx += skippy
  2466. }
  2467. }
  2468. if iNdEx > l {
  2469. return io.ErrUnexpectedEOF
  2470. }
  2471. return nil
  2472. }
  2473. func (m *SubscribeLogsRequest) Unmarshal(dAtA []byte) error {
  2474. l := len(dAtA)
  2475. iNdEx := 0
  2476. for iNdEx < l {
  2477. preIndex := iNdEx
  2478. var wire uint64
  2479. for shift := uint(0); ; shift += 7 {
  2480. if shift >= 64 {
  2481. return ErrIntOverflowLogbroker
  2482. }
  2483. if iNdEx >= l {
  2484. return io.ErrUnexpectedEOF
  2485. }
  2486. b := dAtA[iNdEx]
  2487. iNdEx++
  2488. wire |= (uint64(b) & 0x7F) << shift
  2489. if b < 0x80 {
  2490. break
  2491. }
  2492. }
  2493. fieldNum := int32(wire >> 3)
  2494. wireType := int(wire & 0x7)
  2495. if wireType == 4 {
  2496. return fmt.Errorf("proto: SubscribeLogsRequest: wiretype end group for non-group")
  2497. }
  2498. if fieldNum <= 0 {
  2499. return fmt.Errorf("proto: SubscribeLogsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
  2500. }
  2501. switch fieldNum {
  2502. case 1:
  2503. if wireType != 2 {
  2504. return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType)
  2505. }
  2506. var msglen int
  2507. for shift := uint(0); ; shift += 7 {
  2508. if shift >= 64 {
  2509. return ErrIntOverflowLogbroker
  2510. }
  2511. if iNdEx >= l {
  2512. return io.ErrUnexpectedEOF
  2513. }
  2514. b := dAtA[iNdEx]
  2515. iNdEx++
  2516. msglen |= (int(b) & 0x7F) << shift
  2517. if b < 0x80 {
  2518. break
  2519. }
  2520. }
  2521. if msglen < 0 {
  2522. return ErrInvalidLengthLogbroker
  2523. }
  2524. postIndex := iNdEx + msglen
  2525. if postIndex > l {
  2526. return io.ErrUnexpectedEOF
  2527. }
  2528. if m.Selector == nil {
  2529. m.Selector = &LogSelector{}
  2530. }
  2531. if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2532. return err
  2533. }
  2534. iNdEx = postIndex
  2535. case 2:
  2536. if wireType != 2 {
  2537. return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType)
  2538. }
  2539. var msglen int
  2540. for shift := uint(0); ; shift += 7 {
  2541. if shift >= 64 {
  2542. return ErrIntOverflowLogbroker
  2543. }
  2544. if iNdEx >= l {
  2545. return io.ErrUnexpectedEOF
  2546. }
  2547. b := dAtA[iNdEx]
  2548. iNdEx++
  2549. msglen |= (int(b) & 0x7F) << shift
  2550. if b < 0x80 {
  2551. break
  2552. }
  2553. }
  2554. if msglen < 0 {
  2555. return ErrInvalidLengthLogbroker
  2556. }
  2557. postIndex := iNdEx + msglen
  2558. if postIndex > l {
  2559. return io.ErrUnexpectedEOF
  2560. }
  2561. if m.Options == nil {
  2562. m.Options = &LogSubscriptionOptions{}
  2563. }
  2564. if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2565. return err
  2566. }
  2567. iNdEx = postIndex
  2568. default:
  2569. iNdEx = preIndex
  2570. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2571. if err != nil {
  2572. return err
  2573. }
  2574. if skippy < 0 {
  2575. return ErrInvalidLengthLogbroker
  2576. }
  2577. if (iNdEx + skippy) > l {
  2578. return io.ErrUnexpectedEOF
  2579. }
  2580. iNdEx += skippy
  2581. }
  2582. }
  2583. if iNdEx > l {
  2584. return io.ErrUnexpectedEOF
  2585. }
  2586. return nil
  2587. }
  2588. func (m *SubscribeLogsMessage) Unmarshal(dAtA []byte) error {
  2589. l := len(dAtA)
  2590. iNdEx := 0
  2591. for iNdEx < l {
  2592. preIndex := iNdEx
  2593. var wire uint64
  2594. for shift := uint(0); ; shift += 7 {
  2595. if shift >= 64 {
  2596. return ErrIntOverflowLogbroker
  2597. }
  2598. if iNdEx >= l {
  2599. return io.ErrUnexpectedEOF
  2600. }
  2601. b := dAtA[iNdEx]
  2602. iNdEx++
  2603. wire |= (uint64(b) & 0x7F) << shift
  2604. if b < 0x80 {
  2605. break
  2606. }
  2607. }
  2608. fieldNum := int32(wire >> 3)
  2609. wireType := int(wire & 0x7)
  2610. if wireType == 4 {
  2611. return fmt.Errorf("proto: SubscribeLogsMessage: wiretype end group for non-group")
  2612. }
  2613. if fieldNum <= 0 {
  2614. return fmt.Errorf("proto: SubscribeLogsMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2615. }
  2616. switch fieldNum {
  2617. case 1:
  2618. if wireType != 2 {
  2619. return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType)
  2620. }
  2621. var msglen int
  2622. for shift := uint(0); ; shift += 7 {
  2623. if shift >= 64 {
  2624. return ErrIntOverflowLogbroker
  2625. }
  2626. if iNdEx >= l {
  2627. return io.ErrUnexpectedEOF
  2628. }
  2629. b := dAtA[iNdEx]
  2630. iNdEx++
  2631. msglen |= (int(b) & 0x7F) << shift
  2632. if b < 0x80 {
  2633. break
  2634. }
  2635. }
  2636. if msglen < 0 {
  2637. return ErrInvalidLengthLogbroker
  2638. }
  2639. postIndex := iNdEx + msglen
  2640. if postIndex > l {
  2641. return io.ErrUnexpectedEOF
  2642. }
  2643. m.Messages = append(m.Messages, LogMessage{})
  2644. if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2645. return err
  2646. }
  2647. iNdEx = postIndex
  2648. default:
  2649. iNdEx = preIndex
  2650. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2651. if err != nil {
  2652. return err
  2653. }
  2654. if skippy < 0 {
  2655. return ErrInvalidLengthLogbroker
  2656. }
  2657. if (iNdEx + skippy) > l {
  2658. return io.ErrUnexpectedEOF
  2659. }
  2660. iNdEx += skippy
  2661. }
  2662. }
  2663. if iNdEx > l {
  2664. return io.ErrUnexpectedEOF
  2665. }
  2666. return nil
  2667. }
  2668. func (m *ListenSubscriptionsRequest) Unmarshal(dAtA []byte) error {
  2669. l := len(dAtA)
  2670. iNdEx := 0
  2671. for iNdEx < l {
  2672. preIndex := iNdEx
  2673. var wire uint64
  2674. for shift := uint(0); ; shift += 7 {
  2675. if shift >= 64 {
  2676. return ErrIntOverflowLogbroker
  2677. }
  2678. if iNdEx >= l {
  2679. return io.ErrUnexpectedEOF
  2680. }
  2681. b := dAtA[iNdEx]
  2682. iNdEx++
  2683. wire |= (uint64(b) & 0x7F) << shift
  2684. if b < 0x80 {
  2685. break
  2686. }
  2687. }
  2688. fieldNum := int32(wire >> 3)
  2689. wireType := int(wire & 0x7)
  2690. if wireType == 4 {
  2691. return fmt.Errorf("proto: ListenSubscriptionsRequest: wiretype end group for non-group")
  2692. }
  2693. if fieldNum <= 0 {
  2694. return fmt.Errorf("proto: ListenSubscriptionsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
  2695. }
  2696. switch fieldNum {
  2697. default:
  2698. iNdEx = preIndex
  2699. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2700. if err != nil {
  2701. return err
  2702. }
  2703. if skippy < 0 {
  2704. return ErrInvalidLengthLogbroker
  2705. }
  2706. if (iNdEx + skippy) > l {
  2707. return io.ErrUnexpectedEOF
  2708. }
  2709. iNdEx += skippy
  2710. }
  2711. }
  2712. if iNdEx > l {
  2713. return io.ErrUnexpectedEOF
  2714. }
  2715. return nil
  2716. }
  2717. func (m *SubscriptionMessage) Unmarshal(dAtA []byte) error {
  2718. l := len(dAtA)
  2719. iNdEx := 0
  2720. for iNdEx < l {
  2721. preIndex := iNdEx
  2722. var wire uint64
  2723. for shift := uint(0); ; shift += 7 {
  2724. if shift >= 64 {
  2725. return ErrIntOverflowLogbroker
  2726. }
  2727. if iNdEx >= l {
  2728. return io.ErrUnexpectedEOF
  2729. }
  2730. b := dAtA[iNdEx]
  2731. iNdEx++
  2732. wire |= (uint64(b) & 0x7F) << shift
  2733. if b < 0x80 {
  2734. break
  2735. }
  2736. }
  2737. fieldNum := int32(wire >> 3)
  2738. wireType := int(wire & 0x7)
  2739. if wireType == 4 {
  2740. return fmt.Errorf("proto: SubscriptionMessage: wiretype end group for non-group")
  2741. }
  2742. if fieldNum <= 0 {
  2743. return fmt.Errorf("proto: SubscriptionMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2744. }
  2745. switch fieldNum {
  2746. case 1:
  2747. if wireType != 2 {
  2748. return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
  2749. }
  2750. var stringLen uint64
  2751. for shift := uint(0); ; shift += 7 {
  2752. if shift >= 64 {
  2753. return ErrIntOverflowLogbroker
  2754. }
  2755. if iNdEx >= l {
  2756. return io.ErrUnexpectedEOF
  2757. }
  2758. b := dAtA[iNdEx]
  2759. iNdEx++
  2760. stringLen |= (uint64(b) & 0x7F) << shift
  2761. if b < 0x80 {
  2762. break
  2763. }
  2764. }
  2765. intStringLen := int(stringLen)
  2766. if intStringLen < 0 {
  2767. return ErrInvalidLengthLogbroker
  2768. }
  2769. postIndex := iNdEx + intStringLen
  2770. if postIndex > l {
  2771. return io.ErrUnexpectedEOF
  2772. }
  2773. m.ID = string(dAtA[iNdEx:postIndex])
  2774. iNdEx = postIndex
  2775. case 2:
  2776. if wireType != 2 {
  2777. return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType)
  2778. }
  2779. var msglen int
  2780. for shift := uint(0); ; shift += 7 {
  2781. if shift >= 64 {
  2782. return ErrIntOverflowLogbroker
  2783. }
  2784. if iNdEx >= l {
  2785. return io.ErrUnexpectedEOF
  2786. }
  2787. b := dAtA[iNdEx]
  2788. iNdEx++
  2789. msglen |= (int(b) & 0x7F) << shift
  2790. if b < 0x80 {
  2791. break
  2792. }
  2793. }
  2794. if msglen < 0 {
  2795. return ErrInvalidLengthLogbroker
  2796. }
  2797. postIndex := iNdEx + msglen
  2798. if postIndex > l {
  2799. return io.ErrUnexpectedEOF
  2800. }
  2801. if m.Selector == nil {
  2802. m.Selector = &LogSelector{}
  2803. }
  2804. if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2805. return err
  2806. }
  2807. iNdEx = postIndex
  2808. case 3:
  2809. if wireType != 2 {
  2810. return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType)
  2811. }
  2812. var msglen int
  2813. for shift := uint(0); ; shift += 7 {
  2814. if shift >= 64 {
  2815. return ErrIntOverflowLogbroker
  2816. }
  2817. if iNdEx >= l {
  2818. return io.ErrUnexpectedEOF
  2819. }
  2820. b := dAtA[iNdEx]
  2821. iNdEx++
  2822. msglen |= (int(b) & 0x7F) << shift
  2823. if b < 0x80 {
  2824. break
  2825. }
  2826. }
  2827. if msglen < 0 {
  2828. return ErrInvalidLengthLogbroker
  2829. }
  2830. postIndex := iNdEx + msglen
  2831. if postIndex > l {
  2832. return io.ErrUnexpectedEOF
  2833. }
  2834. if m.Options == nil {
  2835. m.Options = &LogSubscriptionOptions{}
  2836. }
  2837. if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2838. return err
  2839. }
  2840. iNdEx = postIndex
  2841. case 4:
  2842. if wireType != 0 {
  2843. return fmt.Errorf("proto: wrong wireType = %d for field Close", wireType)
  2844. }
  2845. var v int
  2846. for shift := uint(0); ; shift += 7 {
  2847. if shift >= 64 {
  2848. return ErrIntOverflowLogbroker
  2849. }
  2850. if iNdEx >= l {
  2851. return io.ErrUnexpectedEOF
  2852. }
  2853. b := dAtA[iNdEx]
  2854. iNdEx++
  2855. v |= (int(b) & 0x7F) << shift
  2856. if b < 0x80 {
  2857. break
  2858. }
  2859. }
  2860. m.Close = bool(v != 0)
  2861. default:
  2862. iNdEx = preIndex
  2863. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2864. if err != nil {
  2865. return err
  2866. }
  2867. if skippy < 0 {
  2868. return ErrInvalidLengthLogbroker
  2869. }
  2870. if (iNdEx + skippy) > l {
  2871. return io.ErrUnexpectedEOF
  2872. }
  2873. iNdEx += skippy
  2874. }
  2875. }
  2876. if iNdEx > l {
  2877. return io.ErrUnexpectedEOF
  2878. }
  2879. return nil
  2880. }
  2881. func (m *PublishLogsMessage) Unmarshal(dAtA []byte) error {
  2882. l := len(dAtA)
  2883. iNdEx := 0
  2884. for iNdEx < l {
  2885. preIndex := iNdEx
  2886. var wire uint64
  2887. for shift := uint(0); ; shift += 7 {
  2888. if shift >= 64 {
  2889. return ErrIntOverflowLogbroker
  2890. }
  2891. if iNdEx >= l {
  2892. return io.ErrUnexpectedEOF
  2893. }
  2894. b := dAtA[iNdEx]
  2895. iNdEx++
  2896. wire |= (uint64(b) & 0x7F) << shift
  2897. if b < 0x80 {
  2898. break
  2899. }
  2900. }
  2901. fieldNum := int32(wire >> 3)
  2902. wireType := int(wire & 0x7)
  2903. if wireType == 4 {
  2904. return fmt.Errorf("proto: PublishLogsMessage: wiretype end group for non-group")
  2905. }
  2906. if fieldNum <= 0 {
  2907. return fmt.Errorf("proto: PublishLogsMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  2908. }
  2909. switch fieldNum {
  2910. case 1:
  2911. if wireType != 2 {
  2912. return fmt.Errorf("proto: wrong wireType = %d for field SubscriptionID", wireType)
  2913. }
  2914. var stringLen uint64
  2915. for shift := uint(0); ; shift += 7 {
  2916. if shift >= 64 {
  2917. return ErrIntOverflowLogbroker
  2918. }
  2919. if iNdEx >= l {
  2920. return io.ErrUnexpectedEOF
  2921. }
  2922. b := dAtA[iNdEx]
  2923. iNdEx++
  2924. stringLen |= (uint64(b) & 0x7F) << shift
  2925. if b < 0x80 {
  2926. break
  2927. }
  2928. }
  2929. intStringLen := int(stringLen)
  2930. if intStringLen < 0 {
  2931. return ErrInvalidLengthLogbroker
  2932. }
  2933. postIndex := iNdEx + intStringLen
  2934. if postIndex > l {
  2935. return io.ErrUnexpectedEOF
  2936. }
  2937. m.SubscriptionID = string(dAtA[iNdEx:postIndex])
  2938. iNdEx = postIndex
  2939. case 2:
  2940. if wireType != 2 {
  2941. return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType)
  2942. }
  2943. var msglen int
  2944. for shift := uint(0); ; shift += 7 {
  2945. if shift >= 64 {
  2946. return ErrIntOverflowLogbroker
  2947. }
  2948. if iNdEx >= l {
  2949. return io.ErrUnexpectedEOF
  2950. }
  2951. b := dAtA[iNdEx]
  2952. iNdEx++
  2953. msglen |= (int(b) & 0x7F) << shift
  2954. if b < 0x80 {
  2955. break
  2956. }
  2957. }
  2958. if msglen < 0 {
  2959. return ErrInvalidLengthLogbroker
  2960. }
  2961. postIndex := iNdEx + msglen
  2962. if postIndex > l {
  2963. return io.ErrUnexpectedEOF
  2964. }
  2965. m.Messages = append(m.Messages, LogMessage{})
  2966. if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  2967. return err
  2968. }
  2969. iNdEx = postIndex
  2970. case 3:
  2971. if wireType != 0 {
  2972. return fmt.Errorf("proto: wrong wireType = %d for field Close", wireType)
  2973. }
  2974. var v int
  2975. for shift := uint(0); ; shift += 7 {
  2976. if shift >= 64 {
  2977. return ErrIntOverflowLogbroker
  2978. }
  2979. if iNdEx >= l {
  2980. return io.ErrUnexpectedEOF
  2981. }
  2982. b := dAtA[iNdEx]
  2983. iNdEx++
  2984. v |= (int(b) & 0x7F) << shift
  2985. if b < 0x80 {
  2986. break
  2987. }
  2988. }
  2989. m.Close = bool(v != 0)
  2990. default:
  2991. iNdEx = preIndex
  2992. skippy, err := skipLogbroker(dAtA[iNdEx:])
  2993. if err != nil {
  2994. return err
  2995. }
  2996. if skippy < 0 {
  2997. return ErrInvalidLengthLogbroker
  2998. }
  2999. if (iNdEx + skippy) > l {
  3000. return io.ErrUnexpectedEOF
  3001. }
  3002. iNdEx += skippy
  3003. }
  3004. }
  3005. if iNdEx > l {
  3006. return io.ErrUnexpectedEOF
  3007. }
  3008. return nil
  3009. }
  3010. func (m *PublishLogsResponse) Unmarshal(dAtA []byte) error {
  3011. l := len(dAtA)
  3012. iNdEx := 0
  3013. for iNdEx < l {
  3014. preIndex := iNdEx
  3015. var wire uint64
  3016. for shift := uint(0); ; shift += 7 {
  3017. if shift >= 64 {
  3018. return ErrIntOverflowLogbroker
  3019. }
  3020. if iNdEx >= l {
  3021. return io.ErrUnexpectedEOF
  3022. }
  3023. b := dAtA[iNdEx]
  3024. iNdEx++
  3025. wire |= (uint64(b) & 0x7F) << shift
  3026. if b < 0x80 {
  3027. break
  3028. }
  3029. }
  3030. fieldNum := int32(wire >> 3)
  3031. wireType := int(wire & 0x7)
  3032. if wireType == 4 {
  3033. return fmt.Errorf("proto: PublishLogsResponse: wiretype end group for non-group")
  3034. }
  3035. if fieldNum <= 0 {
  3036. return fmt.Errorf("proto: PublishLogsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
  3037. }
  3038. switch fieldNum {
  3039. default:
  3040. iNdEx = preIndex
  3041. skippy, err := skipLogbroker(dAtA[iNdEx:])
  3042. if err != nil {
  3043. return err
  3044. }
  3045. if skippy < 0 {
  3046. return ErrInvalidLengthLogbroker
  3047. }
  3048. if (iNdEx + skippy) > l {
  3049. return io.ErrUnexpectedEOF
  3050. }
  3051. iNdEx += skippy
  3052. }
  3053. }
  3054. if iNdEx > l {
  3055. return io.ErrUnexpectedEOF
  3056. }
  3057. return nil
  3058. }
  3059. func skipLogbroker(dAtA []byte) (n int, err error) {
  3060. l := len(dAtA)
  3061. iNdEx := 0
  3062. for iNdEx < l {
  3063. var wire uint64
  3064. for shift := uint(0); ; shift += 7 {
  3065. if shift >= 64 {
  3066. return 0, ErrIntOverflowLogbroker
  3067. }
  3068. if iNdEx >= l {
  3069. return 0, io.ErrUnexpectedEOF
  3070. }
  3071. b := dAtA[iNdEx]
  3072. iNdEx++
  3073. wire |= (uint64(b) & 0x7F) << shift
  3074. if b < 0x80 {
  3075. break
  3076. }
  3077. }
  3078. wireType := int(wire & 0x7)
  3079. switch wireType {
  3080. case 0:
  3081. for shift := uint(0); ; shift += 7 {
  3082. if shift >= 64 {
  3083. return 0, ErrIntOverflowLogbroker
  3084. }
  3085. if iNdEx >= l {
  3086. return 0, io.ErrUnexpectedEOF
  3087. }
  3088. iNdEx++
  3089. if dAtA[iNdEx-1] < 0x80 {
  3090. break
  3091. }
  3092. }
  3093. return iNdEx, nil
  3094. case 1:
  3095. iNdEx += 8
  3096. return iNdEx, nil
  3097. case 2:
  3098. var length int
  3099. for shift := uint(0); ; shift += 7 {
  3100. if shift >= 64 {
  3101. return 0, ErrIntOverflowLogbroker
  3102. }
  3103. if iNdEx >= l {
  3104. return 0, io.ErrUnexpectedEOF
  3105. }
  3106. b := dAtA[iNdEx]
  3107. iNdEx++
  3108. length |= (int(b) & 0x7F) << shift
  3109. if b < 0x80 {
  3110. break
  3111. }
  3112. }
  3113. iNdEx += length
  3114. if length < 0 {
  3115. return 0, ErrInvalidLengthLogbroker
  3116. }
  3117. return iNdEx, nil
  3118. case 3:
  3119. for {
  3120. var innerWire uint64
  3121. var start int = iNdEx
  3122. for shift := uint(0); ; shift += 7 {
  3123. if shift >= 64 {
  3124. return 0, ErrIntOverflowLogbroker
  3125. }
  3126. if iNdEx >= l {
  3127. return 0, io.ErrUnexpectedEOF
  3128. }
  3129. b := dAtA[iNdEx]
  3130. iNdEx++
  3131. innerWire |= (uint64(b) & 0x7F) << shift
  3132. if b < 0x80 {
  3133. break
  3134. }
  3135. }
  3136. innerWireType := int(innerWire & 0x7)
  3137. if innerWireType == 4 {
  3138. break
  3139. }
  3140. next, err := skipLogbroker(dAtA[start:])
  3141. if err != nil {
  3142. return 0, err
  3143. }
  3144. iNdEx = start + next
  3145. }
  3146. return iNdEx, nil
  3147. case 4:
  3148. return iNdEx, nil
  3149. case 5:
  3150. iNdEx += 4
  3151. return iNdEx, nil
  3152. default:
  3153. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  3154. }
  3155. }
  3156. panic("unreachable")
  3157. }
  3158. var (
  3159. ErrInvalidLengthLogbroker = fmt.Errorf("proto: negative length found during unmarshaling")
  3160. ErrIntOverflowLogbroker = fmt.Errorf("proto: integer overflow")
  3161. )
  3162. func init() { proto.RegisterFile("logbroker.proto", fileDescriptorLogbroker) }
  3163. var fileDescriptorLogbroker = []byte{
  3164. // 940 bytes of a gzipped FileDescriptorProto
  3165. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x95, 0xcf, 0x6f, 0x1b, 0x45,
  3166. 0x14, 0xc7, 0x33, 0xeb, 0xc4, 0x3f, 0x9e, 0x9b, 0xc4, 0x1d, 0xa7, 0x91, 0x65, 0xa8, 0x6d, 0x6d,
  3167. 0xa5, 0x62, 0x45, 0xc5, 0x6e, 0x8d, 0x50, 0x91, 0x2a, 0x21, 0x6a, 0x5c, 0x21, 0x0b, 0x37, 0x41,
  3168. 0x63, 0x47, 0x70, 0x8b, 0xd6, 0xde, 0xe9, 0xb2, 0xf2, 0x7a, 0xc7, 0xec, 0x8c, 0x13, 0x90, 0x38,
  3169. 0x70, 0x28, 0x12, 0xca, 0x81, 0x1b, 0x12, 0x1c, 0x7a, 0xa2, 0x17, 0x84, 0x04, 0x77, 0xfe, 0x00,
  3170. 0x14, 0x71, 0xe2, 0xc8, 0xc9, 0xa2, 0xfb, 0x07, 0xf0, 0x37, 0xa0, 0x9d, 0x19, 0xdb, 0x1b, 0x6c,
  3171. 0xb7, 0xa8, 0xbd, 0x24, 0x33, 0x3b, 0x9f, 0xb7, 0xef, 0xfb, 0xbe, 0xf3, 0xde, 0x1a, 0x76, 0x3d,
  3172. 0xe6, 0xf4, 0x03, 0x36, 0xa4, 0x41, 0x6d, 0x1c, 0x30, 0xc1, 0x30, 0xb6, 0xd9, 0x20, 0xda, 0xf1,
  3173. 0x33, 0x2b, 0x18, 0x0d, 0x5d, 0x51, 0x3b, 0xbd, 0x53, 0xdc, 0x73, 0x98, 0xc3, 0xe4, 0x71, 0x3d,
  3174. 0x5a, 0x29, 0xb2, 0x58, 0x76, 0x18, 0x73, 0x3c, 0x5a, 0x97, 0xbb, 0xfe, 0xe4, 0x51, 0x5d, 0xb8,
  3175. 0x23, 0xca, 0x85, 0x35, 0x1a, 0x6b, 0x20, 0x3f, 0xf6, 0x26, 0x8e, 0xeb, 0xd7, 0xd5, 0x3f, 0xf5,
  3176. 0xd0, 0xfc, 0x15, 0xc1, 0x7e, 0x87, 0x39, 0xdd, 0x49, 0x9f, 0x0f, 0x02, 0x77, 0x2c, 0x5c, 0xe6,
  3177. 0x1f, 0xc9, 0xbf, 0x1c, 0xdf, 0x85, 0x14, 0x17, 0x01, 0xb5, 0x46, 0xbc, 0x80, 0x2a, 0x89, 0xea,
  3178. 0x4e, 0xe3, 0x7a, 0x6d, 0x59, 0x4c, 0x2d, 0x0a, 0x96, 0x14, 0x99, 0xd1, 0x78, 0x1f, 0x92, 0x8f,
  3179. 0x98, 0xe7, 0xb1, 0xb3, 0x82, 0x51, 0x41, 0xd5, 0x34, 0xd1, 0x3b, 0x8c, 0x61, 0x53, 0x58, 0xae,
  3180. 0x57, 0x48, 0x54, 0x50, 0x35, 0x41, 0xe4, 0x1a, 0xdf, 0x86, 0x2d, 0xee, 0xfa, 0x03, 0x5a, 0xd8,
  3181. 0xac, 0xa0, 0x6a, 0xb6, 0x51, 0xac, 0xa9, 0x2a, 0x6a, 0xb3, 0x2a, 0x6a, 0xbd, 0x59, 0x15, 0x44,
  3182. 0x81, 0xe6, 0xb7, 0x08, 0xb2, 0x51, 0x52, 0xea, 0xd1, 0x81, 0x60, 0x01, 0xae, 0x43, 0x96, 0xd3,
  3183. 0xe0, 0xd4, 0x1d, 0xd0, 0x13, 0xd7, 0x56, 0x52, 0x33, 0xcd, 0x9d, 0x70, 0x5a, 0x86, 0xae, 0x7a,
  3184. 0xdc, 0x6e, 0x71, 0x02, 0x1a, 0x69, 0xdb, 0x1c, 0xdf, 0x84, 0xb4, 0xcf, 0x6c, 0x45, 0x1b, 0x92,
  3185. 0xce, 0x86, 0xd3, 0x72, 0xea, 0x90, 0xd9, 0x12, 0x4d, 0x45, 0x87, 0x9a, 0x13, 0x16, 0x1f, 0x4a,
  3186. 0x2e, 0xb1, 0xe0, 0x7a, 0x16, 0x1f, 0x4a, 0x2e, 0x3a, 0x6c, 0xdb, 0xdc, 0x7c, 0x8c, 0x00, 0x3a,
  3187. 0xcc, 0x79, 0x9f, 0xf9, 0x82, 0x7e, 0x2e, 0xf0, 0x2d, 0x80, 0x85, 0x9e, 0x02, 0xaa, 0xa0, 0x6a,
  3188. 0xa6, 0xb9, 0x1d, 0x4e, 0xcb, 0x99, 0xb9, 0x1c, 0x92, 0x99, 0xab, 0xc1, 0x37, 0x20, 0xa5, 0xc5,
  3189. 0x48, 0xb3, 0x32, 0x4d, 0x08, 0xa7, 0xe5, 0xa4, 0xd2, 0x42, 0x92, 0x4a, 0x4a, 0x04, 0x69, 0x25,
  3190. 0xd2, 0x3b, 0x0d, 0x29, 0x21, 0x24, 0xa9, 0x74, 0x98, 0x77, 0x20, 0xd5, 0x61, 0xce, 0x7d, 0x21,
  3191. 0x02, 0x9c, 0x83, 0xc4, 0x90, 0x7e, 0xa1, 0x72, 0x93, 0x68, 0x89, 0xf7, 0x60, 0xeb, 0xd4, 0xf2,
  3192. 0x26, 0x54, 0x25, 0x21, 0x6a, 0x63, 0x9e, 0x1b, 0x52, 0xf9, 0x43, 0xca, 0xb9, 0xe5, 0x50, 0xfc,
  3193. 0x2e, 0xa4, 0x06, 0xaa, 0x08, 0x19, 0x9a, 0x6d, 0x94, 0xd6, 0x5c, 0xb8, 0x2e, 0xb5, 0xb9, 0x79,
  3194. 0x31, 0x2d, 0x6f, 0x90, 0x59, 0x10, 0x7e, 0x07, 0x32, 0xf3, 0x9e, 0x93, 0x89, 0x9e, 0x7f, 0x9f,
  3195. 0x0b, 0x18, 0xbf, 0x0d, 0x49, 0xd5, 0x3c, 0xb2, 0xbe, 0x17, 0x76, 0x9a, 0x86, 0xa3, 0x86, 0xb2,
  3196. 0x2d, 0x61, 0xc9, 0xde, 0xb9, 0x42, 0xe4, 0x1a, 0xdf, 0x85, 0x2d, 0x4b, 0x88, 0x80, 0x17, 0xb6,
  3197. 0x2a, 0x89, 0x6a, 0xb6, 0xf1, 0xda, 0x9a, 0x37, 0x45, 0x3e, 0x69, 0xfd, 0x8a, 0x37, 0x7f, 0x40,
  3198. 0xb0, 0xa7, 0xc7, 0xa0, 0x4f, 0x3b, 0xcc, 0xe1, 0x84, 0x7e, 0x36, 0xa1, 0x5c, 0xe0, 0x7b, 0x90,
  3199. 0xe6, 0xba, 0xd9, 0xb4, 0x2f, 0xe5, 0x75, 0xf2, 0x34, 0x46, 0xe6, 0x01, 0xb8, 0x05, 0x29, 0xa6,
  3200. 0xe6, 0x49, 0x3b, 0x72, 0xb0, 0x2e, 0x76, 0x79, 0x02, 0xc9, 0x2c, 0xd4, 0xfc, 0xe4, 0x3f, 0xd2,
  3201. 0x66, 0x37, 0xf6, 0x1e, 0xa4, 0x47, 0x6a, 0xa9, 0x1a, 0x7f, 0xfd, 0x95, 0xe9, 0x08, 0x5d, 0xf2,
  3202. 0x3c, 0xca, 0x7c, 0x1d, 0x8a, 0x1d, 0x97, 0x0b, 0xea, 0xc7, 0xf3, 0xcf, 0x4a, 0x37, 0x7f, 0x47,
  3203. 0x90, 0x8f, 0x1f, 0xcc, 0xf2, 0xee, 0x83, 0x31, 0xef, 0xed, 0x64, 0x38, 0x2d, 0x1b, 0xed, 0x16,
  3204. 0x31, 0x5c, 0xfb, 0x92, 0x55, 0xc6, 0x2b, 0x58, 0x95, 0x78, 0x69, 0xab, 0xa2, 0x4e, 0x1f, 0x78,
  3205. 0x8c, 0xab, 0x0f, 0x4a, 0x9a, 0xa8, 0x8d, 0xf9, 0x13, 0x02, 0xfc, 0xd1, 0xa4, 0xef, 0xb9, 0xfc,
  3206. 0xd3, 0xb8, 0x7f, 0xf7, 0x60, 0x97, 0xc7, 0x5e, 0xb6, 0x18, 0x58, 0x1c, 0x4e, 0xcb, 0x3b, 0xf1,
  3207. 0x3c, 0xed, 0x16, 0xd9, 0x89, 0xa3, 0x6d, 0xfb, 0x92, 0xf9, 0xc6, 0xcb, 0x98, 0xbf, 0xd0, 0x9a,
  3208. 0x88, 0x6b, 0xbd, 0x06, 0xf9, 0x98, 0x54, 0x42, 0xf9, 0x98, 0xf9, 0x9c, 0x1e, 0x3c, 0x45, 0x90,
  3209. 0x99, 0x8f, 0x00, 0xbe, 0x05, 0xb8, 0x73, 0xf4, 0xc1, 0x49, 0xb7, 0x47, 0x1e, 0xdc, 0x7f, 0x78,
  3210. 0x72, 0x7c, 0xf8, 0xe1, 0xe1, 0xd1, 0xc7, 0x87, 0xb9, 0x8d, 0xe2, 0xde, 0xf9, 0x93, 0x4a, 0x6e,
  3211. 0x8e, 0x1d, 0xfb, 0x43, 0x9f, 0x9d, 0xf9, 0xf8, 0x00, 0xae, 0xc6, 0xe8, 0x6e, 0xaf, 0x75, 0x74,
  3212. 0xdc, 0xcb, 0xa1, 0x62, 0xfe, 0xfc, 0x49, 0x65, 0x77, 0x0e, 0x77, 0x85, 0xcd, 0x26, 0x62, 0x99,
  3213. 0x7d, 0x40, 0x48, 0xce, 0x58, 0x66, 0x69, 0x10, 0x14, 0xaf, 0x7e, 0xf3, 0x63, 0x69, 0xe3, 0xb7,
  3214. 0xa7, 0xa5, 0x85, 0xb0, 0xc6, 0x63, 0x04, 0x9b, 0x91, 0x6e, 0xfc, 0x25, 0x6c, 0x5f, 0xea, 0x59,
  3215. 0x5c, 0x5d, 0xe5, 0xce, 0xaa, 0x89, 0x2b, 0xbe, 0x98, 0xd4, 0x8e, 0x9a, 0xd7, 0xfe, 0xf8, 0xe5,
  3216. 0x9f, 0xef, 0x8d, 0x5d, 0xd8, 0x96, 0xe4, 0x9b, 0x23, 0xcb, 0xb7, 0x1c, 0x1a, 0xdc, 0x46, 0x8d,
  3217. 0x9f, 0x0d, 0xe9, 0x56, 0x53, 0xfe, 0x96, 0xe2, 0xef, 0x10, 0xe4, 0x57, 0xb4, 0x39, 0xae, 0xad,
  3218. 0xbc, 0xb0, 0xb5, 0xf3, 0x50, 0x7c, 0xe3, 0x39, 0xc2, 0xe2, 0x03, 0x62, 0xde, 0x90, 0xba, 0xae,
  3219. 0xc3, 0x15, 0xa5, 0xeb, 0x8c, 0x05, 0x43, 0x1a, 0x2c, 0xa9, 0xc4, 0x5f, 0x23, 0xc8, 0xc6, 0xee,
  3220. 0x1a, 0xdf, 0x5c, 0xf5, 0xfe, 0xe5, 0xbe, 0x5d, 0xad, 0x63, 0x45, 0xd3, 0xfc, 0x2f, 0x1d, 0x55,
  3221. 0xd4, 0x2c, 0x5c, 0x3c, 0x2b, 0x6d, 0xfc, 0xf5, 0xac, 0xb4, 0xf1, 0x55, 0x58, 0x42, 0x17, 0x61,
  3222. 0x09, 0xfd, 0x19, 0x96, 0xd0, 0xdf, 0x61, 0x09, 0xf5, 0x93, 0xf2, 0xc3, 0xfd, 0xd6, 0xbf, 0x01,
  3223. 0x00, 0x00, 0xff, 0xff, 0xf8, 0x4f, 0xdd, 0x74, 0x99, 0x08, 0x00, 0x00,
  3224. }