micro-broker-service/micro/broker_micro_grpc.pb.go
Vasiliy Tolstov 6c623d0149 regen
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-03-25 22:16:14 +03:00

217 lines
6.2 KiB
Go

// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.2
// source: broker.proto
package servicepb
import (
context "context"
proto "go.unistack.org/micro-broker-service/v3/proto"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
)
type brokerServiceClient struct {
c client.Client
name string
}
func NewBrokerServiceClient(name string, c client.Client) BrokerServiceClient {
return &brokerServiceClient{c: c, name: name}
}
func (c *brokerServiceClient) Publish(ctx context.Context, req *proto.PublishRequest, opts ...client.CallOption) (*proto.PublishResponse, error) {
rsp := &proto.PublishResponse{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "BrokerService.Publish", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *brokerServiceClient) BatchPublish(ctx context.Context, req *proto.BatchPublishRequest, opts ...client.CallOption) (*proto.BatchPublishResponse, error) {
rsp := &proto.BatchPublishResponse{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "BrokerService.BatchPublish", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *brokerServiceClient) Subscribe(ctx context.Context, req *proto.SubscribeRequest, opts ...client.CallOption) (BrokerService_SubscribeClient, error) {
stream, err := c.c.Stream(ctx, c.c.NewRequest(c.name, "BrokerService.Subscribe", &proto.SubscribeRequest{}), opts...)
if err != nil {
return nil, err
}
if err := stream.Send(req); err != nil {
return nil, err
}
return &brokerServiceClientSubscribe{stream}, nil
}
type brokerServiceClientSubscribe struct {
stream client.Stream
}
func (s *brokerServiceClientSubscribe) Close() error {
return s.stream.Close()
}
func (s *brokerServiceClientSubscribe) CloseSend() error {
return s.stream.CloseSend()
}
func (s *brokerServiceClientSubscribe) Context() context.Context {
return s.stream.Context()
}
func (s *brokerServiceClientSubscribe) SendMsg(msg interface{}) error {
return s.stream.Send(msg)
}
func (s *brokerServiceClientSubscribe) RecvMsg(msg interface{}) error {
return s.stream.Recv(msg)
}
func (s *brokerServiceClientSubscribe) Recv() (*proto.Message, error) {
msg := &proto.Message{}
if err := s.stream.Recv(msg); err != nil {
return nil, err
}
return msg, nil
}
func (c *brokerServiceClient) BatchSubscribe(ctx context.Context, req *proto.BatchSubscribeRequest, opts ...client.CallOption) (BrokerService_BatchSubscribeClient, error) {
stream, err := c.c.Stream(ctx, c.c.NewRequest(c.name, "BrokerService.BatchSubscribe", &proto.BatchSubscribeRequest{}), opts...)
if err != nil {
return nil, err
}
if err := stream.Send(req); err != nil {
return nil, err
}
return &brokerServiceClientBatchSubscribe{stream}, nil
}
type brokerServiceClientBatchSubscribe struct {
stream client.Stream
}
func (s *brokerServiceClientBatchSubscribe) Close() error {
return s.stream.Close()
}
func (s *brokerServiceClientBatchSubscribe) CloseSend() error {
return s.stream.CloseSend()
}
func (s *brokerServiceClientBatchSubscribe) Context() context.Context {
return s.stream.Context()
}
func (s *brokerServiceClientBatchSubscribe) SendMsg(msg interface{}) error {
return s.stream.Send(msg)
}
func (s *brokerServiceClientBatchSubscribe) RecvMsg(msg interface{}) error {
return s.stream.Recv(msg)
}
func (s *brokerServiceClientBatchSubscribe) Recv() (*proto.Message, error) {
msg := &proto.Message{}
if err := s.stream.Recv(msg); err != nil {
return nil, err
}
return msg, nil
}
type brokerServiceServer struct {
BrokerServiceServer
}
func (h *brokerServiceServer) Publish(ctx context.Context, req *proto.PublishRequest, rsp *proto.PublishResponse) error {
return h.BrokerServiceServer.Publish(ctx, req, rsp)
}
func (h *brokerServiceServer) BatchPublish(ctx context.Context, req *proto.BatchPublishRequest, rsp *proto.BatchPublishResponse) error {
return h.BrokerServiceServer.BatchPublish(ctx, req, rsp)
}
func (h *brokerServiceServer) Subscribe(ctx context.Context, stream server.Stream) error {
msg := &proto.SubscribeRequest{}
if err := stream.Recv(msg); err != nil {
return err
}
return h.BrokerServiceServer.Subscribe(ctx, msg, &brokerServiceSubscribeStream{stream})
}
type brokerServiceSubscribeStream struct {
stream server.Stream
}
func (s *brokerServiceSubscribeStream) Close() error {
return s.stream.Close()
}
func (s *brokerServiceSubscribeStream) Context() context.Context {
return s.stream.Context()
}
func (s *brokerServiceSubscribeStream) SendMsg(msg interface{}) error {
return s.stream.Send(msg)
}
func (s *brokerServiceSubscribeStream) RecvMsg(msg interface{}) error {
return s.stream.Recv(msg)
}
func (s *brokerServiceSubscribeStream) Send(msg *proto.Message) error {
return s.stream.Send(msg)
}
func (h *brokerServiceServer) BatchSubscribe(ctx context.Context, stream server.Stream) error {
msg := &proto.BatchSubscribeRequest{}
if err := stream.Recv(msg); err != nil {
return err
}
return h.BrokerServiceServer.BatchSubscribe(ctx, msg, &brokerServiceBatchSubscribeStream{stream})
}
type brokerServiceBatchSubscribeStream struct {
stream server.Stream
}
func (s *brokerServiceBatchSubscribeStream) Close() error {
return s.stream.Close()
}
func (s *brokerServiceBatchSubscribeStream) Context() context.Context {
return s.stream.Context()
}
func (s *brokerServiceBatchSubscribeStream) SendMsg(msg interface{}) error {
return s.stream.Send(msg)
}
func (s *brokerServiceBatchSubscribeStream) RecvMsg(msg interface{}) error {
return s.stream.Recv(msg)
}
func (s *brokerServiceBatchSubscribeStream) Send(msg *proto.Message) error {
return s.stream.Send(msg)
}
func RegisterBrokerServiceServer(s server.Server, sh BrokerServiceServer, opts ...server.HandlerOption) error {
type brokerService interface {
Publish(ctx context.Context, req *proto.PublishRequest, rsp *proto.PublishResponse) error
BatchPublish(ctx context.Context, req *proto.BatchPublishRequest, rsp *proto.BatchPublishResponse) error
Subscribe(ctx context.Context, stream server.Stream) error
BatchSubscribe(ctx context.Context, stream server.Stream) error
}
type BrokerService struct {
brokerService
}
h := &brokerServiceServer{sh}
var nopts []server.HandlerOption
return s.Handle(s.NewHandler(&BrokerService{h}, append(nopts, opts...)...))
}