remove the proto from proxy package
This commit is contained in:
		| @@ -1,207 +0,0 @@ | |||||||
| // Code generated by protoc-gen-micro. DO NOT EDIT. |  | ||||||
| // source: github.com/micro/go-proxy/proto/proxy.proto |  | ||||||
|  |  | ||||||
| /* |  | ||||||
| Package proxy is a generated protocol buffer package. |  | ||||||
|  |  | ||||||
| It is generated from these files: |  | ||||||
| 	github.com/micro/go-proxy/proto/proxy.proto |  | ||||||
|  |  | ||||||
| It has these top-level messages: |  | ||||||
| 	Request |  | ||||||
| 	Response |  | ||||||
| 	Message |  | ||||||
| 	Empty |  | ||||||
| */ |  | ||||||
| package proxy |  | ||||||
|  |  | ||||||
| import proto "github.com/golang/protobuf/proto" |  | ||||||
| import fmt "fmt" |  | ||||||
| import math "math" |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	context "context" |  | ||||||
| 	client "github.com/micro/go-micro/client" |  | ||||||
| 	server "github.com/micro/go-micro/server" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| // 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. |  | ||||||
| const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package |  | ||||||
|  |  | ||||||
| // Reference imports to suppress errors if they are not otherwise used. |  | ||||||
| var _ context.Context |  | ||||||
| var _ client.Option |  | ||||||
| var _ server.Option |  | ||||||
|  |  | ||||||
| // Client API for Service service |  | ||||||
|  |  | ||||||
| type Service interface { |  | ||||||
| 	Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) |  | ||||||
| 	Stream(ctx context.Context, opts ...client.CallOption) (Service_StreamService, error) |  | ||||||
| 	Publish(ctx context.Context, in *Message, opts ...client.CallOption) (*Empty, error) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type service struct { |  | ||||||
| 	c    client.Client |  | ||||||
| 	name string |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func NewService(name string, c client.Client) Service { |  | ||||||
| 	if c == nil { |  | ||||||
| 		c = client.NewClient() |  | ||||||
| 	} |  | ||||||
| 	if len(name) == 0 { |  | ||||||
| 		name = "proxy" |  | ||||||
| 	} |  | ||||||
| 	return &service{ |  | ||||||
| 		c:    c, |  | ||||||
| 		name: name, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *service) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { |  | ||||||
| 	req := c.c.NewRequest(c.name, "Service.Call", in) |  | ||||||
| 	out := new(Response) |  | ||||||
| 	err := c.c.Call(ctx, req, out, opts...) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return out, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *service) Stream(ctx context.Context, opts ...client.CallOption) (Service_StreamService, error) { |  | ||||||
| 	req := c.c.NewRequest(c.name, "Service.Stream", &Request{}) |  | ||||||
| 	stream, err := c.c.Stream(ctx, req, opts...) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return &serviceStream{stream}, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Service_StreamService interface { |  | ||||||
| 	SendMsg(interface{}) error |  | ||||||
| 	RecvMsg(interface{}) error |  | ||||||
| 	Close() error |  | ||||||
| 	Send(*Request) error |  | ||||||
| 	Recv() (*Response, error) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type serviceStream struct { |  | ||||||
| 	stream client.Stream |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStream) Close() error { |  | ||||||
| 	return x.stream.Close() |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStream) SendMsg(m interface{}) error { |  | ||||||
| 	return x.stream.Send(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStream) RecvMsg(m interface{}) error { |  | ||||||
| 	return x.stream.Recv(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStream) Send(m *Request) error { |  | ||||||
| 	return x.stream.Send(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStream) Recv() (*Response, error) { |  | ||||||
| 	m := new(Response) |  | ||||||
| 	err := x.stream.Recv(m) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return m, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *service) Publish(ctx context.Context, in *Message, opts ...client.CallOption) (*Empty, error) { |  | ||||||
| 	req := c.c.NewRequest(c.name, "Service.Publish", in) |  | ||||||
| 	out := new(Empty) |  | ||||||
| 	err := c.c.Call(ctx, req, out, opts...) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return out, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // Server API for Service service |  | ||||||
|  |  | ||||||
| type ServiceHandler interface { |  | ||||||
| 	Call(context.Context, *Request, *Response) error |  | ||||||
| 	Stream(context.Context, Service_StreamStream) error |  | ||||||
| 	Publish(context.Context, *Message, *Empty) error |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func RegisterServiceHandler(s server.Server, hdlr ServiceHandler, opts ...server.HandlerOption) error { |  | ||||||
| 	type service interface { |  | ||||||
| 		Call(ctx context.Context, in *Request, out *Response) error |  | ||||||
| 		Stream(ctx context.Context, stream server.Stream) error |  | ||||||
| 		Publish(ctx context.Context, in *Message, out *Empty) error |  | ||||||
| 	} |  | ||||||
| 	type Service struct { |  | ||||||
| 		service |  | ||||||
| 	} |  | ||||||
| 	h := &serviceHandler{hdlr} |  | ||||||
| 	return s.Handle(s.NewHandler(&Service{h}, opts...)) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type serviceHandler struct { |  | ||||||
| 	ServiceHandler |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *serviceHandler) Call(ctx context.Context, in *Request, out *Response) error { |  | ||||||
| 	return h.ServiceHandler.Call(ctx, in, out) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *serviceHandler) Stream(ctx context.Context, stream server.Stream) error { |  | ||||||
| 	return h.ServiceHandler.Stream(ctx, &serviceStreamStream{stream}) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Service_StreamStream interface { |  | ||||||
| 	SendMsg(interface{}) error |  | ||||||
| 	RecvMsg(interface{}) error |  | ||||||
| 	Close() error |  | ||||||
| 	Send(*Response) error |  | ||||||
| 	Recv() (*Request, error) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type serviceStreamStream struct { |  | ||||||
| 	stream server.Stream |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamStream) Close() error { |  | ||||||
| 	return x.stream.Close() |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamStream) SendMsg(m interface{}) error { |  | ||||||
| 	return x.stream.Send(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamStream) RecvMsg(m interface{}) error { |  | ||||||
| 	return x.stream.Recv(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamStream) Send(m *Response) error { |  | ||||||
| 	return x.stream.Send(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamStream) Recv() (*Request, error) { |  | ||||||
| 	m := new(Request) |  | ||||||
| 	if err := x.stream.Recv(m); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return m, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *serviceHandler) Publish(ctx context.Context, in *Message, out *Empty) error { |  | ||||||
| 	return h.ServiceHandler.Publish(ctx, in, out) |  | ||||||
| } |  | ||||||
| @@ -1,345 +0,0 @@ | |||||||
| // Code generated by protoc-gen-go. DO NOT EDIT. |  | ||||||
| // source: github.com/micro/go-proxy/proto/proxy.proto |  | ||||||
|  |  | ||||||
| package proxy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	context "context" |  | ||||||
| 	fmt "fmt" |  | ||||||
| 	proto "github.com/golang/protobuf/proto" |  | ||||||
| 	grpc "google.golang.org/grpc" |  | ||||||
| 	math "math" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| // 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. |  | ||||||
| const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package |  | ||||||
|  |  | ||||||
| type Request struct { |  | ||||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` |  | ||||||
| 	XXX_unrecognized     []byte   `json:"-"` |  | ||||||
| 	XXX_sizecache        int32    `json:"-"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Request) Reset()         { *m = Request{} } |  | ||||||
| func (m *Request) String() string { return proto.CompactTextString(m) } |  | ||||||
| func (*Request) ProtoMessage()    {} |  | ||||||
| func (*Request) Descriptor() ([]byte, []int) { |  | ||||||
| 	return fileDescriptor_242fe7b9d67fe7d7, []int{0} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Request) XXX_Unmarshal(b []byte) error { |  | ||||||
| 	return xxx_messageInfo_Request.Unmarshal(m, b) |  | ||||||
| } |  | ||||||
| func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |  | ||||||
| 	return xxx_messageInfo_Request.Marshal(b, m, deterministic) |  | ||||||
| } |  | ||||||
| func (m *Request) XXX_Merge(src proto.Message) { |  | ||||||
| 	xxx_messageInfo_Request.Merge(m, src) |  | ||||||
| } |  | ||||||
| func (m *Request) XXX_Size() int { |  | ||||||
| 	return xxx_messageInfo_Request.Size(m) |  | ||||||
| } |  | ||||||
| func (m *Request) XXX_DiscardUnknown() { |  | ||||||
| 	xxx_messageInfo_Request.DiscardUnknown(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| var xxx_messageInfo_Request proto.InternalMessageInfo |  | ||||||
|  |  | ||||||
| type Response struct { |  | ||||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` |  | ||||||
| 	XXX_unrecognized     []byte   `json:"-"` |  | ||||||
| 	XXX_sizecache        int32    `json:"-"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Response) Reset()         { *m = Response{} } |  | ||||||
| func (m *Response) String() string { return proto.CompactTextString(m) } |  | ||||||
| func (*Response) ProtoMessage()    {} |  | ||||||
| func (*Response) Descriptor() ([]byte, []int) { |  | ||||||
| 	return fileDescriptor_242fe7b9d67fe7d7, []int{1} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Response) XXX_Unmarshal(b []byte) error { |  | ||||||
| 	return xxx_messageInfo_Response.Unmarshal(m, b) |  | ||||||
| } |  | ||||||
| func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |  | ||||||
| 	return xxx_messageInfo_Response.Marshal(b, m, deterministic) |  | ||||||
| } |  | ||||||
| func (m *Response) XXX_Merge(src proto.Message) { |  | ||||||
| 	xxx_messageInfo_Response.Merge(m, src) |  | ||||||
| } |  | ||||||
| func (m *Response) XXX_Size() int { |  | ||||||
| 	return xxx_messageInfo_Response.Size(m) |  | ||||||
| } |  | ||||||
| func (m *Response) XXX_DiscardUnknown() { |  | ||||||
| 	xxx_messageInfo_Response.DiscardUnknown(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| var xxx_messageInfo_Response proto.InternalMessageInfo |  | ||||||
|  |  | ||||||
| type Message struct { |  | ||||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` |  | ||||||
| 	XXX_unrecognized     []byte   `json:"-"` |  | ||||||
| 	XXX_sizecache        int32    `json:"-"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Message) Reset()         { *m = Message{} } |  | ||||||
| func (m *Message) String() string { return proto.CompactTextString(m) } |  | ||||||
| func (*Message) ProtoMessage()    {} |  | ||||||
| func (*Message) Descriptor() ([]byte, []int) { |  | ||||||
| 	return fileDescriptor_242fe7b9d67fe7d7, []int{2} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Message) XXX_Unmarshal(b []byte) error { |  | ||||||
| 	return xxx_messageInfo_Message.Unmarshal(m, b) |  | ||||||
| } |  | ||||||
| func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |  | ||||||
| 	return xxx_messageInfo_Message.Marshal(b, m, deterministic) |  | ||||||
| } |  | ||||||
| func (m *Message) XXX_Merge(src proto.Message) { |  | ||||||
| 	xxx_messageInfo_Message.Merge(m, src) |  | ||||||
| } |  | ||||||
| func (m *Message) XXX_Size() int { |  | ||||||
| 	return xxx_messageInfo_Message.Size(m) |  | ||||||
| } |  | ||||||
| func (m *Message) XXX_DiscardUnknown() { |  | ||||||
| 	xxx_messageInfo_Message.DiscardUnknown(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| var xxx_messageInfo_Message proto.InternalMessageInfo |  | ||||||
|  |  | ||||||
| type Empty struct { |  | ||||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` |  | ||||||
| 	XXX_unrecognized     []byte   `json:"-"` |  | ||||||
| 	XXX_sizecache        int32    `json:"-"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Empty) Reset()         { *m = Empty{} } |  | ||||||
| func (m *Empty) String() string { return proto.CompactTextString(m) } |  | ||||||
| func (*Empty) ProtoMessage()    {} |  | ||||||
| func (*Empty) Descriptor() ([]byte, []int) { |  | ||||||
| 	return fileDescriptor_242fe7b9d67fe7d7, []int{3} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (m *Empty) XXX_Unmarshal(b []byte) error { |  | ||||||
| 	return xxx_messageInfo_Empty.Unmarshal(m, b) |  | ||||||
| } |  | ||||||
| func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |  | ||||||
| 	return xxx_messageInfo_Empty.Marshal(b, m, deterministic) |  | ||||||
| } |  | ||||||
| func (m *Empty) XXX_Merge(src proto.Message) { |  | ||||||
| 	xxx_messageInfo_Empty.Merge(m, src) |  | ||||||
| } |  | ||||||
| func (m *Empty) XXX_Size() int { |  | ||||||
| 	return xxx_messageInfo_Empty.Size(m) |  | ||||||
| } |  | ||||||
| func (m *Empty) XXX_DiscardUnknown() { |  | ||||||
| 	xxx_messageInfo_Empty.DiscardUnknown(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| var xxx_messageInfo_Empty proto.InternalMessageInfo |  | ||||||
|  |  | ||||||
| func init() { |  | ||||||
| 	proto.RegisterType((*Request)(nil), "proxy.Request") |  | ||||||
| 	proto.RegisterType((*Response)(nil), "proxy.Response") |  | ||||||
| 	proto.RegisterType((*Message)(nil), "proxy.Message") |  | ||||||
| 	proto.RegisterType((*Empty)(nil), "proxy.Empty") |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func init() { |  | ||||||
| 	proto.RegisterFile("github.com/micro/go-proxy/proto/proxy.proto", fileDescriptor_242fe7b9d67fe7d7) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| var fileDescriptor_242fe7b9d67fe7d7 = []byte{ |  | ||||||
| 	// 186 bytes of a gzipped FileDescriptorProto |  | ||||||
| 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4e, 0xcf, 0x2c, 0xc9, |  | ||||||
| 	0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcd, 0x4c, 0x2e, 0xca, 0xd7, 0x4f, 0xcf, 0xd7, |  | ||||||
| 	0x2d, 0x28, 0xca, 0xaf, 0xa8, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x07, 0xb3, 0xf5, 0xc0, |  | ||||||
| 	0x6c, 0x21, 0x56, 0x30, 0x47, 0x89, 0x93, 0x8b, 0x3d, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, |  | ||||||
| 	0x89, 0x8b, 0x8b, 0x23, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x15, 0x24, 0xec, 0x9b, 0x5a, |  | ||||||
| 	0x5c, 0x9c, 0x98, 0x9e, 0xaa, 0xc4, 0xce, 0xc5, 0xea, 0x9a, 0x5b, 0x50, 0x52, 0x69, 0x34, 0x81, |  | ||||||
| 	0x91, 0x8b, 0x3d, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55, 0x48, 0x93, 0x8b, 0xc5, 0x39, 0x31, |  | ||||||
| 	0x27, 0x47, 0x88, 0x4f, 0x0f, 0x62, 0x26, 0xd4, 0x0c, 0x29, 0x7e, 0x38, 0x1f, 0x6a, 0x10, 0x83, |  | ||||||
| 	0x90, 0x3e, 0x17, 0x5b, 0x70, 0x49, 0x51, 0x6a, 0x62, 0x2e, 0x11, 0x8a, 0x35, 0x18, 0x0d, 0x18, |  | ||||||
| 	0x85, 0x34, 0xb9, 0xd8, 0x03, 0x4a, 0x93, 0x72, 0x32, 0x8b, 0x33, 0xe0, 0x3a, 0xa0, 0x6e, 0x91, |  | ||||||
| 	0xe2, 0x81, 0xf2, 0xc1, 0x0e, 0x52, 0x62, 0x48, 0x62, 0x03, 0xfb, 0xc5, 0x18, 0x10, 0x00, 0x00, |  | ||||||
| 	0xff, 0xff, 0x51, 0x0d, 0x40, 0x94, 0xfa, 0x00, 0x00, 0x00, |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // Reference imports to suppress errors if they are not otherwise used. |  | ||||||
| var _ context.Context |  | ||||||
| var _ grpc.ClientConn |  | ||||||
|  |  | ||||||
| // This is a compile-time assertion to ensure that this generated file |  | ||||||
| // is compatible with the grpc package it is being compiled against. |  | ||||||
| const _ = grpc.SupportPackageIsVersion4 |  | ||||||
|  |  | ||||||
| // ServiceClient is the client API for Service service. |  | ||||||
| // |  | ||||||
| // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. |  | ||||||
| type ServiceClient interface { |  | ||||||
| 	Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) |  | ||||||
| 	Stream(ctx context.Context, opts ...grpc.CallOption) (Service_StreamClient, error) |  | ||||||
| 	Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Empty, error) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type serviceClient struct { |  | ||||||
| 	cc *grpc.ClientConn |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func NewServiceClient(cc *grpc.ClientConn) ServiceClient { |  | ||||||
| 	return &serviceClient{cc} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *serviceClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { |  | ||||||
| 	out := new(Response) |  | ||||||
| 	err := c.cc.Invoke(ctx, "/proxy.Service/Call", in, out, opts...) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return out, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *serviceClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Service_StreamClient, error) { |  | ||||||
| 	stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[0], "/proxy.Service/Stream", opts...) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	x := &serviceStreamClient{stream} |  | ||||||
| 	return x, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Service_StreamClient interface { |  | ||||||
| 	Send(*Request) error |  | ||||||
| 	Recv() (*Response, error) |  | ||||||
| 	grpc.ClientStream |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type serviceStreamClient struct { |  | ||||||
| 	grpc.ClientStream |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamClient) Send(m *Request) error { |  | ||||||
| 	return x.ClientStream.SendMsg(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamClient) Recv() (*Response, error) { |  | ||||||
| 	m := new(Response) |  | ||||||
| 	if err := x.ClientStream.RecvMsg(m); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return m, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *serviceClient) Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Empty, error) { |  | ||||||
| 	out := new(Empty) |  | ||||||
| 	err := c.cc.Invoke(ctx, "/proxy.Service/Publish", in, out, opts...) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return out, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ServiceServer is the server API for Service service. |  | ||||||
| type ServiceServer interface { |  | ||||||
| 	Call(context.Context, *Request) (*Response, error) |  | ||||||
| 	Stream(Service_StreamServer) error |  | ||||||
| 	Publish(context.Context, *Message) (*Empty, error) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { |  | ||||||
| 	s.RegisterService(&_Service_serviceDesc, srv) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func _Service_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |  | ||||||
| 	in := new(Request) |  | ||||||
| 	if err := dec(in); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	if interceptor == nil { |  | ||||||
| 		return srv.(ServiceServer).Call(ctx, in) |  | ||||||
| 	} |  | ||||||
| 	info := &grpc.UnaryServerInfo{ |  | ||||||
| 		Server:     srv, |  | ||||||
| 		FullMethod: "/proxy.Service/Call", |  | ||||||
| 	} |  | ||||||
| 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { |  | ||||||
| 		return srv.(ServiceServer).Call(ctx, req.(*Request)) |  | ||||||
| 	} |  | ||||||
| 	return interceptor(ctx, in, info, handler) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func _Service_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { |  | ||||||
| 	return srv.(ServiceServer).Stream(&serviceStreamServer{stream}) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Service_StreamServer interface { |  | ||||||
| 	Send(*Response) error |  | ||||||
| 	Recv() (*Request, error) |  | ||||||
| 	grpc.ServerStream |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type serviceStreamServer struct { |  | ||||||
| 	grpc.ServerStream |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamServer) Send(m *Response) error { |  | ||||||
| 	return x.ServerStream.SendMsg(m) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (x *serviceStreamServer) Recv() (*Request, error) { |  | ||||||
| 	m := new(Request) |  | ||||||
| 	if err := x.ServerStream.RecvMsg(m); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	return m, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func _Service_Publish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |  | ||||||
| 	in := new(Message) |  | ||||||
| 	if err := dec(in); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	if interceptor == nil { |  | ||||||
| 		return srv.(ServiceServer).Publish(ctx, in) |  | ||||||
| 	} |  | ||||||
| 	info := &grpc.UnaryServerInfo{ |  | ||||||
| 		Server:     srv, |  | ||||||
| 		FullMethod: "/proxy.Service/Publish", |  | ||||||
| 	} |  | ||||||
| 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { |  | ||||||
| 		return srv.(ServiceServer).Publish(ctx, req.(*Message)) |  | ||||||
| 	} |  | ||||||
| 	return interceptor(ctx, in, info, handler) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| var _Service_serviceDesc = grpc.ServiceDesc{ |  | ||||||
| 	ServiceName: "proxy.Service", |  | ||||||
| 	HandlerType: (*ServiceServer)(nil), |  | ||||||
| 	Methods: []grpc.MethodDesc{ |  | ||||||
| 		{ |  | ||||||
| 			MethodName: "Call", |  | ||||||
| 			Handler:    _Service_Call_Handler, |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			MethodName: "Publish", |  | ||||||
| 			Handler:    _Service_Publish_Handler, |  | ||||||
| 		}, |  | ||||||
| 	}, |  | ||||||
| 	Streams: []grpc.StreamDesc{ |  | ||||||
| 		{ |  | ||||||
| 			StreamName:    "Stream", |  | ||||||
| 			Handler:       _Service_Stream_Handler, |  | ||||||
| 			ServerStreams: true, |  | ||||||
| 			ClientStreams: true, |  | ||||||
| 		}, |  | ||||||
| 	}, |  | ||||||
| 	Metadata: "github.com/micro/go-proxy/proto/proxy.proto", |  | ||||||
| } |  | ||||||
| @@ -1,18 +0,0 @@ | |||||||
| syntax = "proto3"; |  | ||||||
|  |  | ||||||
| package proxy; |  | ||||||
|  |  | ||||||
| service Service { |  | ||||||
| 	rpc Call(Request) returns (Response) {}; |  | ||||||
| 	rpc Stream(stream Request) returns (stream Response) {}; |  | ||||||
| 	rpc Publish(Message) returns (Empty) {}; |  | ||||||
| 	rpc Subscribe(Message) returns (stream Message) {}; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| message Request {} |  | ||||||
|  |  | ||||||
| message Response {} |  | ||||||
|  |  | ||||||
| message Message {} |  | ||||||
|  |  | ||||||
| message Empty {} |  | ||||||
		Reference in New Issue
	
	Block a user