pbsubscribe

package
v1.9.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthSubscribe        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSubscribe          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSubscribe = fmt.Errorf("proto: unexpected end of group")
)
View Source
var CatalogOp_name = map[int32]string{
	0: "Register",
	1: "Deregister",
}
View Source
var CatalogOp_value = map[string]int32{
	"Register":   0,
	"Deregister": 1,
}
View Source
var Topic_name = map[int32]string{
	0: "Unknown",
	1: "ServiceHealth",
	2: "ServiceHealthConnect",
}
View Source
var Topic_value = map[string]int32{
	"Unknown":              0,
	"ServiceHealth":        1,
	"ServiceHealthConnect": 2,
}

Functions

func RegisterStateChangeSubscriptionServer

func RegisterStateChangeSubscriptionServer(s *grpc.Server, srv StateChangeSubscriptionServer)

Types

type CatalogOp

type CatalogOp int32
const (
	CatalogOp_Register   CatalogOp = 0
	CatalogOp_Deregister CatalogOp = 1
)

func (CatalogOp) EnumDescriptor

func (CatalogOp) EnumDescriptor() ([]byte, []int)

func (CatalogOp) String

func (x CatalogOp) String() string

type Event

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:"-"`
}

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.

func (*Event) Descriptor

func (*Event) Descriptor() ([]byte, []int)

func (*Event) GetEndOfSnapshot

func (m *Event) GetEndOfSnapshot() bool

func (*Event) GetEventBatch

func (m *Event) GetEventBatch() *EventBatch

func (*Event) GetIndex

func (m *Event) GetIndex() uint64

func (*Event) GetNewSnapshotToFollow

func (m *Event) GetNewSnapshotToFollow() bool

func (*Event) GetPayload

func (m *Event) GetPayload() isEvent_Payload

func (*Event) GetServiceHealth

func (m *Event) GetServiceHealth() *ServiceHealthUpdate

func (*Event) Marshal

func (m *Event) Marshal() (dAtA []byte, err error)

func (*Event) MarshalBinary

func (msg *Event) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Event) MarshalTo

func (m *Event) MarshalTo(dAtA []byte) (int, error)

func (*Event) MarshalToSizedBuffer

func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) Reset

func (m *Event) Reset()

func (*Event) Size

func (m *Event) Size() (n int)

func (*Event) String

func (m *Event) String() string

func (*Event) Unmarshal

func (m *Event) Unmarshal(dAtA []byte) error

func (*Event) UnmarshalBinary

func (msg *Event) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

func (*Event) XXX_DiscardUnknown

func (m *Event) XXX_DiscardUnknown()

func (*Event) XXX_Marshal

func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Event) XXX_Merge

func (m *Event) XXX_Merge(src proto.Message)

func (*Event) XXX_OneofWrappers added in v1.9.9

func (*Event) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Event) XXX_Size

func (m *Event) XXX_Size() int

func (*Event) XXX_Unmarshal

func (m *Event) XXX_Unmarshal(b []byte) error

type EventBatch

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 (*EventBatch) Descriptor

func (*EventBatch) Descriptor() ([]byte, []int)

func (*EventBatch) GetEvents

func (m *EventBatch) GetEvents() []*Event

func (*EventBatch) Marshal

func (m *EventBatch) Marshal() (dAtA []byte, err error)

func (*EventBatch) MarshalBinary

func (msg *EventBatch) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*EventBatch) MarshalTo

func (m *EventBatch) MarshalTo(dAtA []byte) (int, error)

func (*EventBatch) MarshalToSizedBuffer

func (m *EventBatch) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventBatch) ProtoMessage

func (*EventBatch) ProtoMessage()

func (*EventBatch) Reset

func (m *EventBatch) Reset()

func (*EventBatch) Size

func (m *EventBatch) Size() (n int)

func (*EventBatch) String

func (m *EventBatch) String() string

func (*EventBatch) Unmarshal

func (m *EventBatch) Unmarshal(dAtA []byte) error

func (*EventBatch) UnmarshalBinary

func (msg *EventBatch) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

func (*EventBatch) XXX_DiscardUnknown

func (m *EventBatch) XXX_DiscardUnknown()

func (*EventBatch) XXX_Marshal

func (m *EventBatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventBatch) XXX_Merge

func (m *EventBatch) XXX_Merge(src proto.Message)

func (*EventBatch) XXX_Size

func (m *EventBatch) XXX_Size() int

func (*EventBatch) XXX_Unmarshal

func (m *EventBatch) XXX_Unmarshal(b []byte) error

type Event_EndOfSnapshot

type Event_EndOfSnapshot struct {
	EndOfSnapshot bool `protobuf:"varint,2,opt,name=EndOfSnapshot,proto3,oneof" json:"EndOfSnapshot,omitempty"`
}

func (*Event_EndOfSnapshot) MarshalTo

func (m *Event_EndOfSnapshot) MarshalTo(dAtA []byte) (int, error)

func (*Event_EndOfSnapshot) MarshalToSizedBuffer

func (m *Event_EndOfSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Event_EndOfSnapshot) Size

func (m *Event_EndOfSnapshot) Size() (n int)

type Event_EventBatch

type Event_EventBatch struct {
	EventBatch *EventBatch `protobuf:"bytes,4,opt,name=EventBatch,proto3,oneof" json:"EventBatch,omitempty"`
}

func (*Event_EventBatch) MarshalTo

func (m *Event_EventBatch) MarshalTo(dAtA []byte) (int, error)

func (*Event_EventBatch) MarshalToSizedBuffer

func (m *Event_EventBatch) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Event_EventBatch) Size

func (m *Event_EventBatch) Size() (n int)

type Event_NewSnapshotToFollow

type Event_NewSnapshotToFollow struct {
	NewSnapshotToFollow bool `protobuf:"varint,3,opt,name=NewSnapshotToFollow,proto3,oneof" json:"NewSnapshotToFollow,omitempty"`
}

func (*Event_NewSnapshotToFollow) MarshalTo

func (m *Event_NewSnapshotToFollow) MarshalTo(dAtA []byte) (int, error)

func (*Event_NewSnapshotToFollow) MarshalToSizedBuffer

func (m *Event_NewSnapshotToFollow) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Event_NewSnapshotToFollow) Size

func (m *Event_NewSnapshotToFollow) Size() (n int)

type Event_ServiceHealth

type Event_ServiceHealth struct {
	ServiceHealth *ServiceHealthUpdate `protobuf:"bytes,10,opt,name=ServiceHealth,proto3,oneof" json:"ServiceHealth,omitempty"`
}

func (*Event_ServiceHealth) MarshalTo

func (m *Event_ServiceHealth) MarshalTo(dAtA []byte) (int, error)

func (*Event_ServiceHealth) MarshalToSizedBuffer

func (m *Event_ServiceHealth) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Event_ServiceHealth) Size

func (m *Event_ServiceHealth) Size() (n int)

type ServiceHealthUpdate

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 (*ServiceHealthUpdate) Descriptor

func (*ServiceHealthUpdate) Descriptor() ([]byte, []int)

func (*ServiceHealthUpdate) GetCheckServiceNode

func (m *ServiceHealthUpdate) GetCheckServiceNode() *pbservice.CheckServiceNode

func (*ServiceHealthUpdate) GetOp

func (m *ServiceHealthUpdate) GetOp() CatalogOp

func (*ServiceHealthUpdate) Marshal

func (m *ServiceHealthUpdate) Marshal() (dAtA []byte, err error)

func (*ServiceHealthUpdate) MarshalBinary

func (msg *ServiceHealthUpdate) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*ServiceHealthUpdate) MarshalTo

func (m *ServiceHealthUpdate) MarshalTo(dAtA []byte) (int, error)

func (*ServiceHealthUpdate) MarshalToSizedBuffer

func (m *ServiceHealthUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ServiceHealthUpdate) ProtoMessage

func (*ServiceHealthUpdate) ProtoMessage()

func (*ServiceHealthUpdate) Reset

func (m *ServiceHealthUpdate) Reset()

func (*ServiceHealthUpdate) Size

func (m *ServiceHealthUpdate) Size() (n int)

func (*ServiceHealthUpdate) String

func (m *ServiceHealthUpdate) String() string

func (*ServiceHealthUpdate) Unmarshal

func (m *ServiceHealthUpdate) Unmarshal(dAtA []byte) error

func (*ServiceHealthUpdate) UnmarshalBinary

func (msg *ServiceHealthUpdate) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

func (*ServiceHealthUpdate) XXX_DiscardUnknown

func (m *ServiceHealthUpdate) XXX_DiscardUnknown()

func (*ServiceHealthUpdate) XXX_Marshal

func (m *ServiceHealthUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ServiceHealthUpdate) XXX_Merge

func (m *ServiceHealthUpdate) XXX_Merge(src proto.Message)

func (*ServiceHealthUpdate) XXX_Size

func (m *ServiceHealthUpdate) XXX_Size() int

func (*ServiceHealthUpdate) XXX_Unmarshal

func (m *ServiceHealthUpdate) XXX_Unmarshal(b []byte) error

type StateChangeSubscriptionClient

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)
}

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.

func NewStateChangeSubscriptionClient

func NewStateChangeSubscriptionClient(cc *grpc.ClientConn) StateChangeSubscriptionClient

type StateChangeSubscriptionServer

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
}

StateChangeSubscriptionServer is the server API for StateChangeSubscription service.

type StateChangeSubscription_SubscribeClient

type StateChangeSubscription_SubscribeClient interface {
	Recv() (*Event, error)
	grpc.ClientStream
}

type StateChangeSubscription_SubscribeServer

type StateChangeSubscription_SubscribeServer interface {
	Send(*Event) error
	grpc.ServerStream
}

type SubscribeRequest

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"`
	// 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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

