How to use Publish method of event Package

Best Testkube code snippet using event.Publish

publish_build_event.pb.go

Source:publish_build_event.pb.go Github

copy

Full Screen

...42const _ = proto.ProtoPackageIsVersion443// The service level of the build request. Backends only uses this value when44// the BuildEnqueued event is published to determine what level of service45// this build should receive.46type PublishLifecycleEventRequest_ServiceLevel int3247const (48 // Non-interactive builds can tolerate longer event latencies. This is the49 // default ServiceLevel if callers do not specify one.50 PublishLifecycleEventRequest_NONINTERACTIVE PublishLifecycleEventRequest_ServiceLevel = 051 // The events of an interactive build should be delivered with low latency.52 PublishLifecycleEventRequest_INTERACTIVE PublishLifecycleEventRequest_ServiceLevel = 153)54// Enum value maps for PublishLifecycleEventRequest_ServiceLevel.55var (56 PublishLifecycleEventRequest_ServiceLevel_name = map[int32]string{57 0: "NONINTERACTIVE",58 1: "INTERACTIVE",59 }60 PublishLifecycleEventRequest_ServiceLevel_value = map[string]int32{61 "NONINTERACTIVE": 0,62 "INTERACTIVE": 1,63 }64)65func (x PublishLifecycleEventRequest_ServiceLevel) Enum() *PublishLifecycleEventRequest_ServiceLevel {66 p := new(PublishLifecycleEventRequest_ServiceLevel)67 *p = x68 return p69}70func (x PublishLifecycleEventRequest_ServiceLevel) String() string {71 return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))72}73func (PublishLifecycleEventRequest_ServiceLevel) Descriptor() protoreflect.EnumDescriptor {74 return file_google_devtools_build_v1_publish_build_event_proto_enumTypes[0].Descriptor()75}76func (PublishLifecycleEventRequest_ServiceLevel) Type() protoreflect.EnumType {77 return &file_google_devtools_build_v1_publish_build_event_proto_enumTypes[0]78}79func (x PublishLifecycleEventRequest_ServiceLevel) Number() protoreflect.EnumNumber {80 return protoreflect.EnumNumber(x)81}82// Deprecated: Use PublishLifecycleEventRequest_ServiceLevel.Descriptor instead.83func (PublishLifecycleEventRequest_ServiceLevel) EnumDescriptor() ([]byte, []int) {84 return file_google_devtools_build_v1_publish_build_event_proto_rawDescGZIP(), []int{0, 0}85}86// Publishes 'lifecycle events' that update the high-level state of a build:87// - BuildEnqueued: When a build is scheduled.88// - InvocationAttemptStarted: When work for a build starts; there can be89// multiple invocations for a build (e.g. retries).90// - InvocationAttemptCompleted: When work for a build finishes.91// - BuildFinished: When a build is finished.92type PublishLifecycleEventRequest struct {93 state protoimpl.MessageState94 sizeCache protoimpl.SizeCache95 unknownFields protoimpl.UnknownFields96 // The interactivity of this build.97 ServiceLevel PublishLifecycleEventRequest_ServiceLevel `protobuf:"varint,1,opt,name=service_level,json=serviceLevel,proto3,enum=google.devtools.build.v1.PublishLifecycleEventRequest_ServiceLevel" json:"service_level,omitempty"`98 // Required. The lifecycle build event. If this is a build tool event, the RPC99 // will fail with INVALID_REQUEST.100 BuildEvent *OrderedBuildEvent `protobuf:"bytes,2,opt,name=build_event,json=buildEvent,proto3" json:"build_event,omitempty"`101 // If the next event for this build or invocation (depending on the event102 // type) hasn't been published after this duration from when {build_event}103 // is written to BES, consider this stream expired. If this field is not set,104 // BES backend will use its own default value.105 StreamTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=stream_timeout,json=streamTimeout,proto3" json:"stream_timeout,omitempty"`106 // Additional information about a build request. These are define by the event107 // publishers, and the Build Event Service does not validate or interpret108 // them. They are used while notifying internal systems of new builds and109 // invocations if the OrderedBuildEvent.event type is110 // BuildEnqueued/InvocationAttemptStarted.111 NotificationKeywords []string `protobuf:"bytes,4,rep,name=notification_keywords,json=notificationKeywords,proto3" json:"notification_keywords,omitempty"`112 // Required. The project this build is associated with.113 // This should match the project used for the initial call to114 // PublishLifecycleEvent (containing a BuildEnqueued message).115 ProjectId string `protobuf:"bytes,6,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`116}117func (x *PublishLifecycleEventRequest) Reset() {118 *x = PublishLifecycleEventRequest{}119 if protoimpl.UnsafeEnabled {120 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[0]121 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))122 ms.StoreMessageInfo(mi)123 }124}125func (x *PublishLifecycleEventRequest) String() string {126 return protoimpl.X.MessageStringOf(x)127}128func (*PublishLifecycleEventRequest) ProtoMessage() {}129func (x *PublishLifecycleEventRequest) ProtoReflect() protoreflect.Message {130 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[0]131 if protoimpl.UnsafeEnabled && x != nil {132 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))133 if ms.LoadMessageInfo() == nil {134 ms.StoreMessageInfo(mi)135 }136 return ms137 }138 return mi.MessageOf(x)139}140// Deprecated: Use PublishLifecycleEventRequest.ProtoReflect.Descriptor instead.141func (*PublishLifecycleEventRequest) Descriptor() ([]byte, []int) {142 return file_google_devtools_build_v1_publish_build_event_proto_rawDescGZIP(), []int{0}143}144func (x *PublishLifecycleEventRequest) GetServiceLevel() PublishLifecycleEventRequest_ServiceLevel {145 if x != nil {146 return x.ServiceLevel147 }148 return PublishLifecycleEventRequest_NONINTERACTIVE149}150func (x *PublishLifecycleEventRequest) GetBuildEvent() *OrderedBuildEvent {151 if x != nil {152 return x.BuildEvent153 }154 return nil155}156func (x *PublishLifecycleEventRequest) GetStreamTimeout() *durationpb.Duration {157 if x != nil {158 return x.StreamTimeout159 }160 return nil161}162func (x *PublishLifecycleEventRequest) GetNotificationKeywords() []string {163 if x != nil {164 return x.NotificationKeywords165 }166 return nil167}168func (x *PublishLifecycleEventRequest) GetProjectId() string {169 if x != nil {170 return x.ProjectId171 }172 return ""173}174// States which event has been committed. Any failure to commit will cause175// RPC errors, hence not recorded by this proto.176type PublishBuildToolEventStreamResponse struct {177 state protoimpl.MessageState178 sizeCache protoimpl.SizeCache179 unknownFields protoimpl.UnknownFields180 // The stream that contains this event.181 StreamId *StreamId `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`182 // The sequence number of this event that has been committed.183 SequenceNumber int64 `protobuf:"varint,2,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"`184}185func (x *PublishBuildToolEventStreamResponse) Reset() {186 *x = PublishBuildToolEventStreamResponse{}187 if protoimpl.UnsafeEnabled {188 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[1]189 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))190 ms.StoreMessageInfo(mi)191 }192}193func (x *PublishBuildToolEventStreamResponse) String() string {194 return protoimpl.X.MessageStringOf(x)195}196func (*PublishBuildToolEventStreamResponse) ProtoMessage() {}197func (x *PublishBuildToolEventStreamResponse) ProtoReflect() protoreflect.Message {198 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[1]199 if protoimpl.UnsafeEnabled && x != nil {200 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))201 if ms.LoadMessageInfo() == nil {202 ms.StoreMessageInfo(mi)203 }204 return ms205 }206 return mi.MessageOf(x)207}208// Deprecated: Use PublishBuildToolEventStreamResponse.ProtoReflect.Descriptor instead.209func (*PublishBuildToolEventStreamResponse) Descriptor() ([]byte, []int) {210 return file_google_devtools_build_v1_publish_build_event_proto_rawDescGZIP(), []int{1}211}212func (x *PublishBuildToolEventStreamResponse) GetStreamId() *StreamId {213 if x != nil {214 return x.StreamId215 }216 return nil217}218func (x *PublishBuildToolEventStreamResponse) GetSequenceNumber() int64 {219 if x != nil {220 return x.SequenceNumber221 }222 return 0223}224// Build event with contextual information about the stream it belongs to and225// its position in that stream.226type OrderedBuildEvent struct {227 state protoimpl.MessageState228 sizeCache protoimpl.SizeCache229 unknownFields protoimpl.UnknownFields230 // Which build event stream this event belongs to.231 StreamId *StreamId `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`232 // The position of this event in the stream. The sequence numbers for a build233 // event stream should be a sequence of consecutive natural numbers starting234 // from one. (1, 2, 3, ...)235 SequenceNumber int64 `protobuf:"varint,2,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"`236 // The actual event.237 Event *BuildEvent `protobuf:"bytes,3,opt,name=event,proto3" json:"event,omitempty"`238}239func (x *OrderedBuildEvent) Reset() {240 *x = OrderedBuildEvent{}241 if protoimpl.UnsafeEnabled {242 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[2]243 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))244 ms.StoreMessageInfo(mi)245 }246}247func (x *OrderedBuildEvent) String() string {248 return protoimpl.X.MessageStringOf(x)249}250func (*OrderedBuildEvent) ProtoMessage() {}251func (x *OrderedBuildEvent) ProtoReflect() protoreflect.Message {252 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[2]253 if protoimpl.UnsafeEnabled && x != nil {254 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))255 if ms.LoadMessageInfo() == nil {256 ms.StoreMessageInfo(mi)257 }258 return ms259 }260 return mi.MessageOf(x)261}262// Deprecated: Use OrderedBuildEvent.ProtoReflect.Descriptor instead.263func (*OrderedBuildEvent) Descriptor() ([]byte, []int) {264 return file_google_devtools_build_v1_publish_build_event_proto_rawDescGZIP(), []int{2}265}266func (x *OrderedBuildEvent) GetStreamId() *StreamId {267 if x != nil {268 return x.StreamId269 }270 return nil271}272func (x *OrderedBuildEvent) GetSequenceNumber() int64 {273 if x != nil {274 return x.SequenceNumber275 }276 return 0277}278func (x *OrderedBuildEvent) GetEvent() *BuildEvent {279 if x != nil {280 return x.Event281 }282 return nil283}284// Streaming request message for PublishBuildToolEventStream.285type PublishBuildToolEventStreamRequest struct {286 state protoimpl.MessageState287 sizeCache protoimpl.SizeCache288 unknownFields protoimpl.UnknownFields289 // Required. The build event with position info.290 // New publishing clients should use this field rather than the 3 above.291 OrderedBuildEvent *OrderedBuildEvent `protobuf:"bytes,4,opt,name=ordered_build_event,json=orderedBuildEvent,proto3" json:"ordered_build_event,omitempty"`292 // The keywords to be attached to the notification which notifies the start293 // of a new build event stream. BES only reads this field when sequence_number294 // or ordered_build_event.sequence_number is 1 in this message. If this field295 // is empty, BES will not publish notification messages for this stream.296 NotificationKeywords []string `protobuf:"bytes,5,rep,name=notification_keywords,json=notificationKeywords,proto3" json:"notification_keywords,omitempty"`297 // Required. The project this build is associated with.298 // This should match the project used for the initial call to299 // PublishLifecycleEvent (containing a BuildEnqueued message).300 ProjectId string `protobuf:"bytes,6,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`301}302func (x *PublishBuildToolEventStreamRequest) Reset() {303 *x = PublishBuildToolEventStreamRequest{}304 if protoimpl.UnsafeEnabled {305 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[3]306 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))307 ms.StoreMessageInfo(mi)308 }309}310func (x *PublishBuildToolEventStreamRequest) String() string {311 return protoimpl.X.MessageStringOf(x)312}313func (*PublishBuildToolEventStreamRequest) ProtoMessage() {}314func (x *PublishBuildToolEventStreamRequest) ProtoReflect() protoreflect.Message {315 mi := &file_google_devtools_build_v1_publish_build_event_proto_msgTypes[3]316 if protoimpl.UnsafeEnabled && x != nil {317 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))318 if ms.LoadMessageInfo() == nil {319 ms.StoreMessageInfo(mi)320 }321 return ms322 }323 return mi.MessageOf(x)324}325// Deprecated: Use PublishBuildToolEventStreamRequest.ProtoReflect.Descriptor instead.326func (*PublishBuildToolEventStreamRequest) Descriptor() ([]byte, []int) {327 return file_google_devtools_build_v1_publish_build_event_proto_rawDescGZIP(), []int{3}328}329func (x *PublishBuildToolEventStreamRequest) GetOrderedBuildEvent() *OrderedBuildEvent {330 if x != nil {331 return x.OrderedBuildEvent332 }333 return nil334}335func (x *PublishBuildToolEventStreamRequest) GetNotificationKeywords() []string {336 if x != nil {337 return x.NotificationKeywords338 }339 return nil340}341func (x *PublishBuildToolEventStreamRequest) GetProjectId() string {342 if x != nil {343 return x.ProjectId344 }345 return ""346}347var File_google_devtools_build_v1_publish_build_event_proto protoreflect.FileDescriptor348var file_google_devtools_build_v1_publish_build_event_proto_rawDesc = []byte{349 0x0a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c,350 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69,351 0x73, 0x68, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70,352 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76,353 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x1a, 0x1c,354 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74,355 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f,356 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e,357 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,358 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72,359 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x64,360 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x76, 0x31,361 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72,362 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,363 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72,364 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,365 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,366 0x22, 0xab, 0x03, 0x0a, 0x1c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4c, 0x69, 0x66, 0x65,367 0x63, 0x79, 0x63, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,368 0x74, 0x12, 0x68, 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6c, 0x65, 0x76,369 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,370 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64,371 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4c, 0x69, 0x66, 0x65, 0x63,372 0x79, 0x63, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,373 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x0c, 0x73,374 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x51, 0x0a, 0x0b, 0x62,375 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,376 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f,377 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65,378 0x72, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x03, 0xe0,379 0x41, 0x02, 0x52, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x40,380 0x0a, 0x0e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,381 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,382 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,383 0x6e, 0x52, 0x0d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,384 0x12, 0x33, 0x0a, 0x15, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,385 0x5f, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52,386 0x14, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79,387 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,388 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x09,389 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x33, 0x0a, 0x0c, 0x53, 0x65, 0x72,390 0x76, 0x69, 0x63, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x4f, 0x4e,391 0x49, 0x4e, 0x54, 0x45, 0x52, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x00, 0x12, 0x0f, 0x0a,392 0x0b, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x22, 0x8f,393 0x01, 0x0a, 0x23, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54,394 0x6f, 0x6f, 0x6c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65,395 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d,396 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67,397 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c,398 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x52, 0x08, 0x73,399 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x71, 0x75, 0x65,400 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,401 0x52, 0x0e, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,402 0x22, 0xb9, 0x01, 0x0a, 0x11, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c,403 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d,404 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67,405 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c,406 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x52, 0x08, 0x73,407 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x71, 0x75, 0x65,408 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,409 0x52, 0x0e, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,410 0x12, 0x3a, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,411 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c,412 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64,413 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0xdf, 0x01, 0x0a,414 0x22, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x6f, 0x6f,415 0x6c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75,416 0x65, 0x73, 0x74, 0x12, 0x60, 0x0a, 0x13, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x62,417 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,418 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f,419 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65,420 0x72, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x03, 0xe0,421 0x41, 0x02, 0x52, 0x11, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64,422 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x15, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63,423 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x05,424 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,425 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0a, 0x70, 0x72,426 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03,427 0xe0, 0x41, 0x02, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x32, 0xde,428 0x04, 0x0a, 0x11, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x45,429 0x76, 0x65, 0x6e, 0x74, 0x12, 0xc9, 0x01, 0x0a, 0x15, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,430 0x4c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x36,431 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73,432 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73,433 0x68, 0x4c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52,434 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,435 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x60,436 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x5a, 0x22, 0x33, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x6a,437 0x65, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64,438 0x3d, 0x2a, 0x7d, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x45, 0x76, 0x65,439 0x6e, 0x74, 0x73, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x3a, 0x01, 0x2a, 0x5a, 0x20,440 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x45,441 0x76, 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x3a, 0x01, 0x2a,442 0x12, 0xa6, 0x02, 0x0a, 0x1b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x42, 0x75, 0x69, 0x6c,443 0x64, 0x54, 0x6f, 0x6f, 0x6c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,444 0x12, 0x3c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f,445 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c,446 0x69, 0x73, 0x68, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x6f, 0x6f, 0x6c, 0x45, 0x76, 0x65, 0x6e,447 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d,448 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73,449 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73,450 0x68, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x6f, 0x6f, 0x6c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53,451 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x01,452 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x48, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x6a,453 0x65, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64,454 0x3d, 0x2a, 0x7d, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69,455 0x73, 0x68, 0x3a, 0x01, 0x2a, 0x5a, 0x17, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65,456 0x6e, 0x74, 0x73, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x3a, 0x01, 0x2a, 0xda, 0x41,457 0x34, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x65,458 0x76, 0x65, 0x6e, 0x74, 0x2c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,459 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x2c, 0x70, 0x72, 0x6f, 0x6a, 0x65,460 0x63, 0x74, 0x5f, 0x69, 0x64, 0x28, 0x01, 0x30, 0x01, 0x1a, 0x54, 0xca, 0x41, 0x20, 0x62, 0x75,461 0x69, 0x6c, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,462 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0xd2, 0x41,463 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x67, 0x6f, 0x6f,464 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68,465 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x42,466 0x88, 0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64,467 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x76, 0x31,468 0x42, 0x0c, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,469 0x5a, 0x3d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e,470 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f,471 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73,472 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0xf8,473 0x01, 0x01, 0xca, 0x02, 0x15, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5c, 0x43, 0x6c, 0x6f, 0x75,474 0x64, 0x5c, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,475 0x6f, 0x33,476}477var (478 file_google_devtools_build_v1_publish_build_event_proto_rawDescOnce sync.Once479 file_google_devtools_build_v1_publish_build_event_proto_rawDescData = file_google_devtools_build_v1_publish_build_event_proto_rawDesc480)481func file_google_devtools_build_v1_publish_build_event_proto_rawDescGZIP() []byte {482 file_google_devtools_build_v1_publish_build_event_proto_rawDescOnce.Do(func() {483 file_google_devtools_build_v1_publish_build_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_devtools_build_v1_publish_build_event_proto_rawDescData)484 })485 return file_google_devtools_build_v1_publish_build_event_proto_rawDescData486}487var file_google_devtools_build_v1_publish_build_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1)488var file_google_devtools_build_v1_publish_build_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4)489var file_google_devtools_build_v1_publish_build_event_proto_goTypes = []interface{}{490 (PublishLifecycleEventRequest_ServiceLevel)(0), // 0: google.devtools.build.v1.PublishLifecycleEventRequest.ServiceLevel491 (*PublishLifecycleEventRequest)(nil), // 1: google.devtools.build.v1.PublishLifecycleEventRequest492 (*PublishBuildToolEventStreamResponse)(nil), // 2: google.devtools.build.v1.PublishBuildToolEventStreamResponse493 (*OrderedBuildEvent)(nil), // 3: google.devtools.build.v1.OrderedBuildEvent494 (*PublishBuildToolEventStreamRequest)(nil), // 4: google.devtools.build.v1.PublishBuildToolEventStreamRequest495 (*durationpb.Duration)(nil), // 5: google.protobuf.Duration496 (*StreamId)(nil), // 6: google.devtools.build.v1.StreamId497 (*BuildEvent)(nil), // 7: google.devtools.build.v1.BuildEvent498 (*emptypb.Empty)(nil), // 8: google.protobuf.Empty499}500var file_google_devtools_build_v1_publish_build_event_proto_depIdxs = []int32{501 0, // 0: google.devtools.build.v1.PublishLifecycleEventRequest.service_level:type_name -> google.devtools.build.v1.PublishLifecycleEventRequest.ServiceLevel502 3, // 1: google.devtools.build.v1.PublishLifecycleEventRequest.build_event:type_name -> google.devtools.build.v1.OrderedBuildEvent503 5, // 2: google.devtools.build.v1.PublishLifecycleEventRequest.stream_timeout:type_name -> google.protobuf.Duration504 6, // 3: google.devtools.build.v1.PublishBuildToolEventStreamResponse.stream_id:type_name -> google.devtools.build.v1.StreamId505 6, // 4: google.devtools.build.v1.OrderedBuildEvent.stream_id:type_name -> google.devtools.build.v1.StreamId506 7, // 5: google.devtools.build.v1.OrderedBuildEvent.event:type_name -> google.devtools.build.v1.BuildEvent507 3, // 6: google.devtools.build.v1.PublishBuildToolEventStreamRequest.ordered_build_event:type_name -> google.devtools.build.v1.OrderedBuildEvent508 1, // 7: google.devtools.build.v1.PublishBuildEvent.PublishLifecycleEvent:input_type -> google.devtools.build.v1.PublishLifecycleEventRequest509 4, // 8: google.devtools.build.v1.PublishBuildEvent.PublishBuildToolEventStream:input_type -> google.devtools.build.v1.PublishBuildToolEventStreamRequest510 8, // 9: google.devtools.build.v1.PublishBuildEvent.PublishLifecycleEvent:output_type -> google.protobuf.Empty511 2, // 10: google.devtools.build.v1.PublishBuildEvent.PublishBuildToolEventStream:output_type -> google.devtools.build.v1.PublishBuildToolEventStreamResponse512 9, // [9:11] is the sub-list for method output_type513 7, // [7:9] is the sub-list for method input_type514 7, // [7:7] is the sub-list for extension type_name515 7, // [7:7] is the sub-list for extension extendee516 0, // [0:7] is the sub-list for field type_name517}518func init() { file_google_devtools_build_v1_publish_build_event_proto_init() }519func file_google_devtools_build_v1_publish_build_event_proto_init() {520 if File_google_devtools_build_v1_publish_build_event_proto != nil {521 return522 }523 file_google_devtools_build_v1_build_events_proto_init()524 if !protoimpl.UnsafeEnabled {525 file_google_devtools_build_v1_publish_build_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {526 switch v := v.(*PublishLifecycleEventRequest); i {527 case 0:528 return &v.state529 case 1:530 return &v.sizeCache531 case 2:532 return &v.unknownFields533 default:534 return nil535 }536 }537 file_google_devtools_build_v1_publish_build_event_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {538 switch v := v.(*PublishBuildToolEventStreamResponse); i {539 case 0:540 return &v.state541 case 1:542 return &v.sizeCache543 case 2:544 return &v.unknownFields545 default:546 return nil547 }548 }549 file_google_devtools_build_v1_publish_build_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {550 switch v := v.(*OrderedBuildEvent); i {551 case 0:552 return &v.state553 case 1:554 return &v.sizeCache555 case 2:556 return &v.unknownFields557 default:558 return nil559 }560 }561 file_google_devtools_build_v1_publish_build_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {562 switch v := v.(*PublishBuildToolEventStreamRequest); i {563 case 0:564 return &v.state565 case 1:566 return &v.sizeCache567 case 2:568 return &v.unknownFields569 default:570 return nil571 }572 }573 }574 type x struct{}575 out := protoimpl.TypeBuilder{576 File: protoimpl.DescBuilder{577 GoPackagePath: reflect.TypeOf(x{}).PkgPath(),578 RawDescriptor: file_google_devtools_build_v1_publish_build_event_proto_rawDesc,579 NumEnums: 1,580 NumMessages: 4,581 NumExtensions: 0,582 NumServices: 1,583 },584 GoTypes: file_google_devtools_build_v1_publish_build_event_proto_goTypes,585 DependencyIndexes: file_google_devtools_build_v1_publish_build_event_proto_depIdxs,586 EnumInfos: file_google_devtools_build_v1_publish_build_event_proto_enumTypes,587 MessageInfos: file_google_devtools_build_v1_publish_build_event_proto_msgTypes,588 }.Build()589 File_google_devtools_build_v1_publish_build_event_proto = out.File590 file_google_devtools_build_v1_publish_build_event_proto_rawDesc = nil591 file_google_devtools_build_v1_publish_build_event_proto_goTypes = nil592 file_google_devtools_build_v1_publish_build_event_proto_depIdxs = nil593}594// Reference imports to suppress errors if they are not otherwise used.595var _ context.Context596var _ grpc.ClientConnInterface597// This is a compile-time assertion to ensure that this generated file598// is compatible with the grpc package it is being compiled against.599const _ = grpc.SupportPackageIsVersion6600// PublishBuildEventClient is the client API for PublishBuildEvent service.601//602// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.603type PublishBuildEventClient interface {604 // Publish a build event stating the new state of a build (typically from the605 // build queue). The BuildEnqueued event must be publishd before all other606 // events for the same build ID.607 //608 // The backend will persist the event and deliver it to registered frontend609 // jobs immediately without batching.610 //611 // The commit status of the request is reported by the RPC's util_status()612 // function. The error code is the canoncial error code defined in613 // //util/task/codes.proto.614 PublishLifecycleEvent(ctx context.Context, in *PublishLifecycleEventRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)615 // Publish build tool events belonging to the same stream to a backend job616 // using bidirectional streaming.617 PublishBuildToolEventStream(ctx context.Context, opts ...grpc.CallOption) (PublishBuildEvent_PublishBuildToolEventStreamClient, error)618}619type publishBuildEventClient struct {620 cc grpc.ClientConnInterface621}622func NewPublishBuildEventClient(cc grpc.ClientConnInterface) PublishBuildEventClient {623 return &publishBuildEventClient{cc}624}625func (c *publishBuildEventClient) PublishLifecycleEvent(ctx context.Context, in *PublishLifecycleEventRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {626 out := new(emptypb.Empty)627 err := c.cc.Invoke(ctx, "/google.devtools.build.v1.PublishBuildEvent/PublishLifecycleEvent", in, out, opts...)628 if err != nil {629 return nil, err630 }631 return out, nil632}633func (c *publishBuildEventClient) PublishBuildToolEventStream(ctx context.Context, opts ...grpc.CallOption) (PublishBuildEvent_PublishBuildToolEventStreamClient, error) {634 stream, err := c.cc.NewStream(ctx, &_PublishBuildEvent_serviceDesc.Streams[0], "/google.devtools.build.v1.PublishBuildEvent/PublishBuildToolEventStream", opts...)635 if err != nil {636 return nil, err637 }638 x := &publishBuildEventPublishBuildToolEventStreamClient{stream}639 return x, nil640}641type PublishBuildEvent_PublishBuildToolEventStreamClient interface {642 Send(*PublishBuildToolEventStreamRequest) error643 Recv() (*PublishBuildToolEventStreamResponse, error)644 grpc.ClientStream645}646type publishBuildEventPublishBuildToolEventStreamClient struct {647 grpc.ClientStream648}649func (x *publishBuildEventPublishBuildToolEventStreamClient) Send(m *PublishBuildToolEventStreamRequest) error {650 return x.ClientStream.SendMsg(m)651}652func (x *publishBuildEventPublishBuildToolEventStreamClient) Recv() (*PublishBuildToolEventStreamResponse, error) {653 m := new(PublishBuildToolEventStreamResponse)654 if err := x.ClientStream.RecvMsg(m); err != nil {655 return nil, err656 }657 return m, nil658}659// PublishBuildEventServer is the server API for PublishBuildEvent service.660type PublishBuildEventServer interface {661 // Publish a build event stating the new state of a build (typically from the662 // build queue). The BuildEnqueued event must be publishd before all other663 // events for the same build ID.664 //665 // The backend will persist the event and deliver it to registered frontend666 // jobs immediately without batching.667 //668 // The commit status of the request is reported by the RPC's util_status()669 // function. The error code is the canoncial error code defined in670 // //util/task/codes.proto.671 PublishLifecycleEvent(context.Context, *PublishLifecycleEventRequest) (*emptypb.Empty, error)672 // Publish build tool events belonging to the same stream to a backend job673 // using bidirectional streaming.674 PublishBuildToolEventStream(PublishBuildEvent_PublishBuildToolEventStreamServer) error675}676// UnimplementedPublishBuildEventServer can be embedded to have forward compatible implementations.677type UnimplementedPublishBuildEventServer struct {678}679func (*UnimplementedPublishBuildEventServer) PublishLifecycleEvent(context.Context, *PublishLifecycleEventRequest) (*emptypb.Empty, error) {680 return nil, status.Errorf(codes.Unimplemented, "method PublishLifecycleEvent not implemented")681}682func (*UnimplementedPublishBuildEventServer) PublishBuildToolEventStream(PublishBuildEvent_PublishBuildToolEventStreamServer) error {683 return status.Errorf(codes.Unimplemented, "method PublishBuildToolEventStream not implemented")684}685func RegisterPublishBuildEventServer(s *grpc.Server, srv PublishBuildEventServer) {686 s.RegisterService(&_PublishBuildEvent_serviceDesc, srv)687}688func _PublishBuildEvent_PublishLifecycleEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {689 in := new(PublishLifecycleEventRequest)690 if err := dec(in); err != nil {691 return nil, err692 }693 if interceptor == nil {694 return srv.(PublishBuildEventServer).PublishLifecycleEvent(ctx, in)695 }696 info := &grpc.UnaryServerInfo{697 Server: srv,698 FullMethod: "/google.devtools.build.v1.PublishBuildEvent/PublishLifecycleEvent",699 }700 handler := func(ctx context.Context, req interface{}) (interface{}, error) {701 return srv.(PublishBuildEventServer).PublishLifecycleEvent(ctx, req.(*PublishLifecycleEventRequest))702 }703 return interceptor(ctx, in, info, handler)704}705func _PublishBuildEvent_PublishBuildToolEventStream_Handler(srv interface{}, stream grpc.ServerStream) error {706 return srv.(PublishBuildEventServer).PublishBuildToolEventStream(&publishBuildEventPublishBuildToolEventStreamServer{stream})707}708type PublishBuildEvent_PublishBuildToolEventStreamServer interface {709 Send(*PublishBuildToolEventStreamResponse) error710 Recv() (*PublishBuildToolEventStreamRequest, error)711 grpc.ServerStream712}713type publishBuildEventPublishBuildToolEventStreamServer struct {714 grpc.ServerStream715}716func (x *publishBuildEventPublishBuildToolEventStreamServer) Send(m *PublishBuildToolEventStreamResponse) error {717 return x.ServerStream.SendMsg(m)718}719func (x *publishBuildEventPublishBuildToolEventStreamServer) Recv() (*PublishBuildToolEventStreamRequest, error) {720 m := new(PublishBuildToolEventStreamRequest)721 if err := x.ServerStream.RecvMsg(m); err != nil {722 return nil, err723 }724 return m, nil725}726var _PublishBuildEvent_serviceDesc = grpc.ServiceDesc{727 ServiceName: "google.devtools.build.v1.PublishBuildEvent",728 HandlerType: (*PublishBuildEventServer)(nil),729 Methods: []grpc.MethodDesc{730 {731 MethodName: "PublishLifecycleEvent",732 Handler: _PublishBuildEvent_PublishLifecycleEvent_Handler,733 },734 },735 Streams: []grpc.StreamDesc{736 {737 StreamName: "PublishBuildToolEventStream",738 Handler: _PublishBuildEvent_PublishBuildToolEventStream_Handler,739 ServerStreams: true,740 ClientStreams: true,741 },742 },743 Metadata: "google/devtools/build/v1/publish_build_event.proto",744}...

