pubsub

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PubSub_Subscribe_FullMethodName = "/PubSub/Subscribe"
	PubSub_Publish_FullMethodName   = "/PubSub/Publish"
)

Variables

View Source
var File_subpub_proto protoreflect.FileDescriptor
View Source
var PubSub_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "PubSub",
	HandlerType: (*PubSubServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Publish",
			Handler:    _PubSub_Publish_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Subscribe",
			Handler:       _PubSub_Subscribe_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "subpub.proto",
}

PubSub_ServiceDesc is the grpc.ServiceDesc for PubSub service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterPubSubServer

func RegisterPubSubServer(s grpc.ServiceRegistrar, srv PubSubServer)

Types

type Event

type Event struct {
	Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*Event) Descriptor deprecated

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

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetData

func (x *Event) GetData() string

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type PubSubClient

type PubSubClient interface {
	// Подписка (сервер отправляет потом событий)
	Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Event], error)
	// Публикация (классический запрос-ответ)
	Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

PubSubClient is the client API for PubSub service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewPubSubClient

func NewPubSubClient(cc grpc.ClientConnInterface) PubSubClient

type PubSubServer

type PubSubServer interface {
	// Подписка (сервер отправляет потом событий)
	Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Event]) error
	// Публикация (классический запрос-ответ)
	Publish(context.Context, *PublishRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

PubSubServer is the server API for PubSub service. All implementations must embed UnimplementedPubSubServer for forward compatibility.

type PubSub_SubscribeClient

type PubSub_SubscribeClient = grpc.ServerStreamingClient[Event]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type PubSub_SubscribeServer

type PubSub_SubscribeServer = grpc.ServerStreamingServer[Event]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type PublishRequest

type PublishRequest struct {
	Key  string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*PublishRequest) Descriptor deprecated

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

Deprecated: Use PublishRequest.ProtoReflect.Descriptor instead.

func (*PublishRequest) GetData

func (x *PublishRequest) GetData() string

func (*PublishRequest) GetKey

func (x *PublishRequest) GetKey() string

func (*PublishRequest) ProtoMessage

func (*PublishRequest) ProtoMessage()

func (*PublishRequest) ProtoReflect

func (x *PublishRequest) ProtoReflect() protoreflect.Message

func (*PublishRequest) Reset

func (x *PublishRequest) Reset()

func (*PublishRequest) String

func (x *PublishRequest) String() string

type SubscribeRequest

type SubscribeRequest struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*SubscribeRequest) Descriptor deprecated

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

Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead.

func (*SubscribeRequest) GetKey

func (x *SubscribeRequest) GetKey() string

func (*SubscribeRequest) ProtoMessage

func (*SubscribeRequest) ProtoMessage()

func (*SubscribeRequest) ProtoReflect

func (x *SubscribeRequest) ProtoReflect() protoreflect.Message

func (*SubscribeRequest) Reset

func (x *SubscribeRequest) Reset()

func (*SubscribeRequest) String

func (x *SubscribeRequest) String() string

type UnimplementedPubSubServer

type UnimplementedPubSubServer struct{}

UnimplementedPubSubServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedPubSubServer) Publish

func (UnimplementedPubSubServer) Subscribe

type UnsafePubSubServer

type UnsafePubSubServer interface {
	// contains filtered or unexported methods
}

UnsafePubSubServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PubSubServer will result in compilation errors.

Jump to

Keyboard shortcuts

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