SubscribeRequest used to subscribe to a topic.

func (*SubscribeRequest) Descriptor

func (*SubscribeRequest) Descriptor() ([]byte, []int)

func (*SubscribeRequest) GetDatacenter

func (m *SubscribeRequest) GetDatacenter() string

func (*SubscribeRequest) GetIndex

func (m *SubscribeRequest) GetIndex() uint64

func (*SubscribeRequest) GetKey

func (m *SubscribeRequest) GetKey() string

func (*SubscribeRequest) GetNamespace

func (m *SubscribeRequest) GetNamespace() string

func (*SubscribeRequest) GetToken

func (m *SubscribeRequest) GetToken() string

func (*SubscribeRequest) GetTopic

func (m *SubscribeRequest) GetTopic() Topic

func (*SubscribeRequest) Marshal

func (m *SubscribeRequest) Marshal() (dAtA []byte, err error)

func (*SubscribeRequest) MarshalBinary

func (msg *SubscribeRequest) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*SubscribeRequest) MarshalTo

func (m *SubscribeRequest) MarshalTo(dAtA []byte) (int, error)

func (*SubscribeRequest) MarshalToSizedBuffer

func (m *SubscribeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SubscribeRequest) ProtoMessage

func (*SubscribeRequest) ProtoMessage()

func (*SubscribeRequest) Reset

func (m *SubscribeRequest) Reset()

func (*SubscribeRequest) Size

func (m *SubscribeRequest) Size() (n int)

func (*SubscribeRequest) String

func (m *SubscribeRequest) String() string

func (*SubscribeRequest) Unmarshal

func (m *SubscribeRequest) Unmarshal(dAtA []byte) error

func (*SubscribeRequest) UnmarshalBinary

func (msg *SubscribeRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

func (*SubscribeRequest) XXX_DiscardUnknown

func (m *SubscribeRequest) XXX_DiscardUnknown()

func (*SubscribeRequest) XXX_Marshal

func (m *SubscribeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SubscribeRequest) XXX_Merge

func (m *SubscribeRequest) XXX_Merge(src proto.Message)

func (*SubscribeRequest) XXX_Size

func (m *SubscribeRequest) XXX_Size() int

func (*SubscribeRequest) XXX_Unmarshal

func (m *SubscribeRequest) XXX_Unmarshal(b []byte) error

type Topic

type Topic int32

Topic enumerates the supported event topics.

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
)

func (Topic) EnumDescriptor

func (Topic) EnumDescriptor() ([]byte, []int)

func (Topic) String

func (x Topic) String() string

type UnimplementedStateChangeSubscriptionServer

type UnimplementedStateChangeSubscriptionServer struct {
}

UnimplementedStateChangeSubscriptionServer can be embedded to have forward compatible implementations.

func (*UnimplementedStateChangeSubscriptionServer) Subscribe

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL