logbroker.pb.go 86 KB

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