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