regen with never protoc-gen-go

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-03-22 08:42:38 +03:00
parent 585eff3652
commit d8871e07ee
11 changed files with 177 additions and 273 deletions

View File

@@ -1,13 +1,12 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc-gen-go v1.26.0-devel
// protoc v3.6.1
// source: broker.proto
package service
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -21,10 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type Empty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -259,11 +254,11 @@ var file_broker_proto_rawDesc = []byte{
0x62, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x75, 0x62,
0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22,
0x00, 0x30, 0x01, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x00, 0x30, 0x01, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x6d,
0x69, 0x63, 0x72, 0x6f, 0x2d, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2d, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x69, 0x63, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x73, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@@ -1,7 +1,7 @@
syntax = "proto3";
package service;
option go_package="github.com/unistack-org/micro-broker-service;service";
option go_package="github.com/unistack-org/micro-broker-service/v3/proto;service";
service Broker {
rpc Publish(PublishRequest) returns (Empty) {};

View File

@@ -1,63 +0,0 @@
// Code generated by protoc-gen-micro
// source: broker.proto
package service
import (
"context"
micro_api "github.com/unistack-org/micro/v3/api"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
// NewBrokerEndpoints provides api endpoints metdata for Broker service
func NewBrokerEndpoints() []*micro_api.Endpoint {
var endpoints []*micro_api.Endpoint
return endpoints
}
// BrokerService interface
type BrokerService interface {
Publish(context.Context, *PublishRequest, ...micro_client.CallOption) (*Empty, error)
Subscribe(context.Context, *SubscribeRequest, ...micro_client.CallOption) (Broker_SubscribeService, error)
}
type Broker_SubscribeService interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*Message, error)
}
// Micro server stuff
// BrokerHandler server handler
type BrokerHandler interface {
Publish(context.Context, *PublishRequest, *Empty) error
Subscribe(context.Context, *SubscribeRequest, Broker_SubscribeStream) error
}
// RegisterBrokerHandler registers server handler
func RegisterBrokerHandler(s micro_server.Server, sh BrokerHandler, opts ...micro_server.HandlerOption) error {
type broker interface {
Publish(context.Context, *PublishRequest, *Empty) error
Subscribe(context.Context, micro_server.Stream) error
}
type Broker struct {
broker
}
h := &brokerHandler{sh}
for _, endpoint := range NewBrokerEndpoints() {
opts = append(opts, micro_api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&Broker{h}, opts...))
}
type Broker_SubscribeStream interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*Message) error
}

View File

@@ -1,114 +0,0 @@
// Code generated by protoc-gen-micro
// source: broker.proto
package service
import (
"context"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
var (
_ micro_server.Option
_ micro_client.Option
)
type brokerService struct {
c micro_client.Client
name string
}
// Micro client stuff
// NewBrokerService create new service client
func NewBrokerService(name string, c micro_client.Client) BrokerService {
return &brokerService{c: c, name: name}
}
func (c *brokerService) Publish(ctx context.Context, req *PublishRequest, opts ...micro_client.CallOption) (*Empty, error) {
rsp := &Empty{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Broker.Publish", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *brokerService) Subscribe(ctx context.Context, req *SubscribeRequest, opts ...micro_client.CallOption) (Broker_SubscribeService, error) {
stream, err := c.c.Stream(ctx, c.c.NewRequest(c.name, "Broker.Subscribe", &SubscribeRequest{}), opts...)
if err != nil {
return nil, err
}
if err := stream.Send(req); err != nil {
return nil, err
}
return &brokerServiceSubscribe{stream}, nil
}
type brokerServiceSubscribe struct {
stream micro_client.Stream
}
func (x *brokerServiceSubscribe) Close() error {
return x.stream.Close()
}
func (x *brokerServiceSubscribe) Context() context.Context {
return x.stream.Context()
}
func (x *brokerServiceSubscribe) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *brokerServiceSubscribe) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *brokerServiceSubscribe) Recv() (*Message, error) {
m := &Message{}
if err := x.stream.Recv(m); err != nil {
return nil, err
}
return m, nil
} // Micro server stuff
type brokerHandler struct {
BrokerHandler
}
func (h *brokerHandler) Publish(ctx context.Context, req *PublishRequest, rsp *Empty) error {
return h.BrokerHandler.Publish(ctx, req, rsp)
}
func (h *brokerHandler) Subscribe(ctx context.Context, stream micro_server.Stream) error {
m := &SubscribeRequest{}
if err := stream.Recv(m); err != nil {
return err
}
return h.BrokerHandler.Subscribe(ctx, m, &brokerSubscribeStream{stream})
}
type brokerSubscribeStream struct {
stream micro_server.Stream
}
func (x *brokerSubscribeStream) Close() error {
return x.stream.Close()
}
func (x *brokerSubscribeStream) Context() context.Context {
return x.stream.Context()
}
func (x *brokerSubscribeStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *brokerSubscribeStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *brokerSubscribeStream) Send(m *Message) error {
return x.stream.Send(m)
}