2019-05-24 19:15:59 +03:00
|
|
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
2020-03-30 23:58:32 +03:00
|
|
|
// source: transport/grpc/proto/transport.proto
|
2019-05-24 19:15:59 +03:00
|
|
|
|
2020-03-30 23:58:32 +03:00
|
|
|
package go_micro_transport_grpc
|
2019-05-24 19:15:59 +03:00
|
|
|
|
2019-06-03 21:30:43 +03:00
|
|
|
import (
|
|
|
|
fmt "fmt"
|
|
|
|
proto "github.com/golang/protobuf/proto"
|
|
|
|
math "math"
|
|
|
|
)
|
2019-05-24 19:15:59 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
context "context"
|
2020-04-14 16:25:09 +03:00
|
|
|
api "github.com/micro/go-micro/v2/api"
|
2020-01-30 14:39:00 +03:00
|
|
|
client "github.com/micro/go-micro/v2/client"
|
|
|
|
server "github.com/micro/go-micro/v2/server"
|
2019-05-24 19:15:59 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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.
|
2019-06-03 21:30:43 +03:00
|
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
2019-05-24 19:15:59 +03:00
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
2020-04-14 16:25:09 +03:00
|
|
|
var _ api.Endpoint
|
2019-05-24 19:15:59 +03:00
|
|
|
var _ context.Context
|
|
|
|
var _ client.Option
|
|
|
|
var _ server.Option
|
|
|
|
|
2020-04-14 16:25:09 +03:00
|
|
|
// Api Endpoints for Transport service
|
|
|
|
|
|
|
|
func NewTransportEndpoints() []*api.Endpoint {
|
|
|
|
return []*api.Endpoint{}
|
|
|
|
}
|
|
|
|
|
2019-05-24 19:15:59 +03:00
|
|
|
// Client API for Transport service
|
|
|
|
|
|
|
|
type TransportService interface {
|
|
|
|
Stream(ctx context.Context, opts ...client.CallOption) (Transport_StreamService, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type transportService struct {
|
|
|
|
c client.Client
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewTransportService(name string, c client.Client) TransportService {
|
|
|
|
return &transportService{
|
|
|
|
c: c,
|
|
|
|
name: name,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *transportService) Stream(ctx context.Context, opts ...client.CallOption) (Transport_StreamService, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Transport.Stream", &Message{})
|
|
|
|
stream, err := c.c.Stream(ctx, req, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &transportServiceStream{stream}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type Transport_StreamService interface {
|
2020-03-30 23:58:32 +03:00
|
|
|
Context() context.Context
|
2019-05-24 19:15:59 +03:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
|
|
|
Send(*Message) error
|
|
|
|
Recv() (*Message, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type transportServiceStream struct {
|
|
|
|
stream client.Stream
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportServiceStream) Close() error {
|
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-30 23:58:32 +03:00
|
|
|
func (x *transportServiceStream) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2019-05-24 19:15:59 +03:00
|
|
|
func (x *transportServiceStream) SendMsg(m interface{}) error {
|
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportServiceStream) RecvMsg(m interface{}) error {
|
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportServiceStream) Send(m *Message) error {
|
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportServiceStream) Recv() (*Message, error) {
|
|
|
|
m := new(Message)
|
|
|
|
err := x.stream.Recv(m)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return m, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Server API for Transport service
|
|
|
|
|
|
|
|
type TransportHandler interface {
|
|
|
|
Stream(context.Context, Transport_StreamStream) error
|
|
|
|
}
|
|
|
|
|
2019-06-03 21:30:43 +03:00
|
|
|
func RegisterTransportHandler(s server.Server, hdlr TransportHandler, opts ...server.HandlerOption) error {
|
2019-05-24 19:15:59 +03:00
|
|
|
type transport interface {
|
|
|
|
Stream(ctx context.Context, stream server.Stream) error
|
|
|
|
}
|
|
|
|
type Transport struct {
|
|
|
|
transport
|
|
|
|
}
|
|
|
|
h := &transportHandler{hdlr}
|
2019-06-03 21:30:43 +03:00
|
|
|
return s.Handle(s.NewHandler(&Transport{h}, opts...))
|
2019-05-24 19:15:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type transportHandler struct {
|
|
|
|
TransportHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *transportHandler) Stream(ctx context.Context, stream server.Stream) error {
|
|
|
|
return h.TransportHandler.Stream(ctx, &transportStreamStream{stream})
|
|
|
|
}
|
|
|
|
|
|
|
|
type Transport_StreamStream interface {
|
2020-03-30 23:58:32 +03:00
|
|
|
Context() context.Context
|
2019-05-24 19:15:59 +03:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
|
|
|
Send(*Message) error
|
|
|
|
Recv() (*Message, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type transportStreamStream struct {
|
|
|
|
stream server.Stream
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportStreamStream) Close() error {
|
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-30 23:58:32 +03:00
|
|
|
func (x *transportStreamStream) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2019-05-24 19:15:59 +03:00
|
|
|
func (x *transportStreamStream) SendMsg(m interface{}) error {
|
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportStreamStream) RecvMsg(m interface{}) error {
|
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportStreamStream) Send(m *Message) error {
|
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *transportStreamStream) Recv() (*Message, error) {
|
|
|
|
m := new(Message)
|
|
|
|
if err := x.stream.Recv(m); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return m, nil
|
|
|
|
}
|