1
2
3
4
16 package testpb
17
18 import (
19 fmt "fmt"
20 math "math"
21
22 proto "github.com/golang/protobuf/proto"
23 context "golang.org/x/net/context"
24 grpc "google.golang.org/grpc"
25 )
26
27
28 var _ = proto.Marshal
29 var _ = fmt.Errorf
30 var _ = math.Inf
31
32
33
34
35
36 const _ = proto.ProtoPackageIsVersion2
37
38 type FooRequest struct {
39 Fail bool `protobuf:"varint,1,opt,name=fail" json:"fail,omitempty"`
40 SleepNanos int64 `protobuf:"varint,2,opt,name=sleep_nanos,json=sleepNanos" json:"sleep_nanos,omitempty"`
41 }
42
43 func (m *FooRequest) Reset() { *m = FooRequest{} }
44 func (m *FooRequest) String() string { return proto.CompactTextString(m) }
45 func (*FooRequest) ProtoMessage() {}
46 func (*FooRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
47
48 func (m *FooRequest) GetFail() bool {
49 if m != nil {
50 return m.Fail
51 }
52 return false
53 }
54
55 func (m *FooRequest) GetSleepNanos() int64 {
56 if m != nil {
57 return m.SleepNanos
58 }
59 return 0
60 }
61
62 type FooResponse struct {
63 }
64
65 func (m *FooResponse) Reset() { *m = FooResponse{} }
66 func (m *FooResponse) String() string { return proto.CompactTextString(m) }
67 func (*FooResponse) ProtoMessage() {}
68 func (*FooResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
69
70 func init() {
71 proto.RegisterType((*FooRequest)(nil), "testpb.FooRequest")
72 proto.RegisterType((*FooResponse)(nil), "testpb.FooResponse")
73 }
74
75
76 var _ context.Context
77 var _ grpc.ClientConn
78
79
80
81 const _ = grpc.SupportPackageIsVersion4
82
83
84
85 type FooClient interface {
86 Single(ctx context.Context, in *FooRequest, opts ...grpc.CallOption) (*FooResponse, error)
87 Multiple(ctx context.Context, opts ...grpc.CallOption) (Foo_MultipleClient, error)
88 }
89
90 type fooClient struct {
91 cc *grpc.ClientConn
92 }
93
94 func NewFooClient(cc *grpc.ClientConn) FooClient {
95 return &fooClient{cc}
96 }
97
98 func (c *fooClient) Single(ctx context.Context, in *FooRequest, opts ...grpc.CallOption) (*FooResponse, error) {
99 out := new(FooResponse)
100 err := grpc.Invoke(ctx, "/testpb.Foo/Single", in, out, c.cc, opts...)
101 if err != nil {
102 return nil, err
103 }
104 return out, nil
105 }
106
107 func (c *fooClient) Multiple(ctx context.Context, opts ...grpc.CallOption) (Foo_MultipleClient, error) {
108 stream, err := grpc.NewClientStream(ctx, &_Foo_serviceDesc.Streams[0], c.cc, "/testpb.Foo/Multiple", opts...)
109 if err != nil {
110 return nil, err
111 }
112 x := &fooMultipleClient{stream}
113 return x, nil
114 }
115
116 type Foo_MultipleClient interface {
117 Send(*FooRequest) error
118 Recv() (*FooResponse, error)
119 grpc.ClientStream
120 }
121
122 type fooMultipleClient struct {
123 grpc.ClientStream
124 }
125
126 func (x *fooMultipleClient) Send(m *FooRequest) error {
127 return x.ClientStream.SendMsg(m)
128 }
129
130 func (x *fooMultipleClient) Recv() (*FooResponse, error) {
131 m := new(FooResponse)
132 if err := x.ClientStream.RecvMsg(m); err != nil {
133 return nil, err
134 }
135 return m, nil
136 }
137
138
139
140 type FooServer interface {
141 Single(context.Context, *FooRequest) (*FooResponse, error)
142 Multiple(Foo_MultipleServer) error
143 }
144
145 func RegisterFooServer(s *grpc.Server, srv FooServer) {
146 s.RegisterService(&_Foo_serviceDesc, srv)
147 }
148
149 func _Foo_Single_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
150 in := new(FooRequest)
151 if err := dec(in); err != nil {
152 return nil, err
153 }
154 if interceptor == nil {
155 return srv.(FooServer).Single(ctx, in)
156 }
157 info := &grpc.UnaryServerInfo{
158 Server: srv,
159 FullMethod: "/testpb.Foo/Single",
160 }
161 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
162 return srv.(FooServer).Single(ctx, req.(*FooRequest))
163 }
164 return interceptor(ctx, in, info, handler)
165 }
166
167 func _Foo_Multiple_Handler(srv interface{}, stream grpc.ServerStream) error {
168 return srv.(FooServer).Multiple(&fooMultipleServer{stream})
169 }
170
171 type Foo_MultipleServer interface {
172 Send(*FooResponse) error
173 Recv() (*FooRequest, error)
174 grpc.ServerStream
175 }
176
177 type fooMultipleServer struct {
178 grpc.ServerStream
179 }
180
181 func (x *fooMultipleServer) Send(m *FooResponse) error {
182 return x.ServerStream.SendMsg(m)
183 }
184
185 func (x *fooMultipleServer) Recv() (*FooRequest, error) {
186 m := new(FooRequest)
187 if err := x.ServerStream.RecvMsg(m); err != nil {
188 return nil, err
189 }
190 return m, nil
191 }
192
193 var _Foo_serviceDesc = grpc.ServiceDesc{
194 ServiceName: "testpb.Foo",
195 HandlerType: (*FooServer)(nil),
196 Methods: []grpc.MethodDesc{
197 {
198 MethodName: "Single",
199 Handler: _Foo_Single_Handler,
200 },
201 },
202 Streams: []grpc.StreamDesc{
203 {
204 StreamName: "Multiple",
205 Handler: _Foo_Multiple_Handler,
206 ServerStreams: true,
207 ClientStreams: true,
208 },
209 },
210 Metadata: "test.proto",
211 }
212
213 func init() { proto.RegisterFile("test.proto", fileDescriptor0) }
214
215 var fileDescriptor0 = []byte{
216
217 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e,
218 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0xb1, 0x0b, 0x92, 0x94, 0x1c, 0xb9, 0xb8,
219 0xdc, 0xf2, 0xf3, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x84, 0xb8, 0x58, 0xd2, 0x12,
220 0x33, 0x73, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x82, 0xc0, 0x6c, 0x21, 0x79, 0x2e, 0xee, 0xe2,
221 0x9c, 0xd4, 0xd4, 0x82, 0xf8, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xe6,
222 0x20, 0x2e, 0xb0, 0x90, 0x1f, 0x48, 0x44, 0x89, 0x97, 0x8b, 0x1b, 0x6c, 0x44, 0x71, 0x41, 0x7e,
223 0x5e, 0x71, 0xaa, 0x51, 0x21, 0x17, 0xb3, 0x5b, 0x7e, 0xbe, 0x90, 0x21, 0x17, 0x5b, 0x70, 0x66,
224 0x5e, 0x7a, 0x4e, 0xaa, 0x90, 0x90, 0x1e, 0xc4, 0x2e, 0x3d, 0x84, 0x45, 0x52, 0xc2, 0x28, 0x62,
225 0x10, 0x9d, 0x42, 0xe6, 0x5c, 0x1c, 0xbe, 0xa5, 0x39, 0x25, 0x99, 0x05, 0x24, 0x68, 0xd2, 0x60,
226 0x34, 0x60, 0x4c, 0x62, 0x03, 0xfb, 0xc9, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x37, 0xb1, 0x2d,
227 0x6e, 0xe1, 0x00, 0x00, 0x00,
228 }
229
230
231
View as plain text