// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: proto/pbsubscribe/subscribe.proto package pbsubscribe import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" pbservice "github.com/hashicorp/consul/proto/pbservice" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" math "math" math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // Topic enumerates the supported event topics. type Topic int32 const ( Topic_Unknown Topic = 0 // ServiceHealth topic contains events for any changes to service health. Topic_ServiceHealth Topic = 1 // ServiceHealthConnect topic contains events for any changes to service // health for connect-enabled services. Topic_ServiceHealthConnect Topic = 2 ) var Topic_name = map[int32]string{ 0: "Unknown", 1: "ServiceHealth", 2: "ServiceHealthConnect", } var Topic_value = map[string]int32{ "Unknown": 0, "ServiceHealth": 1, "ServiceHealthConnect": 2, } func (x Topic) String() string { return proto.EnumName(Topic_name, int32(x)) } func (Topic) EnumDescriptor() ([]byte, []int) { return fileDescriptor_ab3eb8c810e315fb, []int{0} } type CatalogOp int32 const ( CatalogOp_Register CatalogOp = 0 CatalogOp_Deregister CatalogOp = 1 ) var CatalogOp_name = map[int32]string{ 0: "Register", 1: "Deregister", } var CatalogOp_value = map[string]int32{ "Register": 0, "Deregister": 1, } func (x CatalogOp) String() string { return proto.EnumName(CatalogOp_name, int32(x)) } func (CatalogOp) EnumDescriptor() ([]byte, []int) { return fileDescriptor_ab3eb8c810e315fb, []int{1} } // SubscribeRequest used to subscribe to a topic. type SubscribeRequest struct { // Topic identifies the set of events the subscriber is interested in. Topic Topic `protobuf:"varint,1,opt,name=Topic,proto3,enum=subscribe.Topic" json:"Topic,omitempty"` // Key is a topic-specific identifier that restricts the scope of the // subscription to only events pertaining to that identifier. For example, // to receive events for a single service, the service's name is // specified as the key. An empty key indicates that all events in the topic // are of interest. Key string `protobuf:"bytes,2,opt,name=Key,proto3" json:"Key,omitempty"` // Token is the ACL token to authenticate the request. The token must have // sufficient privileges to read the requested information otherwise events // will be filtered, possibly resulting in an empty snapshot and no further // updates sent. Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` // Index is the raft index the subscriber has already observed up to. This // is zero on an initial streaming call, but then can be provided by a // client on subsequent re-connections such that the full snapshot doesn't // need to be resent if the client is up to date. Index uint64 `protobuf:"varint,4,opt,name=Index,proto3" json:"Index,omitempty"` // Datacenter specifies the Consul datacenter the request is targeted at. // If it's not the local DC the server will forward the request to // the remote DC and proxy the results back to the subscriber. An empty // string defaults to the local datacenter. Datacenter string `protobuf:"bytes,5,opt,name=Datacenter,proto3" json:"Datacenter,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *SubscribeRequest) Reset() { *m = SubscribeRequest{} } func (m *SubscribeRequest) String() string { return proto.CompactTextString(m) } func (*SubscribeRequest) ProtoMessage() {} func (*SubscribeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ab3eb8c810e315fb, []int{0} } func (m *SubscribeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *SubscribeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_SubscribeRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *SubscribeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_SubscribeRequest.Merge(m, src) } func (m *SubscribeRequest) XXX_Size() int { return m.Size() } func (m *SubscribeRequest) XXX_DiscardUnknown() { xxx_messageInfo_SubscribeRequest.DiscardUnknown(m) } var xxx_messageInfo_SubscribeRequest proto.InternalMessageInfo func (m *SubscribeRequest) GetTopic() Topic { if m != nil { return m.Topic } return Topic_Unknown } func (m *SubscribeRequest) GetKey() string { if m != nil { return m.Key } return "" } func (m *SubscribeRequest) GetToken() string { if m != nil { return m.Token } return "" } func (m *SubscribeRequest) GetIndex() uint64 { if m != nil { return m.Index } return 0 } func (m *SubscribeRequest) GetDatacenter() string { if m != nil { return m.Datacenter } return "" } // Event describes a streaming update on a subscription. Events are used both to // describe the current "snapshot" of the result as well as ongoing mutations to // that snapshot. type Event struct { // Topic the event was published to Topic Topic `protobuf:"varint,1,opt,name=Topic,proto3,enum=subscribe.Topic" json:"Topic,omitempty"` // Key is the logical identifier for the entity that was mutated. Key string `protobuf:"bytes,2,opt,name=Key,proto3" json:"Key,omitempty"` // Index is the raft index at which the mutation took place. At the top // level of a subscription there will always be at most one Event per index. // If multiple events are published to the same topic in a single raft // transaction then the batch of events will be encoded inside a single // top-level event to ensure they are delivered atomically to clients. Index uint64 `protobuf:"varint,3,opt,name=Index,proto3" json:"Index,omitempty"` // Payload is the actual event content. // // Types that are valid to be assigned to Payload: // *Event_EndOfSnapshot // *Event_NewSnapshotToFollow // *Event_EventBatch // *Event_ServiceHealth Payload isEvent_Payload `protobuf_oneof:"Payload"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *Event) Reset() { *m = Event{} } func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func (*Event) Descriptor() ([]byte, []int) { return fileDescriptor_ab3eb8c810e315fb, []int{1} } func (m *Event) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Event.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *Event) XXX_Merge(src proto.Message) { xxx_messageInfo_Event.Merge(m, src) } func (m *Event) XXX_Size() int { return m.Size() } func (m *Event) XXX_DiscardUnknown() { xxx_messageInfo_Event.DiscardUnknown(m) } var xxx_messageInfo_Event proto.InternalMessageInfo type isEvent_Payload interface { isEvent_Payload() MarshalTo([]byte) (int, error) Size() int } type Event_EndOfSnapshot struct { EndOfSnapshot bool `protobuf:"varint,5,opt,name=EndOfSnapshot,proto3,oneof"` } type Event_NewSnapshotToFollow struct { NewSnapshotToFollow bool `protobuf:"varint,6,opt,name=NewSnapshotToFollow,proto3,oneof"` } type Event_EventBatch struct { EventBatch *EventBatch `protobuf:"bytes,7,opt,name=EventBatch,proto3,oneof"` } type Event_ServiceHealth struct { ServiceHealth *ServiceHealthUpdate `protobuf:"bytes,10,opt,name=ServiceHealth,proto3,oneof"` } func (*Event_EndOfSnapshot) isEvent_Payload() {} func (*Event_NewSnapshotToFollow) isEvent_Payload() {} func (*Event_EventBatch) isEvent_Payload() {} func (*Event_ServiceHealth) isEvent_Payload() {} func (m *Event) GetPayload() isEvent_Payload { if m != nil { return m.Payload } return nil } func (m *Event) GetTopic() Topic { if m != nil { return m.Topic } return Topic_Unknown } func (m *Event) GetKey() string { if m != nil { return m.Key } return "" } func (m *Event) GetIndex() uint64 { if m != nil { return m.Index } return 0 } func (m *Event) GetEndOfSnapshot() bool { if x, ok := m.GetPayload().(*Event_EndOfSnapshot); ok { return x.EndOfSnapshot } return false } func (m *Event) GetNewSnapshotToFollow() bool { if x, ok := m.GetPayload().(*Event_NewSnapshotToFollow); ok { return x.NewSnapshotToFollow } return false } func (m *Event) GetEventBatch() *EventBatch { if x, ok := m.GetPayload().(*Event_EventBatch); ok { return x.EventBatch } return nil } func (m *Event) GetServiceHealth() *ServiceHealthUpdate { if x, ok := m.GetPayload().(*Event_ServiceHealth); ok { return x.ServiceHealth } return nil } // XXX_OneofFuncs is for the internal use of the proto package. func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{ (*Event_EndOfSnapshot)(nil), (*Event_NewSnapshotToFollow)(nil), (*Event_EventBatch)(nil), (*Event_ServiceHealth)(nil), } } func _Event_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { m := msg.(*Event) // Payload switch x := m.Payload.(type) { case *Event_EndOfSnapshot: t := uint64(0) if x.EndOfSnapshot { t = 1 } _ = b.EncodeVarint(5<<3 | proto.WireVarint) _ = b.EncodeVarint(t) case *Event_NewSnapshotToFollow: t := uint64(0) if x.NewSnapshotToFollow { t = 1 } _ = b.EncodeVarint(6<<3 | proto.WireVarint) _ = b.EncodeVarint(t) case *Event_EventBatch: _ = b.EncodeVarint(7<<3 | proto.WireBytes) if err := b.EncodeMessage(x.EventBatch); err != nil { return err } case *Event_ServiceHealth: _ = b.EncodeVarint(10<<3 | proto.WireBytes) if err := b.EncodeMessage(x.ServiceHealth); err != nil { return err } case nil: default: return fmt.Errorf("Event.Payload has unexpected type %T", x) } return nil } func _Event_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { m := msg.(*Event) switch tag { case 5: // Payload.EndOfSnapshot if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Payload = &Event_EndOfSnapshot{x != 0} return true, err case 6: // Payload.NewSnapshotToFollow if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Payload = &Event_NewSnapshotToFollow{x != 0} return true, err case 7: // Payload.EventBatch if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } msg := new(EventBatch) err := b.DecodeMessage(msg) m.Payload = &Event_EventBatch{msg} return true, err case 10: // Payload.ServiceHealth if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } msg := new(ServiceHealthUpdate) err := b.DecodeMessage(msg) m.Payload = &Event_ServiceHealth{msg} return true, err default: return false, nil } } func _Event_OneofSizer(msg proto.Message) (n int) { m := msg.(*Event) // Payload switch x := m.Payload.(type) { case *Event_EndOfSnapshot: n += 1 // tag and wire n += 1 case *Event_NewSnapshotToFollow: n += 1 // tag and wire n += 1 case *Event_EventBatch: s := proto.Size(x.EventBatch) n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *Event_ServiceHealth: s := proto.Size(x.ServiceHealth) n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) } return n } type EventBatch struct { Events []*Event `protobuf:"bytes,1,rep,name=Events,proto3" json:"Events,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *EventBatch) Reset() { *m = EventBatch{} } func (m *EventBatch) String() string { return proto.CompactTextString(m) } func (*EventBatch) ProtoMessage() {} func (*EventBatch) Descriptor() ([]byte, []int) { return fileDescriptor_ab3eb8c810e315fb, []int{2} } func (m *EventBatch) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *EventBatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventBatch.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *EventBatch) XXX_Merge(src proto.Message) { xxx_messageInfo_EventBatch.Merge(m, src) } func (m *EventBatch) XXX_Size() int { return m.Size() } func (m *EventBatch) XXX_DiscardUnknown() { xxx_messageInfo_EventBatch.DiscardUnknown(m) } var xxx_messageInfo_EventBatch proto.InternalMessageInfo func (m *EventBatch) GetEvents() []*Event { if m != nil { return m.Events } return nil } type ServiceHealthUpdate struct { Op CatalogOp `protobuf:"varint,1,opt,name=Op,proto3,enum=subscribe.CatalogOp" json:"Op,omitempty"` CheckServiceNode *pbservice.CheckServiceNode `protobuf:"bytes,2,opt,name=CheckServiceNode,proto3" json:"CheckServiceNode,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *ServiceHealthUpdate) Reset() { *m = ServiceHealthUpdate{} } func (m *ServiceHealthUpdate) String() string { return proto.CompactTextString(m) } func (*ServiceHealthUpdate) ProtoMessage() {} func (*ServiceHealthUpdate) Descriptor() ([]byte, []int) { return fileDescriptor_ab3eb8c810e315fb, []int{3} } func (m *ServiceHealthUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ServiceHealthUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ServiceHealthUpdate.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ServiceHealthUpdate) XXX_Merge(src proto.Message) { xxx_messageInfo_ServiceHealthUpdate.Merge(m, src) } func (m *ServiceHealthUpdate) XXX_Size() int { return m.Size() } func (m *ServiceHealthUpdate) XXX_DiscardUnknown() { xxx_messageInfo_ServiceHealthUpdate.DiscardUnknown(m) } var xxx_messageInfo_ServiceHealthUpdate proto.InternalMessageInfo func (m *ServiceHealthUpdate) GetOp() CatalogOp { if m != nil { return m.Op } return CatalogOp_Register } func (m *ServiceHealthUpdate) GetCheckServiceNode() *pbservice.CheckServiceNode { if m != nil { return m.CheckServiceNode } return nil } func init() { proto.RegisterEnum("subscribe.Topic", Topic_name, Topic_value) proto.RegisterEnum("subscribe.CatalogOp", CatalogOp_name, CatalogOp_value) proto.RegisterType((*SubscribeRequest)(nil), "subscribe.SubscribeRequest") proto.RegisterType((*Event)(nil), "subscribe.Event") proto.RegisterType((*EventBatch)(nil), "subscribe.EventBatch") proto.RegisterType((*ServiceHealthUpdate)(nil), "subscribe.ServiceHealthUpdate") } func init() { proto.RegisterFile("proto/pbsubscribe/subscribe.proto", fileDescriptor_ab3eb8c810e315fb) } var fileDescriptor_ab3eb8c810e315fb = []byte{ // 526 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x5f, 0x6f, 0xd2, 0x50, 0x14, 0xef, 0x85, 0x01, 0xe3, 0xe0, 0x96, 0x7a, 0x87, 0xb1, 0x61, 0x49, 0x83, 0xc4, 0x2c, 0x75, 0x89, 0xd4, 0x60, 0xa2, 0x6f, 0x1a, 0x61, 0x9b, 0x18, 0x93, 0x61, 0xca, 0xf6, 0xa0, 0x6f, 0x97, 0xf6, 0x48, 0x1b, 0xea, 0xbd, 0xb5, 0xbd, 0x0c, 0xf7, 0xee, 0x87, 0xd8, 0xb7, 0xf1, 0xd5, 0x47, 0x3f, 0x82, 0xc1, 0x2f, 0x62, 0xb8, 0x94, 0xae, 0xc0, 0xde, 0xf6, 0xd6, 0xf3, 0xfb, 0x73, 0xcf, 0x2f, 0xe7, 0xf4, 0xc0, 0x93, 0x28, 0x16, 0x52, 0xd8, 0xd1, 0x28, 0x99, 0x8e, 0x12, 0x37, 0x0e, 0x46, 0x68, 0x67, 0x5f, 0x6d, 0xc5, 0xd1, 0x6a, 0x06, 0x34, 0x1a, 0x99, 0x1a, 0xe3, 0xab, 0xc0, 0x45, 0x9b, 0x0b, 0x2f, 0x95, 0xb5, 0x6e, 0x08, 0xe8, 0xc3, 0x95, 0xd2, 0xc1, 0xef, 0x53, 0x4c, 0x24, 0x3d, 0x82, 0xd2, 0x85, 0x88, 0x02, 0xd7, 0x20, 0x4d, 0x62, 0xed, 0x77, 0xf4, 0xf6, 0xed, 0xe3, 0x0a, 0x77, 0x96, 0x34, 0xd5, 0xa1, 0xf8, 0x11, 0xaf, 0x8d, 0x42, 0x93, 0x58, 0x55, 0x67, 0xf1, 0x49, 0xeb, 0x0b, 0xe7, 0x04, 0xb9, 0x51, 0x54, 0xd8, 0xb2, 0x58, 0xa0, 0x1f, 0xb8, 0x87, 0x3f, 0x8c, 0x9d, 0x26, 0xb1, 0x76, 0x9c, 0x65, 0x41, 0x4d, 0x80, 0x13, 0x26, 0x99, 0x8b, 0x5c, 0x62, 0x6c, 0x94, 0x94, 0x21, 0x87, 0xb4, 0x7e, 0x15, 0xa0, 0x74, 0x7a, 0x85, 0xfc, 0x9e, 0x79, 0x96, 0x9d, 0x8b, 0xf9, 0xce, 0x47, 0xb0, 0x77, 0xca, 0xbd, 0xc1, 0xd7, 0x21, 0x67, 0x51, 0xe2, 0x0b, 0xa9, 0x9a, 0xef, 0xf6, 0x35, 0x67, 0x1d, 0xa6, 0x1d, 0x38, 0x38, 0xc7, 0xd9, 0xaa, 0xbc, 0x10, 0x67, 0x22, 0x0c, 0xc5, 0xcc, 0x28, 0xa7, 0xea, 0xbb, 0x48, 0xfa, 0x1a, 0x40, 0x85, 0xee, 0x32, 0xe9, 0xfa, 0x46, 0xa5, 0x49, 0xac, 0x5a, 0xe7, 0x51, 0x2e, 0xf0, 0x2d, 0xd9, 0xd7, 0x9c, 0x9c, 0x94, 0x9e, 0xc1, 0xde, 0x70, 0xb9, 0x9f, 0x3e, 0xb2, 0x50, 0xfa, 0x06, 0x28, 0xaf, 0x99, 0xf3, 0xae, 0xf1, 0x97, 0x91, 0xc7, 0x24, 0x2e, 0x42, 0xaf, 0xc1, 0xdd, 0x2a, 0x54, 0x3e, 0xb1, 0xeb, 0x50, 0x30, 0xaf, 0xf5, 0x2a, 0x9f, 0x85, 0x5a, 0x50, 0x56, 0x55, 0x62, 0x90, 0x66, 0xd1, 0xaa, 0xad, 0x8d, 0x51, 0x11, 0x4e, 0xca, 0xb7, 0x7e, 0x12, 0x38, 0xb8, 0xa3, 0x17, 0x7d, 0x0a, 0x85, 0x41, 0x94, 0x2e, 0xa1, 0x9e, 0x73, 0xf7, 0x98, 0x64, 0xa1, 0x18, 0x0f, 0x22, 0xa7, 0x30, 0x88, 0xe8, 0x7b, 0xd0, 0x7b, 0x3e, 0xba, 0x93, 0xf4, 0x85, 0x73, 0xe1, 0xa1, 0x5a, 0x49, 0xad, 0x73, 0xd8, 0xce, 0xfe, 0xc1, 0xf6, 0xa6, 0xc4, 0xd9, 0x32, 0x1d, 0xbf, 0x4b, 0xd7, 0x4e, 0x6b, 0x50, 0xb9, 0xe4, 0x13, 0x2e, 0x66, 0x5c, 0xd7, 0xe8, 0xc3, 0x8d, 0x39, 0xe9, 0x84, 0x1a, 0x50, 0x5f, 0x83, 0x7a, 0x82, 0x73, 0x74, 0xa5, 0x5e, 0x38, 0x7e, 0x06, 0xd5, 0x2c, 0x1c, 0x7d, 0x00, 0xbb, 0x0e, 0x8e, 0x83, 0x44, 0x62, 0xac, 0x6b, 0x74, 0x1f, 0xe0, 0x04, 0xe3, 0x55, 0x4d, 0x3a, 0x9f, 0xe1, 0xf1, 0x50, 0x32, 0x89, 0x3d, 0x9f, 0xf1, 0x31, 0xa6, 0x37, 0x11, 0xc9, 0x40, 0x70, 0xfa, 0x06, 0xaa, 0xd9, 0x8d, 0xd0, 0xc3, 0xfc, 0x42, 0x36, 0x2e, 0xa7, 0xb1, 0x35, 0xd3, 0x96, 0xf6, 0x82, 0x74, 0xdf, 0xfe, 0x9e, 0x9b, 0xe4, 0xcf, 0xdc, 0x24, 0x7f, 0xe7, 0x26, 0xb9, 0xf9, 0x67, 0x6a, 0x5f, 0x9e, 0x8f, 0x03, 0xe9, 0x4f, 0x47, 0x6d, 0x57, 0x7c, 0xb3, 0x7d, 0x96, 0xf8, 0x81, 0x2b, 0xe2, 0xc8, 0x76, 0x05, 0x4f, 0xa6, 0xa1, 0xbd, 0x75, 0xdc, 0xa3, 0xb2, 0x82, 0x5e, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x44, 0xbc, 0x0a, 0xfb, 0xf8, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 // StateChangeSubscriptionClient is the client API for StateChangeSubscription service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type StateChangeSubscriptionClient interface { // Subscribe to a topic to receive events when there are changes to the topic. // // If SubscribeRequest.Index is 0 the event stream will start with one or // more snapshot events, followed by an EndOfSnapshot event. Subsequent // events will be a live stream of events as they happen. // // If SubscribeRequest.Index is > 0 it is assumed the client already has a // snapshot, and is trying to resume a stream that was disconnected. The // client will either receive a NewSnapshotToFollow event, indicating the // client view is stale and it must reset its view and prepare for a new // snapshot. Or, if no NewSnapshotToFollow event is received, the client // view is still fresh, and all events will be the live stream. // // Subscribe may return a gRPC status error with codes.ABORTED to indicate // the client view is now stale due to a change on the server. The client // must reset its view and issue a new Subscribe call to restart the stream. // This error is used when the server can no longer correctly maintain the // stream, for example because the ACL permissions for the token changed, or // because the server state was restored from a snapshot. Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (StateChangeSubscription_SubscribeClient, error) } type stateChangeSubscriptionClient struct { cc *grpc.ClientConn } func NewStateChangeSubscriptionClient(cc *grpc.ClientConn) StateChangeSubscriptionClient { return &stateChangeSubscriptionClient{cc} } func (c *stateChangeSubscriptionClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (StateChangeSubscription_SubscribeClient, error) { stream, err := c.cc.NewStream(ctx, &_StateChangeSubscription_serviceDesc.Streams[0], "/subscribe.StateChangeSubscription/Subscribe", opts...) if err != nil { return nil, err } x := &stateChangeSubscriptionSubscribeClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } type StateChangeSubscription_SubscribeClient interface { Recv() (*Event, error) grpc.ClientStream } type stateChangeSubscriptionSubscribeClient struct { grpc.ClientStream } func (x *stateChangeSubscriptionSubscribeClient) Recv() (*Event, error) { m := new(Event) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } // StateChangeSubscriptionServer is the server API for StateChangeSubscription service. type StateChangeSubscriptionServer interface { // Subscribe to a topic to receive events when there are changes to the topic. // // If SubscribeRequest.Index is 0 the event stream will start with one or // more snapshot events, followed by an EndOfSnapshot event. Subsequent // events will be a live stream of events as they happen. // // If SubscribeRequest.Index is > 0 it is assumed the client already has a // snapshot, and is trying to resume a stream that was disconnected. The // client will either receive a NewSnapshotToFollow event, indicating the // client view is stale and it must reset its view and prepare for a new // snapshot. Or, if no NewSnapshotToFollow event is received, the client // view is still fresh, and all events will be the live stream. // // Subscribe may return a gRPC status error with codes.ABORTED to indicate // the client view is now stale due to a change on the server. The client // must reset its view and issue a new Subscribe call to restart the stream. // This error is used when the server can no longer correctly maintain the // stream, for example because the ACL permissions for the token changed, or // because the server state was restored from a snapshot. Subscribe(*SubscribeRequest, StateChangeSubscription_SubscribeServer) error } // UnimplementedStateChangeSubscriptionServer can be embedded to have forward compatible implementations. type UnimplementedStateChangeSubscriptionServer struct { } func (*UnimplementedStateChangeSubscriptionServer) Subscribe(req *SubscribeRequest, srv StateChangeSubscription_SubscribeServer) error { return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") } func RegisterStateChangeSubscriptionServer(s *grpc.Server, srv StateChangeSubscriptionServer) { s.RegisterService(&_StateChangeSubscription_serviceDesc, srv) } func _StateChangeSubscription_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(SubscribeRequest) if err := stream.RecvMsg(m); err != nil { return err } return srv.(StateChangeSubscriptionServer).Subscribe(m, &stateChangeSubscriptionSubscribeServer{stream}) } type StateChangeSubscription_SubscribeServer interface { Send(*Event) error grpc.ServerStream } type stateChangeSubscriptionSubscribeServer struct { grpc.ServerStream } func (x *stateChangeSubscriptionSubscribeServer) Send(m *Event) error { return x.ServerStream.SendMsg(m) } var _StateChangeSubscription_serviceDesc = grpc.ServiceDesc{ ServiceName: "subscribe.StateChangeSubscription", HandlerType: (*StateChangeSubscriptionServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Subscribe", Handler: _StateChangeSubscription_Subscribe_Handler, ServerStreams: true, }, }, Metadata: "proto/pbsubscribe/subscribe.proto", } func (m *SubscribeRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *SubscribeRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *SubscribeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Datacenter) > 0 { i -= len(m.Datacenter) copy(dAtA[i:], m.Datacenter) i = encodeVarintSubscribe(dAtA, i, uint64(len(m.Datacenter))) i-- dAtA[i] = 0x2a } if m.Index != 0 { i = encodeVarintSubscribe(dAtA, i, uint64(m.Index)) i-- dAtA[i] = 0x20 } if len(m.Token) > 0 { i -= len(m.Token) copy(dAtA[i:], m.Token) i = encodeVarintSubscribe(dAtA, i, uint64(len(m.Token))) i-- dAtA[i] = 0x1a } if len(m.Key) > 0 { i -= len(m.Key) copy(dAtA[i:], m.Key) i = encodeVarintSubscribe(dAtA, i, uint64(len(m.Key))) i-- dAtA[i] = 0x12 } if m.Topic != 0 { i = encodeVarintSubscribe(dAtA, i, uint64(m.Topic)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *Event) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *Event) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } if m.Payload != nil { { size := m.Payload.Size() i -= size if _, err := m.Payload.MarshalTo(dAtA[i:]); err != nil { return 0, err } } } if m.Index != 0 { i = encodeVarintSubscribe(dAtA, i, uint64(m.Index)) i-- dAtA[i] = 0x18 } if len(m.Key) > 0 { i -= len(m.Key) copy(dAtA[i:], m.Key) i = encodeVarintSubscribe(dAtA, i, uint64(len(m.Key))) i-- dAtA[i] = 0x12 } if m.Topic != 0 { i = encodeVarintSubscribe(dAtA, i, uint64(m.Topic)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *Event_EndOfSnapshot) MarshalTo(dAtA []byte) (int, error) { return m.MarshalToSizedBuffer(dAtA[:m.Size()]) } func (m *Event_EndOfSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) i-- if m.EndOfSnapshot { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x28 return len(dAtA) - i, nil } func (m *Event_NewSnapshotToFollow) MarshalTo(dAtA []byte) (int, error) { return m.MarshalToSizedBuffer(dAtA[:m.Size()]) } func (m *Event_NewSnapshotToFollow) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) i-- if m.NewSnapshotToFollow { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x30 return len(dAtA) - i, nil } func (m *Event_EventBatch) MarshalTo(dAtA []byte) (int, error) { return m.MarshalToSizedBuffer(dAtA[:m.Size()]) } func (m *Event_EventBatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.EventBatch != nil { { size, err := m.EventBatch.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintSubscribe(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x3a } return len(dAtA) - i, nil } func (m *Event_ServiceHealth) MarshalTo(dAtA []byte) (int, error) { return m.MarshalToSizedBuffer(dAtA[:m.Size()]) } func (m *Event_ServiceHealth) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.ServiceHealth != nil { { size, err := m.ServiceHealth.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintSubscribe(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x52 } return len(dAtA) - i, nil } func (m *EventBatch) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *EventBatch) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *EventBatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Events) > 0 { for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintSubscribe(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *ServiceHealthUpdate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ServiceHealthUpdate) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ServiceHealthUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } if m.CheckServiceNode != nil { { size, err := m.CheckServiceNode.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintSubscribe(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } if m.Op != 0 { i = encodeVarintSubscribe(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func encodeVarintSubscribe(dAtA []byte, offset int, v uint64) int { offset -= sovSubscribe(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *SubscribeRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Topic != 0 { n += 1 + sovSubscribe(uint64(m.Topic)) } l = len(m.Key) if l > 0 { n += 1 + l + sovSubscribe(uint64(l)) } l = len(m.Token) if l > 0 { n += 1 + l + sovSubscribe(uint64(l)) } if m.Index != 0 { n += 1 + sovSubscribe(uint64(m.Index)) } l = len(m.Datacenter) if l > 0 { n += 1 + l + sovSubscribe(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Event) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Topic != 0 { n += 1 + sovSubscribe(uint64(m.Topic)) } l = len(m.Key) if l > 0 { n += 1 + l + sovSubscribe(uint64(l)) } if m.Index != 0 { n += 1 + sovSubscribe(uint64(m.Index)) } if m.Payload != nil { n += m.Payload.Size() } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Event_EndOfSnapshot) Size() (n int) { if m == nil { return 0 } var l int _ = l n += 2 return n } func (m *Event_NewSnapshotToFollow) Size() (n int) { if m == nil { return 0 } var l int _ = l n += 2 return n } func (m *Event_EventBatch) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.EventBatch != nil { l = m.EventBatch.Size() n += 1 + l + sovSubscribe(uint64(l)) } return n } func (m *Event_ServiceHealth) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.ServiceHealth != nil { l = m.ServiceHealth.Size() n += 1 + l + sovSubscribe(uint64(l)) } return n } func (m *EventBatch) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.Events) > 0 { for _, e := range m.Events { l = e.Size() n += 1 + l + sovSubscribe(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ServiceHealthUpdate) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovSubscribe(uint64(m.Op)) } if m.CheckServiceNode != nil { l = m.CheckServiceNode.Size() n += 1 + l + sovSubscribe(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func sovSubscribe(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozSubscribe(x uint64) (n int) { return sovSubscribe(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *SubscribeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: SubscribeRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: SubscribeRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) } m.Topic = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Topic |= Topic(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } m.Key = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } m.Token = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } m.Index = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Datacenter", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } m.Datacenter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSubscribe(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *Event) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: Event: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) } m.Topic = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Topic |= Topic(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } m.Key = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } m.Index = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EndOfSnapshot", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Payload = &Event_EndOfSnapshot{b} case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NewSnapshotToFollow", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Payload = &Event_NewSnapshotToFollow{b} case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EventBatch", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } v := &EventBatch{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } m.Payload = &Event_EventBatch{v} iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ServiceHealth", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } v := &ServiceHealthUpdate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } m.Payload = &Event_ServiceHealth{v} iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSubscribe(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *EventBatch) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: EventBatch: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: EventBatch: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } m.Events = append(m.Events, &Event{}) if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSubscribe(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ServiceHealthUpdate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ServiceHealthUpdate: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ServiceHealthUpdate: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= CatalogOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CheckServiceNode", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSubscribe } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthSubscribe } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthSubscribe } if postIndex > l { return io.ErrUnexpectedEOF } if m.CheckServiceNode == nil { m.CheckServiceNode = &pbservice.CheckServiceNode{} } if err := m.CheckServiceNode.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSubscribe(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) < 0 { return ErrInvalidLengthSubscribe } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipSubscribe(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowSubscribe } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowSubscribe } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowSubscribe } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthSubscribe } iNdEx += length if iNdEx < 0 { return 0, ErrInvalidLengthSubscribe } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowSubscribe } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ innerWire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } innerWireType := int(innerWire & 0x7) if innerWireType == 4 { break } next, err := skipSubscribe(dAtA[start:]) if err != nil { return 0, err } iNdEx = start + next if iNdEx < 0 { return 0, ErrInvalidLengthSubscribe } } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthSubscribe = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSubscribe = fmt.Errorf("proto: integer overflow") )