Full Screen

Full Screen

publish_build_event_client.go

Source:publish_build_event_client.go Github

copy

Full Screen

...26 buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"27 "google.golang.org/grpc"28 "google.golang.org/grpc/metadata"29)30var newPublishBuildEventClientHook clientHook31// PublishBuildEventCallOptions contains the retry settings for each method of PublishBuildEventClient.32type PublishBuildEventCallOptions struct {33 PublishLifecycleEvent []gax.CallOption34 PublishBuildToolEventStream []gax.CallOption35}36func defaultPublishBuildEventGRPCClientOptions() []option.ClientOption {37 return []option.ClientOption{38 internaloption.WithDefaultEndpoint("buildeventservice.googleapis.com:443"),39 internaloption.WithDefaultMTLSEndpoint("buildeventservice.mtls.googleapis.com:443"),40 internaloption.WithDefaultAudience("https://buildeventservice.googleapis.com/"),41 internaloption.WithDefaultScopes(DefaultAuthScopes()...),42 internaloption.EnableJwtWithScope(),43 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(44 grpc.MaxCallRecvMsgSize(math.MaxInt32))),45 }46}47func defaultPublishBuildEventCallOptions() *PublishBuildEventCallOptions {48 return &PublishBuildEventCallOptions{49 PublishLifecycleEvent: []gax.CallOption{},50 PublishBuildToolEventStream: []gax.CallOption{},51 }52}53// internalPublishBuildEventClient is an interface that defines the methods availaible from Build Event Service Backend API.54type internalPublishBuildEventClient interface {55 Close() error56 setGoogleClientInfo(...string)57 Connection() *grpc.ClientConn58 PublishLifecycleEvent(context.Context, *buildpb.PublishLifecycleEventRequest, ...gax.CallOption) error59 PublishBuildToolEventStream(context.Context, ...gax.CallOption) (buildpb.PublishBuildEvent_PublishBuildToolEventStreamClient, error)60}61// PublishBuildEventClient is a client for interacting with Build Event Service Backend API.62// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.63//64// A service for publishing BuildEvents. BuildEvents are generated by Build65// Systems to record actions taken during a Build. Events occur in streams,66// are identified by a StreamId, and ordered by sequence number in a stream.67//68// A Build may contain several streams of BuildEvents, depending on the systems69// that are involved in the Build. Some BuildEvents are used to declare the70// beginning and end of major portions of a Build; these are called71// LifecycleEvents, and are used (for example) to indicate the beginning or end72// of a Build, and the beginning or end of an Invocation attempt (there can be73// more than 1 Invocation in a Build if, for example, a failure occurs somewhere74// and it needs to be retried).75//76// Other, build-tool events represent actions taken by the Build tool, such as77// target objects produced via compilation, tests run, et cetera. There could be78// more than one build tool stream for an invocation attempt of a build.79type PublishBuildEventClient struct {80 // The internal transport-dependent client.81 internalClient internalPublishBuildEventClient82 // The call options for this service.83 CallOptions *PublishBuildEventCallOptions84}85// Wrapper methods routed to the internal client.86// Close closes the connection to the API service. The user should invoke this when87// the client is no longer required.88func (c *PublishBuildEventClient) Close() error {89 return c.internalClient.Close()90}91// setGoogleClientInfo sets the name and version of the application in92// the `x-goog-api-client` header passed on each request. Intended for93// use by Google-written clients.94func (c *PublishBuildEventClient) setGoogleClientInfo(keyval ...string) {95 c.internalClient.setGoogleClientInfo(keyval...)96}97// Connection returns a connection to the API service.98//99// Deprecated.100func (c *PublishBuildEventClient) Connection() *grpc.ClientConn {101 return c.internalClient.Connection()102}103// PublishLifecycleEvent publish a build event stating the new state of a build (typically from the104// build queue). The BuildEnqueued event must be publishd before all other105// events for the same build ID.106//107// The backend will persist the event and deliver it to registered frontend108// jobs immediately without batching.109//110// The commit status of the request is reported by the RPC’s util_status()111// function. The error code is the canoncial error code defined in112// //util/task/codes.proto.113func (c *PublishBuildEventClient) PublishLifecycleEvent(ctx context.Context, req *buildpb.PublishLifecycleEventRequest, opts ...gax.CallOption) error {114 return c.internalClient.PublishLifecycleEvent(ctx, req, opts...)115}116// PublishBuildToolEventStream publish build tool events belonging to the same stream to a backend job117// using bidirectional streaming.118func (c *PublishBuildEventClient) PublishBuildToolEventStream(ctx context.Context, opts ...gax.CallOption) (buildpb.PublishBuildEvent_PublishBuildToolEventStreamClient, error) {119 return c.internalClient.PublishBuildToolEventStream(ctx, opts...)120}121// publishBuildEventGRPCClient is a client for interacting with Build Event Service Backend API over gRPC transport.122//123// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.124type publishBuildEventGRPCClient struct {125 // Connection pool of gRPC connections to the service.126 connPool gtransport.ConnPool127 // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE128 disableDeadlines bool129 // Points back to the CallOptions field of the containing PublishBuildEventClient130 CallOptions **PublishBuildEventCallOptions131 // The gRPC API client.132 publishBuildEventClient buildpb.PublishBuildEventClient133 // The x-goog-* metadata to be sent with each request.134 xGoogMetadata metadata.MD135}136// NewPublishBuildEventClient creates a new publish build event client based on gRPC.137// The returned client must be Closed when it is done being used to clean up its underlying connections.138//139// A service for publishing BuildEvents. BuildEvents are generated by Build140// Systems to record actions taken during a Build. Events occur in streams,141// are identified by a StreamId, and ordered by sequence number in a stream.142//143// A Build may contain several streams of BuildEvents, depending on the systems144// that are involved in the Build. Some BuildEvents are used to declare the145// beginning and end of major portions of a Build; these are called146// LifecycleEvents, and are used (for example) to indicate the beginning or end147// of a Build, and the beginning or end of an Invocation attempt (there can be148// more than 1 Invocation in a Build if, for example, a failure occurs somewhere149// and it needs to be retried).150//151// Other, build-tool events represent actions taken by the Build tool, such as152// target objects produced via compilation, tests run, et cetera. There could be153// more than one build tool stream for an invocation attempt of a build.154func NewPublishBuildEventClient(ctx context.Context, opts ...option.ClientOption) (*PublishBuildEventClient, error) {155 clientOpts := defaultPublishBuildEventGRPCClientOptions()156 if newPublishBuildEventClientHook != nil {157 hookOpts, err := newPublishBuildEventClientHook(ctx, clientHookParams{})158 if err != nil {159 return nil, err160 }161 clientOpts = append(clientOpts, hookOpts...)162 }163 disableDeadlines, err := checkDisableDeadlines()164 if err != nil {165 return nil, err166 }167 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)168 if err != nil {169 return nil, err170 }171 client := PublishBuildEventClient{CallOptions: defaultPublishBuildEventCallOptions()}172 c := &publishBuildEventGRPCClient{173 connPool: connPool,174 disableDeadlines: disableDeadlines,175 publishBuildEventClient: buildpb.NewPublishBuildEventClient(connPool),176 CallOptions: &client.CallOptions,177 }178 c.setGoogleClientInfo()179 client.internalClient = c180 return &client, nil181}182// Connection returns a connection to the API service.183//184// Deprecated.185func (c *publishBuildEventGRPCClient) Connection() *grpc.ClientConn {186 return c.connPool.Conn()187}188// setGoogleClientInfo sets the name and version of the application in189// the `x-goog-api-client` header passed on each request. Intended for190// use by Google-written clients.191func (c *publishBuildEventGRPCClient) setGoogleClientInfo(keyval ...string) {192 kv := append([]string{"gl-go", versionGo()}, keyval...)193 kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)194 c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))195}196// Close closes the connection to the API service. The user should invoke this when197// the client is no longer required.198func (c *publishBuildEventGRPCClient) Close() error {199 return c.connPool.Close()200}201func (c *publishBuildEventGRPCClient) PublishLifecycleEvent(ctx context.Context, req *buildpb.PublishLifecycleEventRequest, opts ...gax.CallOption) error {202 if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {203 cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond)204 defer cancel()205 ctx = cctx206 }207 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "project_id", url.QueryEscape(req.GetProjectId())))208 ctx = insertMetadata(ctx, c.xGoogMetadata, md)209 opts = append((*c.CallOptions).PublishLifecycleEvent[0:len((*c.CallOptions).PublishLifecycleEvent):len((*c.CallOptions).PublishLifecycleEvent)], opts...)210 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {211 var err error212 _, err = c.publishBuildEventClient.PublishLifecycleEvent(ctx, req, settings.GRPC...)213 return err214 }, opts...)215 return err216}217func (c *publishBuildEventGRPCClient) PublishBuildToolEventStream(ctx context.Context, opts ...gax.CallOption) (buildpb.PublishBuildEvent_PublishBuildToolEventStreamClient, error) {218 ctx = insertMetadata(ctx, c.xGoogMetadata)219 var resp buildpb.PublishBuildEvent_PublishBuildToolEventStreamClient220 opts = append((*c.CallOptions).PublishBuildToolEventStream[0:len((*c.CallOptions).PublishBuildToolEventStream):len((*c.CallOptions).PublishBuildToolEventStream)], opts...)221 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {222 var err error223 resp, err = c.publishBuildEventClient.PublishBuildToolEventStream(ctx, settings.GRPC...)224 return err225 }, opts...)226 if err != nil {227 return nil, err228 }229 return resp, nil230}...

