| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
package foo |
| 15 |
|
| 16 |
import ( |
| 17 |
context "context" |
| 18 |
|
| 19 |
yarpc "github.com/influxdata/yarpc" |
| 20 |
) |
| 21 |
|
| 22 |
import proto "github.com/gogo/protobuf/proto" |
| 23 |
import fmt "fmt" |
| 24 |
import math "math" |
| 25 |
import _ "github.com/influxdata/yarpc/yarpcproto" |
| 26 |
|
| 27 |
|
| 28 |
var _ = proto.Marshal |
| 29 |
var _ = fmt.Errorf |
| 30 |
var _ = math.Inf |
| 31 |
|
| 32 |
|
| 33 |
var _ context.Context |
| 34 |
var _ yarpc.ClientConn |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
const _ = yarpc.SupportPackageIsVersion1 |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
type FooClient interface { |
| 43 |
UnaryMethod(ctx context.Context, in *Request) (*Response, error) |
| 44 |
ServerStreamMethod(ctx context.Context, in *Request) (Foo_ServerStreamMethodClient, error) |
| 45 |
} |
| 46 |
|
| 47 |
type fooClient struct { |
| 48 |
cc *yarpc.ClientConn |
| 49 |
} |
| 50 |
|
| 51 |
func NewFooClient(cc *yarpc.ClientConn) FooClient { |
| 52 |
return &fooClient{cc} |
| 53 |
} |
| 54 |
|
| 55 |
func (c *fooClient) UnaryMethod(ctx context.Context, in *Request) (*Response, error) { |
| 56 |
out := new(Response) |
| 57 |
err := yarpc.Invoke(ctx, 0x0000, in, out, c.cc) |
| 58 |
if err != nil { |
| 59 |
return nil, err |
| 60 |
} |
| 61 |
return out, nil |
| 62 |
} |
| 63 |
|
| 64 |
func (c *fooClient) ServerStreamMethod(ctx context.Context, in *Request) (Foo_ServerStreamMethodClient, error) { |
| 65 |
stream, err := yarpc.NewClientStream(ctx, &_Foo_serviceDesc.Streams[0], c.cc, 0x0001) |
| 66 |
if err != nil { |
| 67 |
return nil, err |
| 68 |
} |
| 69 |
x := &fooServerStreamMethodClient{stream} |
| 70 |
if err := x.ClientStream.SendMsg(in); err != nil { |
| 71 |
return nil, err |
| 72 |
} |
| 73 |
return x, nil |
| 74 |
} |
| 75 |
|
| 76 |
type Foo_ServerStreamMethodClient interface { |
| 77 |
Recv() (*Response, error) |
| 78 |
yarpc.ClientStream |
| 79 |
} |
| 80 |
|
| 81 |
type fooServerStreamMethodClient struct { |
| 82 |
yarpc.ClientStream |
| 83 |
} |
| 84 |
|
| 85 |
func (x *fooServerStreamMethodClient) Recv() (*Response, error) { |
| 86 |
m := new(Response) |
| 87 |
if err := x.ClientStream.RecvMsg(m); err != nil { |
| 88 |
return nil, err |
| 89 |
} |
| 90 |
return m, nil |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
type FooServer interface { |
| 96 |
UnaryMethod(context.Context, *Request) (*Response, error) |
| 97 |
ServerStreamMethod(*Request, Foo_ServerStreamMethodServer) error |
| 98 |
} |
| 99 |
|
| 100 |
func RegisterFooServer(s *yarpc.Server, srv FooServer) { |
| 101 |
s.RegisterService(&_Foo_serviceDesc, srv) |
| 102 |
} |
| 103 |
|
| 104 |
func _Foo_UnaryMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { |
| 105 |
in := new(Request) |
| 106 |
if err := dec(in); err != nil { |
| 107 |
return nil, err |
| 108 |
} |
| 109 |
return srv.(FooServer).UnaryMethod(ctx, in) |
| 110 |
} |
| 111 |
|
| 112 |
func _Foo_ServerStreamMethod_Handler(srv interface{}, stream yarpc.ServerStream) error { |
| 113 |
m := new(Request) |
| 114 |
if err := stream.RecvMsg(m); err != nil { |
| 115 |
return err |
| 116 |
} |
| 117 |
return srv.(FooServer).ServerStreamMethod(m, &fooServerStreamMethodServer{stream}) |
| 118 |
} |
| 119 |
|
| 120 |
type Foo_ServerStreamMethodServer interface { |
| 121 |
Send(*Response) error |
| 122 |
yarpc.ServerStream |
| 123 |
} |
| 124 |
|
| 125 |
type fooServerStreamMethodServer struct { |
| 126 |
yarpc.ServerStream |
| 127 |
} |
| 128 |
|
| 129 |
func (x *fooServerStreamMethodServer) Send(m *Response) error { |
| 130 |
return x.ServerStream.SendMsg(m) |
| 131 |
} |
| 132 |
|
| 133 |
var _Foo_serviceDesc = yarpc.ServiceDesc{ |
| 134 |
ServiceName: "foo.Foo", |
| 135 |
Index: 0, |
| 136 |
HandlerType: (*FooServer)(nil), |
| 137 |
Methods: []yarpc.MethodDesc{ |
| 138 |
{ |
| 139 |
MethodName: "UnaryMethod", |
| 140 |
Index: 0, |
| 141 |
Handler: _Foo_UnaryMethod_Handler, |
| 142 |
}, |
| 143 |
}, |
| 144 |
Streams: []yarpc.StreamDesc{ |
| 145 |
{ |
| 146 |
StreamName: "ServerStreamMethod", |
| 147 |
Index: 1, |
| 148 |
Handler: _Foo_ServerStreamMethod_Handler, |
| 149 |
ServerStreams: true, |
| 150 |
}, |
| 151 |
}, |
| 152 |
Metadata: "test/foo/foo.proto", |
| 153 |
} |