// 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.ProtoPackageIsVersion3 // 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. 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"` // Namespace which contains the resources. If Namespace is not specified the // default namespace will be used. // // Namespace is an enterprise-only feature. Namespace string `protobuf:"bytes,6,opt,name=Namespace,proto3" json:"Namespace,omitempty"` // Partition which contains the resources. If Partition is not specified the // default partition will be used. // // Partition is an enterprise-only feature. Partition string `protobuf:"bytes,7,opt,name=Partition,proto3" json:"Partition,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 "" } func (m *SubscribeRequest) GetNamespace() string { if m != nil { return m.Namespace } return "" } func (m *SubscribeRequest) GetPartition() string { if m != nil { return m.Partition } 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 { // 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,1,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,2,opt,name=EndOfSnapshot,proto3,oneof" json:"EndOfSnapshot,omitempty"` } type Event_NewSnapshotToFollow struct { NewSnapshotToFollow bool `protobuf:"varint,3,opt,name=NewSnapshotToFollow,proto3,oneof" json:"NewSnapshotToFollow,omitempty"` } type Event_EventBatch struct { EventBatch *EventBatch `protobuf:"bytes,4,opt,name=EventBatch,proto3,oneof" json:"EventBatch,omitempty"` } type Event_ServiceHealth struct { ServiceHealth *ServiceHealthUpdate `protobuf:"bytes,10,opt,name=ServiceHealth,proto3,oneof" json:"ServiceHealth,omitempty"` } 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) 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_OneofWrappers is for the internal use of the proto package. func (*Event) XXX_OneofWrappers() []interface{} { return []interface{}{ (*Event_EndOfSnapshot)(nil), (*Event_NewSnapshotToFollow)(nil), (*Event_EventBatch)(nil), (*Event_ServiceHealth)(nil), } } 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{ // 550 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0xcb, 0x6e, 0xd3, 0x4c, 0x14, 0xf6, 0xa4, 0x57, 0x9f, 0xfc, 0xad, 0xfc, 0x4f, 0x83, 0xb0, 0x52, 0x64, 0x85, 0x08, 0x55, 0xa1, 0x12, 0x31, 0x0a, 0x12, 0xec, 0x40, 0x24, 0x6d, 0x09, 0x42, 0x4a, 0x2a, 0xa7, 0x5d, 0xc0, 0x6e, 0x62, 0x1f, 0x62, 0x2b, 0xee, 0x8c, 0xb1, 0x27, 0x0d, 0xdd, 0xc3, 0x3b, 0xf0, 0x48, 0x2c, 0x59, 0xf0, 0x00, 0x28, 0xbc, 0x08, 0xf2, 0xc4, 0x71, 0x9c, 0xa4, 0xbb, 0x39, 0xdf, 0x65, 0xce, 0xcc, 0xb9, 0xc0, 0xe3, 0x28, 0x16, 0x52, 0xd8, 0xd1, 0x30, 0x99, 0x0c, 0x13, 0x37, 0x0e, 0x86, 0x68, 0xe7, 0xa7, 0xa6, 0xe2, 0xa8, 0x9e, 0x03, 0xd5, 0x6a, 0xae, 0xc6, 0xf8, 0x36, 0x70, 0xd1, 0xe6, 0xc2, 0xcb, 0x64, 0xf5, 0xdf, 0x04, 0x8c, 0xc1, 0x42, 0xe9, 0xe0, 0x97, 0x09, 0x26, 0x92, 0x9e, 0xc0, 0xce, 0x95, 0x88, 0x02, 0xd7, 0x24, 0x35, 0xd2, 0x38, 0x6c, 0x19, 0xcd, 0xe5, 0xe5, 0x0a, 0x77, 0xe6, 0x34, 0x35, 0x60, 0xeb, 0x03, 0xde, 0x99, 0xa5, 0x1a, 0x69, 0xe8, 0x4e, 0x7a, 0xa4, 0x95, 0xd4, 0x39, 0x46, 0x6e, 0x6e, 0x29, 0x6c, 0x1e, 0xa4, 0xe8, 0x7b, 0xee, 0xe1, 0x57, 0x73, 0xbb, 0x46, 0x1a, 0xdb, 0xce, 0x3c, 0xa0, 0x16, 0xc0, 0x19, 0x93, 0xcc, 0x45, 0x2e, 0x31, 0x36, 0x77, 0x94, 0xa1, 0x80, 0xd0, 0x47, 0xa0, 0xf7, 0xd8, 0x0d, 0x26, 0x11, 0x73, 0xd1, 0xdc, 0x55, 0xf4, 0x12, 0x48, 0xd9, 0x4b, 0x16, 0xcb, 0x40, 0x06, 0x82, 0x9b, 0x7b, 0x73, 0x36, 0x07, 0xea, 0xdf, 0x4b, 0xb0, 0x73, 0x7e, 0x8b, 0x5c, 0x2e, 0x73, 0x93, 0x62, 0xee, 0x13, 0x38, 0x38, 0xe7, 0x5e, 0xff, 0xf3, 0x80, 0xb3, 0x28, 0xf1, 0x85, 0x54, 0x7f, 0xd8, 0xef, 0x6a, 0xce, 0x2a, 0x4c, 0x5b, 0x70, 0xd4, 0xc3, 0xe9, 0x22, 0xbc, 0x12, 0x17, 0x22, 0x0c, 0xc5, 0x54, 0xfd, 0x2e, 0x55, 0xdf, 0x47, 0xd2, 0x57, 0x00, 0x2a, 0x75, 0x9b, 0x49, 0xd7, 0x57, 0x5f, 0x2e, 0xb7, 0x1e, 0x14, 0x4a, 0xb8, 0x24, 0xbb, 0x9a, 0x53, 0x90, 0xd2, 0x0b, 0x38, 0x18, 0xcc, 0x3b, 0xd4, 0x45, 0x16, 0x4a, 0xdf, 0x04, 0xe5, 0xb5, 0x0a, 0xde, 0x15, 0xfe, 0x3a, 0xf2, 0x98, 0xc4, 0xf4, 0xd1, 0x2b, 0x70, 0x5b, 0x87, 0xbd, 0x4b, 0x76, 0x17, 0x0a, 0xe6, 0xd5, 0x5f, 0x16, 0xdf, 0x42, 0x1b, 0xb0, 0xab, 0xa2, 0xc4, 0x24, 0xb5, 0xad, 0x46, 0x79, 0xa5, 0xb1, 0x8a, 0x70, 0x32, 0xbe, 0xfe, 0x8d, 0xc0, 0xd1, 0x3d, 0xb9, 0xe8, 0x13, 0x28, 0xf5, 0xa3, 0x6c, 0x2c, 0x2a, 0x05, 0x77, 0x87, 0x49, 0x16, 0x8a, 0x51, 0x3f, 0x72, 0x4a, 0xfd, 0x88, 0xbe, 0x03, 0xa3, 0xe3, 0xa3, 0x3b, 0xce, 0x6e, 0xe8, 0x09, 0x0f, 0x55, 0x81, 0xcb, 0xad, 0xe3, 0x66, 0x3e, 0x85, 0xcd, 0x75, 0x89, 0xb3, 0x61, 0x3a, 0x7d, 0x9b, 0x0d, 0x22, 0x2d, 0xc3, 0xde, 0x35, 0x1f, 0x73, 0x31, 0xe5, 0x86, 0x46, 0xff, 0x5f, 0xab, 0x93, 0x41, 0xa8, 0x09, 0x95, 0x15, 0xa8, 0x23, 0x38, 0x47, 0x57, 0x1a, 0xa5, 0xd3, 0xa7, 0xa0, 0xe7, 0x8f, 0xa3, 0xff, 0xc1, 0xbe, 0x83, 0xa3, 0x20, 0x91, 0x18, 0x1b, 0x1a, 0x3d, 0x04, 0x38, 0xc3, 0x78, 0x11, 0x93, 0xd6, 0x47, 0x78, 0x38, 0x90, 0x4c, 0x62, 0xc7, 0x67, 0x7c, 0x84, 0xd9, 0x56, 0x44, 0xe9, 0x3c, 0xd1, 0xd7, 0xa0, 0xe7, 0x5b, 0x42, 0x8f, 0x8b, 0x0d, 0x59, 0xdb, 0x9d, 0xea, 0x46, 0x4d, 0xeb, 0xda, 0x73, 0xd2, 0x7e, 0xf3, 0x73, 0x66, 0x91, 0x5f, 0x33, 0x8b, 0xfc, 0x99, 0x59, 0xe4, 0xc7, 0x5f, 0x4b, 0xfb, 0xf4, 0x6c, 0x14, 0x48, 0x7f, 0x32, 0x6c, 0xba, 0xe2, 0xc6, 0xf6, 0x59, 0xe2, 0x07, 0xae, 0x88, 0x23, 0xdb, 0x15, 0x3c, 0x99, 0x84, 0xf6, 0xc6, 0x7a, 0x0f, 0x77, 0x15, 0xf4, 0xe2, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xb6, 0x48, 0xa0, 0xfa, 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.Partition) > 0 { i -= len(m.Partition) copy(dAtA[i:], m.Partition) i = encodeVarintSubscribe(dAtA, i, uint64(len(m.Partition))) i-- dAtA[i] = 0x3a } if len(m.Namespace) > 0 { i -= len(m.Namespace) copy(dAtA[i:], m.Namespace) i = encodeVarintSubscribe(dAtA, i, uint64(len(m.Namespace))) i-- dAtA[i] = 0x32 } 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] = 0x8 } return len(dAtA) - i, nil } func (m *Event_EndOfSnapshot) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[: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] = 0x10 return len(dAtA) - i, nil } func (m *Event_NewSnapshotToFollow) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[: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] = 0x18 return len(dAtA) - i, nil } func (m *Event_EventBatch) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[: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] = 0x22 } return len(dAtA) - i, nil } func (m *Event_ServiceHealth) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[: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)) } l = len(m.Namespace) if l > 0 { n += 1 + l + sovSubscribe(uint64(l)) } l = len(m.Partition) 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.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 case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Namespace", 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.Namespace = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Partition", 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.Partition = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSubscribe(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (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 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 2: 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 3: 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 4: 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) || (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) || (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) || (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 depth := 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 } } case 1: iNdEx += 8 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 case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupSubscribe } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthSubscribe } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthSubscribe = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSubscribe = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupSubscribe = fmt.Errorf("proto: unexpected end of group") )