Full Screen

Full Screen

event_bus.go

Source:event_bus.go Github

copy

Full Screen

...67}68func (b *EventBus) UnsubscribeAll(ctx context.Context, subscriber string) error {69 return b.pubsub.UnsubscribeAll(ctx, subscriber)70}71func (b *EventBus) Publish(eventType string, eventData TMEventData) error {72 // no explicit deadline for publishing events73 ctx := context.Background()74 b.pubsub.PublishWithTags(ctx, eventData, map[string]string{EventTypeKey: eventType})75 return nil76}77func (b *EventBus) validateAndStringifyTags(tags []cmn.KVPair, logger log.Logger) map[string]string {78 result := make(map[string]string)79 for _, tag := range tags {80 // basic validation81 if len(tag.Key) == 0 {82 logger.Debug("Got tag with an empty key (skipping)", "tag", tag)83 continue84 }85 result[string(tag.Key)] = string(tag.Value)86 }87 return result88}89func (b *EventBus) PublishEventNewBlock(data EventDataNewBlock) error {90 // no explicit deadline for publishing events91 ctx := context.Background()92 resultTags := append(data.ResultBeginBlock.Tags, data.ResultEndBlock.Tags...)93 tags := b.validateAndStringifyTags(resultTags, b.Logger.With("block", data.Block.StringShort()))94 // add predefined tags95 logIfTagExists(EventTypeKey, tags, b.Logger)96 tags[EventTypeKey] = EventNewBlock97 b.pubsub.PublishWithTags(ctx, data, tags)98 return nil99}100func (b *EventBus) PublishEventNewBlockHeader(data EventDataNewBlockHeader) error {101 // no explicit deadline for publishing events102 ctx := context.Background()103 resultTags := append(data.ResultBeginBlock.Tags, data.ResultEndBlock.Tags...)104 // TODO: Create StringShort method for Header and use it in logger.105 tags := b.validateAndStringifyTags(resultTags, b.Logger.With("header", data.Header))106 // add predefined tags107 logIfTagExists(EventTypeKey, tags, b.Logger)108 tags[EventTypeKey] = EventNewBlockHeader109 b.pubsub.PublishWithTags(ctx, data, tags)110 return nil111}112func (b *EventBus) PublishEventVote(data EventDataVote) error {113 return b.Publish(EventVote, data)114}115func (b *EventBus) PublishEventValidBlock(data EventDataRoundState) error {116 return b.Publish(EventValidBlock, data)117}118// PublishEventTx publishes tx event with tags from Result. Note it will add119// predefined tags (EventTypeKey, TxHashKey). Existing tags with the same names120// will be overwritten.121func (b *EventBus) PublishEventTx(data EventDataTx) error {122 // no explicit deadline for publishing events123 ctx := context.Background()124 tags := b.validateAndStringifyTags(data.Result.Tags, b.Logger.With("tx", data.Tx))125 // add predefined tags126 logIfTagExists(EventTypeKey, tags, b.Logger)127 tags[EventTypeKey] = EventTx128 logIfTagExists(TxHashKey, tags, b.Logger)129 tags[TxHashKey] = fmt.Sprintf("%X", data.Tx.Hash())130 logIfTagExists(TxHeightKey, tags, b.Logger)131 tags[TxHeightKey] = fmt.Sprintf("%d", data.Height)132 b.pubsub.PublishWithTags(ctx, data, tags)133 return nil134}135func (b *EventBus) PublishEventNewRoundStep(data EventDataRoundState) error {136 return b.Publish(EventNewRoundStep, data)137}138func (b *EventBus) PublishEventTimeoutPropose(data EventDataRoundState) error {139 return b.Publish(EventTimeoutPropose, data)140}141func (b *EventBus) PublishEventTimeoutWait(data EventDataRoundState) error {142 return b.Publish(EventTimeoutWait, data)143}144func (b *EventBus) PublishEventNewRound(data EventDataNewRound) error {145 return b.Publish(EventNewRound, data)146}147func (b *EventBus) PublishEventCompleteProposal(data EventDataCompleteProposal) error {148 return b.Publish(EventCompleteProposal, data)149}150func (b *EventBus) PublishEventPolka(data EventDataRoundState) error {151 return b.Publish(EventPolka, data)152}153func (b *EventBus) PublishEventUnlock(data EventDataRoundState) error {154 return b.Publish(EventUnlock, data)155}156func (b *EventBus) PublishEventRelock(data EventDataRoundState) error {157 return b.Publish(EventRelock, data)158}159func (b *EventBus) PublishEventLock(data EventDataRoundState) error {160 return b.Publish(EventLock, data)161}162func (b *EventBus) PublishEventValidatorSetUpdates(data EventDataValidatorSetUpdates) error {163 return b.Publish(EventValidatorSetUpdates, data)164}165func logIfTagExists(tag string, tags map[string]string, logger log.Logger) {166 if value, ok := tags[tag]; ok {167 logger.Error("Found predefined tag (value will be overwritten)", "tag", tag, "value", value)168 }169}170//-----------------------------------------------------------------------------171type NopEventBus struct{}172func (NopEventBus) Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, out chan<- interface{}) error {173 return nil174}175func (NopEventBus) Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error {176 return nil177}178func (NopEventBus) UnsubscribeAll(ctx context.Context, subscriber string) error {179 return nil180}181func (NopEventBus) PublishEventNewBlock(data EventDataNewBlock) error {182 return nil183}184func (NopEventBus) PublishEventNewBlockHeader(data EventDataNewBlockHeader) error {185 return nil186}187func (NopEventBus) PublishEventVote(data EventDataVote) error {188 return nil189}190func (NopEventBus) PublishEventTx(data EventDataTx) error {191 return nil192}193func (NopEventBus) PublishEventNewRoundStep(data EventDataRoundState) error {194 return nil195}196func (NopEventBus) PublishEventTimeoutPropose(data EventDataRoundState) error {197 return nil198}199func (NopEventBus) PublishEventTimeoutWait(data EventDataRoundState) error {200 return nil201}202func (NopEventBus) PublishEventNewRound(data EventDataRoundState) error {203 return nil204}205func (NopEventBus) PublishEventCompleteProposal(data EventDataRoundState) error {206 return nil207}208func (NopEventBus) PublishEventPolka(data EventDataRoundState) error {209 return nil210}211func (NopEventBus) PublishEventUnlock(data EventDataRoundState) error {212 return nil213}214func (NopEventBus) PublishEventRelock(data EventDataRoundState) error {215 return nil216}217func (NopEventBus) PublishEventLock(data EventDataRoundState) error {218 return nil219}220func (NopEventBus) PublishEventValidatorSetUpdates(data EventDataValidatorSetUpdates) error {221 return nil222}...

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 config := cluster.NewConfig()4 brokers := []string{"localhost:9092"}5 topics := []string{"test"}6 consumer, err := cluster.NewConsumer(brokers, "test-group", topics, config)7 if err != nil {8 panic(err)9 }10 defer consumer.Close()11 go func() {12 for err := range consumer.Errors() {13 fmt.Println(err)14 }15 }()16 go func() {17 for note := range consumer.Notifications() {18 fmt.Println(note)19 }20 }()21 go func() {22 for {23 select {24 case msg, ok := <-consumer.Messages():25 if ok {26 fmt.Println("Message: ", string(msg.Value))27 }28 }29 }30 }()31 signals := make(chan os.Signal, 1)32 signal.Notify(signals, os.Interrupt)33}34import (35func main() {36 config := cluster.NewConfig()

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("hello world")4 golenv.Initialize()5 event := goltype.Event{6 EventID: goluuid.UUID(),7 Timestamp: goltime.Now(),8 }9 goltype.Publish(event)10}11import (12func main() {13 fmt.Println("hello world")14 golenv.Initialize()15 eventStream := goltype.Subscribe()16 for event := range eventStream {17 fmt.Println(event)18 }19}20import (21func main() {22 fmt.Println("hello world")23 golenv.Initialize()24 eventStream := goltype.Subscribe()25 for event := range eventStream {26 fmt.Println(event)27 }28}29import (30func main() {31 fmt.Println("hello world")32 golenv.Initialize()33 event := goltype.Event{34 EventID: goluuid.UUID(),35 Timestamp: goltime.Now(),36 }

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import "fmt"2type Event struct {3}4func (e *Event) Publish() {5 fmt.Println("Publishing event", e.Name)6}7func main() {8 e := Event{"Go Workshop", 101}9 e.Publish()10}

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2type Event struct {3}4type Observer interface {5 Notify()6}7type User struct {8}9func (u *User) Notify() {10 fmt.Println(u.name, "is notified")11}12func (e *Event) Attach(observer Observer) {13 e.observerList = append(e.observerList, observer)14}15func (e *Event) Detach(observer Observer) {16 for i, o := range e.observerList {17 if reflect.DeepEqual(o, observer) {18 e.observerList = append(e.observerList[:i], e.observerList[i+1:]...)19 }20 }21}22func (e *Event) Publish() {23 for _, observer := range e.observerList {24 observer.Notify()25 }26}27func main() {28 e := new(Event)29 u1 := new(User)30 u2 := new(User)31 e.Attach(u1)32 e.Attach(u2)33 e.Publish()34 e.Detach(u1)35 e.Publish()36}

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1func main() {2 event := NewEvent()3 event.Publish("Hello World")4}5func main() {6 event := NewEvent()7 event.Subscribe(func(message string) {8 fmt.Println(message)9 })10 event.Publish("Hello World")11}12func main() {13 event := NewEvent()14 handle := event.Subscribe(func(message string) {15 fmt.Println(message)16 })17 event.Unsubscribe(handle)18 event.Publish("Hello World")19}20func main() {21 event := NewEvent()22 event.Subscribe(func(message string) {23 fmt.Println(message)24 })25 event.Subscribe(func(message string) {26 fmt.Println(message)27 })28 event.UnsubscribeAll()29 event.Publish("Hello World")30}31func main() {32 event := NewEvent()33 event.Subscribe(func(message string) {34 fmt.Println(message)35 })36 event.Subscribe(func(message string) {37 fmt.Println(message)38 })39 event.UnsubscribeAll()40 event.Publish("Hello World")41}42func main() {43 event := NewEvent()44 event.Subscribe(func(message string) {45 fmt.Println(message)46 })47 event.Subscribe(func(message string) {48 fmt.Println(message)49 })50 event.UnsubscribeAll()51 event.Publish("Hello World")52}53func main() {54 event := NewEvent()55 event.Subscribe(func(message string) {56 fmt.Println(message)57 })58 event.Subscribe(func(message string) {59 fmt.Println(message)60 })61 event.UnsubscribeAll()62 event.Publish("Hello World")63}64func main() {65 event := NewEvent()66 event.Subscribe(func(message string) {

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 consumerGroup, err := sarama.NewConsumerGroupFromClient("my-consumer-group", real_consumer.Client)4 if err != nil {5 panic(err)6 }7 defer func() {8 if err := consumerGroup.Close(); err != nil {9 panic(err)10 }11 }()12 go func() {13 for err := range consumerGroup.Errors() {14 fmt.Println("Error:", err)15 }16 }()17 ctx := context.Background()18 for {19 handler := real_consumer.ConsumerGroupHandler{}20 err := consumerGroup.Consume(ctx, []string{"my-topic"}, handler)21 if err != nil {22 panic(err)23 }24 }25}26import (27func main() {28 consumerGroup, err := sarama.NewConsumerGroupFromClient("my-consumer-group", real_consumer.Client)29 if err != nil {30 panic(err)31 }32 defer func() {33 if err := consumerGroup.Close(); err != nil {34 panic(err)35 }36 }()37 go func() {38 for err := range consumerGroup.Errors() {39 fmt.Println("Error:", err)40 }41 }()42 ctx := context.Background()43 for {44 handler := real_consumer.ConsumerGroupHandler{}45 err := consumerGroup.Consume(ctx, []string{"my-topic"}, handler)46 if err != nil {47 panic(err)

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2var (3 event = new(Event)4type Event struct {5 Subscribers []func(interface{})6}7func (e *Event) Subscribe(subscriber func(interface{})) {8 e.Subscribers = append(e.Subscribers, subscriber)9}10func (e *Event) Publish(data interface{}) {11 for _, sub := range e.Subscribers {12 sub(data)13 }14}15func main() {16 event.Subscribe(func(data interface{}) {17 fmt.Println("Subscriber 1: ", data)18 })19 event.Subscribe(func(data interface{}) {20 fmt.Println("Subscriber 2: ", data)21 })22 event.Publish("Event fired")23 time.Sleep(time.Second)24}

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 e := event.New("test")4 e.AddHandler(func(m *sarama.ConsumerMessage) {5 fmt.Println("Message received: ", string(m.Value))6 })7 e.Start()8 e.Publish("This is a test message")9 time.Sleep(1 * time.Second)10 e.Stop()11 e1 := event.New("test")12 e1.AddHandler(func(m *sarama.ConsumerMessage) {13 fmt.Println("Message received: ", string(m.Value))14 })15 e1.Start()16 e1.Publish("This is a test message")17 time.Sleep(1 * time.Second)18 e1.Stop()19}

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2type Event struct {3 Payload interface{}4}5func (e *Event) Publish() {6 fmt.Printf("Event: %s, Payload: %v7}8func main() {9 e := Event{Type: "user.created", Payload: "User created at " + time.Now().Format(time.RFC3339)}10 e.Publish()11}

Full Screen

Full Screen

Publish

Using AI Code Generation

copy

Full Screen

1import (2type Event struct {3 data interface{}4 target interface{}5}6func (e *Event) Publish() {7 eventType := reflect.TypeOf(e)8 eventValue := reflect.ValueOf(e)9 targetType := reflect.TypeOf(e.target)10 targetValue := reflect.ValueOf(e.target)11 methodCount := targetValue.NumMethod()12 for i := 0; i < methodCount; i++ {13 method := targetValue.Method(i)14 methodType := targetType.Method(i)15 if len(methodName) > 2 && methodName[0:2] == "On" && methodType.Type.NumIn() == 1 {16 methodParamType := methodType.Type.In(0)17 if methodParamType == eventType {18 method.Call([]reflect.Value{eventValue})19 }20 }21 }22}23type Publisher struct {24}25func (p *Publisher) PublishEvent(e *Event) {26 e.Publish()27}28type Subscriber struct {29}30func (s *Subscriber) SubscribeToEvent(e *Event) {31 e.Subscribe(s)32}33func (s *Subscriber) OnEvent

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful