blob: af0e095a700ceec9ee07149b3f4ebc5a660ed290 [file] [log] [blame]
Todd Wange5d67b42014-05-27 10:48:07 -07001// This file was auto-generated by the veyron vdl tool.
Tilak Sharma43395f32014-05-27 11:33:38 -07002// Source: test_base.vdl
Jiri Simsa5293dcb2014-05-10 09:56:38 -07003
4package test_base
5
6import (
Todd Wang702385a2014-11-07 01:54:08 -08007 // The non-user imports are prefixed with "__" to prevent collisions.
8 __io "io"
Jiri Simsa764efb72014-12-25 20:57:03 -08009 __veyron2 "v.io/core/veyron2"
10 __context "v.io/core/veyron2/context"
11 __ipc "v.io/core/veyron2/ipc"
12 __vdl "v.io/core/veyron2/vdl"
Jiri Simsa5293dcb2014-05-10 09:56:38 -070013)
14
15type Struct struct {
16 X int32
17 Y int32
18}
19
Todd Wang34ed4c62014-11-26 15:15:52 -080020func (Struct) __VDLReflect(struct {
Jiri Simsa764efb72014-12-25 20:57:03 -080021 Name string "v.io/core/veyron/tools/vrpc/test_base.Struct"
Todd Wang34ed4c62014-11-26 15:15:52 -080022}) {
23}
24
25func init() {
26 __vdl.Register(Struct{})
27}
28
Todd Wang702385a2014-11-07 01:54:08 -080029// TypeTesterClientMethods is the client interface
30// containing TypeTester methods.
Todd Wang06eeab02015-01-20 11:34:14 -080031//
32// TypeTester methods are listed in alphabetical order, to make it easier to
33// test Signature output, which sorts methods alphabetically.
Todd Wang702385a2014-11-07 01:54:08 -080034type TypeTesterClientMethods interface {
Todd Wang06eeab02015-01-20 11:34:14 -080035 // Methods to test support for primitive types.
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -080036 EchoBool(ctx *__context.T, I1 bool, opts ...__ipc.CallOpt) (O1 bool, err error)
37 EchoFloat32(ctx *__context.T, I1 float32, opts ...__ipc.CallOpt) (O1 float32, err error)
38 EchoFloat64(ctx *__context.T, I1 float64, opts ...__ipc.CallOpt) (O1 float64, err error)
39 EchoInt32(ctx *__context.T, I1 int32, opts ...__ipc.CallOpt) (O1 int32, err error)
40 EchoInt64(ctx *__context.T, I1 int64, opts ...__ipc.CallOpt) (O1 int64, err error)
41 EchoString(ctx *__context.T, I1 string, opts ...__ipc.CallOpt) (O1 string, err error)
42 EchoByte(ctx *__context.T, I1 byte, opts ...__ipc.CallOpt) (O1 byte, err error)
Todd Wang06eeab02015-01-20 11:34:14 -080043 EchoUint32(ctx *__context.T, I1 uint32, opts ...__ipc.CallOpt) (O1 uint32, err error)
44 EchoUint64(ctx *__context.T, I1 uint64, opts ...__ipc.CallOpt) (O1 uint64, err error)
Jiri Simsa5293dcb2014-05-10 09:56:38 -070045 // Methods to test support for composite types.
Todd Wang06eeab02015-01-20 11:34:14 -080046 XEchoArray(ctx *__context.T, I1 [2]int32, opts ...__ipc.CallOpt) (O1 [2]int32, err error)
47 XEchoMap(ctx *__context.T, I1 map[int32]string, opts ...__ipc.CallOpt) (O1 map[int32]string, err error)
48 XEchoSet(ctx *__context.T, I1 map[int32]struct{}, opts ...__ipc.CallOpt) (O1 map[int32]struct{}, err error)
49 XEchoSlice(ctx *__context.T, I1 []int32, opts ...__ipc.CallOpt) (O1 []int32, err error)
50 XEchoStruct(ctx *__context.T, I1 Struct, opts ...__ipc.CallOpt) (O1 Struct, err error)
Jiri Simsa5293dcb2014-05-10 09:56:38 -070051 // Methods to test support for different number of arguments.
Todd Wang06eeab02015-01-20 11:34:14 -080052 YMultiArg(ctx *__context.T, I1 int32, I2 int32, opts ...__ipc.CallOpt) (O1 int32, O2 int32, err error)
53 YNoArgs(*__context.T, ...__ipc.CallOpt) error
Jiri Simsa5293dcb2014-05-10 09:56:38 -070054 // Methods to test support for streaming.
Todd Wang06eeab02015-01-20 11:34:14 -080055 ZStream(ctx *__context.T, NumStreamItems int32, StreamItem bool, opts ...__ipc.CallOpt) (TypeTesterZStreamCall, error)
Jiri Simsa5293dcb2014-05-10 09:56:38 -070056}
57
Todd Wang702385a2014-11-07 01:54:08 -080058// TypeTesterClientStub adds universal methods to TypeTesterClientMethods.
59type TypeTesterClientStub interface {
60 TypeTesterClientMethods
61 __ipc.UniversalServiceMethods
Jiri Simsa5293dcb2014-05-10 09:56:38 -070062}
63
Todd Wang702385a2014-11-07 01:54:08 -080064// TypeTesterClient returns a client stub for TypeTester.
65func TypeTesterClient(name string, opts ...__ipc.BindOpt) TypeTesterClientStub {
66 var client __ipc.Client
67 for _, opt := range opts {
68 if clientOpt, ok := opt.(__ipc.Client); ok {
69 client = clientOpt
70 }
71 }
72 return implTypeTesterClientStub{name, client}
73}
74
75type implTypeTesterClientStub struct {
76 name string
77 client __ipc.Client
78}
79
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -080080func (c implTypeTesterClientStub) c(ctx *__context.T) __ipc.Client {
Todd Wang702385a2014-11-07 01:54:08 -080081 if c.client != nil {
82 return c.client
83 }
Suharsh Sivakumarbe80c1b2015-01-07 18:51:16 -080084 return __veyron2.GetClient(ctx)
Todd Wang702385a2014-11-07 01:54:08 -080085}
86
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -080087func (c implTypeTesterClientStub) EchoBool(ctx *__context.T, i0 bool, opts ...__ipc.CallOpt) (o0 bool, err error) {
Todd Wang702385a2014-11-07 01:54:08 -080088 var call __ipc.Call
89 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoBool", []interface{}{i0}, opts...); err != nil {
90 return
91 }
92 if ierr := call.Finish(&o0, &err); ierr != nil {
93 err = ierr
94 }
95 return
96}
97
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -080098func (c implTypeTesterClientStub) EchoFloat32(ctx *__context.T, i0 float32, opts ...__ipc.CallOpt) (o0 float32, err error) {
Todd Wang702385a2014-11-07 01:54:08 -080099 var call __ipc.Call
100 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoFloat32", []interface{}{i0}, opts...); err != nil {
101 return
102 }
103 if ierr := call.Finish(&o0, &err); ierr != nil {
104 err = ierr
105 }
106 return
107}
108
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -0800109func (c implTypeTesterClientStub) EchoFloat64(ctx *__context.T, i0 float64, opts ...__ipc.CallOpt) (o0 float64, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800110 var call __ipc.Call
111 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoFloat64", []interface{}{i0}, opts...); err != nil {
112 return
113 }
114 if ierr := call.Finish(&o0, &err); ierr != nil {
115 err = ierr
116 }
117 return
118}
119
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -0800120func (c implTypeTesterClientStub) EchoInt32(ctx *__context.T, i0 int32, opts ...__ipc.CallOpt) (o0 int32, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800121 var call __ipc.Call
122 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoInt32", []interface{}{i0}, opts...); err != nil {
123 return
124 }
125 if ierr := call.Finish(&o0, &err); ierr != nil {
126 err = ierr
127 }
128 return
129}
130
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -0800131func (c implTypeTesterClientStub) EchoInt64(ctx *__context.T, i0 int64, opts ...__ipc.CallOpt) (o0 int64, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800132 var call __ipc.Call
133 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoInt64", []interface{}{i0}, opts...); err != nil {
134 return
135 }
136 if ierr := call.Finish(&o0, &err); ierr != nil {
137 err = ierr
138 }
139 return
140}
141
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -0800142func (c implTypeTesterClientStub) EchoString(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (o0 string, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800143 var call __ipc.Call
144 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoString", []interface{}{i0}, opts...); err != nil {
145 return
146 }
147 if ierr := call.Finish(&o0, &err); ierr != nil {
148 err = ierr
149 }
150 return
151}
152
Matt Rosencrantz4f8ac602014-12-29 14:42:48 -0800153func (c implTypeTesterClientStub) EchoByte(ctx *__context.T, i0 byte, opts ...__ipc.CallOpt) (o0 byte, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800154 var call __ipc.Call
155 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoByte", []interface{}{i0}, opts...); err != nil {
156 return
157 }
158 if ierr := call.Finish(&o0, &err); ierr != nil {
159 err = ierr
160 }
161 return
162}
163
Todd Wang06eeab02015-01-20 11:34:14 -0800164func (c implTypeTesterClientStub) EchoUint32(ctx *__context.T, i0 uint32, opts ...__ipc.CallOpt) (o0 uint32, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800165 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800166 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoUint32", []interface{}{i0}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800167 return
168 }
169 if ierr := call.Finish(&o0, &err); ierr != nil {
170 err = ierr
171 }
172 return
173}
174
Todd Wang06eeab02015-01-20 11:34:14 -0800175func (c implTypeTesterClientStub) EchoUint64(ctx *__context.T, i0 uint64, opts ...__ipc.CallOpt) (o0 uint64, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800176 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800177 if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoUint64", []interface{}{i0}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800178 return
179 }
180 if ierr := call.Finish(&o0, &err); ierr != nil {
181 err = ierr
182 }
183 return
184}
185
Todd Wang06eeab02015-01-20 11:34:14 -0800186func (c implTypeTesterClientStub) XEchoArray(ctx *__context.T, i0 [2]int32, opts ...__ipc.CallOpt) (o0 [2]int32, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800187 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800188 if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoArray", []interface{}{i0}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800189 return
190 }
191 if ierr := call.Finish(&o0, &err); ierr != nil {
192 err = ierr
193 }
194 return
195}
196
Todd Wang06eeab02015-01-20 11:34:14 -0800197func (c implTypeTesterClientStub) XEchoMap(ctx *__context.T, i0 map[int32]string, opts ...__ipc.CallOpt) (o0 map[int32]string, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800198 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800199 if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoMap", []interface{}{i0}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800200 return
201 }
202 if ierr := call.Finish(&o0, &err); ierr != nil {
203 err = ierr
204 }
205 return
206}
207
Todd Wang06eeab02015-01-20 11:34:14 -0800208func (c implTypeTesterClientStub) XEchoSet(ctx *__context.T, i0 map[int32]struct{}, opts ...__ipc.CallOpt) (o0 map[int32]struct{}, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800209 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800210 if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoSet", []interface{}{i0}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800211 return
212 }
213 if ierr := call.Finish(&o0, &err); ierr != nil {
214 err = ierr
215 }
216 return
217}
218
Todd Wang06eeab02015-01-20 11:34:14 -0800219func (c implTypeTesterClientStub) XEchoSlice(ctx *__context.T, i0 []int32, opts ...__ipc.CallOpt) (o0 []int32, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800220 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800221 if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoSlice", []interface{}{i0}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800222 return
223 }
224 if ierr := call.Finish(&o0, &err); ierr != nil {
225 err = ierr
226 }
227 return
228}
229
Todd Wang06eeab02015-01-20 11:34:14 -0800230func (c implTypeTesterClientStub) XEchoStruct(ctx *__context.T, i0 Struct, opts ...__ipc.CallOpt) (o0 Struct, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800231 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800232 if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoStruct", []interface{}{i0}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800233 return
234 }
Todd Wang06eeab02015-01-20 11:34:14 -0800235 if ierr := call.Finish(&o0, &err); ierr != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800236 err = ierr
237 }
238 return
239}
240
Todd Wang06eeab02015-01-20 11:34:14 -0800241func (c implTypeTesterClientStub) YMultiArg(ctx *__context.T, i0 int32, i1 int32, opts ...__ipc.CallOpt) (o0 int32, o1 int32, err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800242 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800243 if call, err = c.c(ctx).StartCall(ctx, c.name, "YMultiArg", []interface{}{i0, i1}, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800244 return
245 }
246 if ierr := call.Finish(&o0, &o1, &err); ierr != nil {
247 err = ierr
248 }
249 return
250}
251
Todd Wang06eeab02015-01-20 11:34:14 -0800252func (c implTypeTesterClientStub) YNoArgs(ctx *__context.T, opts ...__ipc.CallOpt) (err error) {
Todd Wang702385a2014-11-07 01:54:08 -0800253 var call __ipc.Call
Todd Wang06eeab02015-01-20 11:34:14 -0800254 if call, err = c.c(ctx).StartCall(ctx, c.name, "YNoArgs", nil, opts...); err != nil {
Todd Wang702385a2014-11-07 01:54:08 -0800255 return
256 }
Todd Wang06eeab02015-01-20 11:34:14 -0800257 if ierr := call.Finish(&err); ierr != nil {
258 err = ierr
259 }
260 return
261}
262
263func (c implTypeTesterClientStub) ZStream(ctx *__context.T, i0 int32, i1 bool, opts ...__ipc.CallOpt) (ocall TypeTesterZStreamCall, err error) {
264 var call __ipc.Call
265 if call, err = c.c(ctx).StartCall(ctx, c.name, "ZStream", []interface{}{i0, i1}, opts...); err != nil {
266 return
267 }
268 ocall = &implTypeTesterZStreamCall{Call: call}
Todd Wang702385a2014-11-07 01:54:08 -0800269 return
270}
271
Todd Wang06eeab02015-01-20 11:34:14 -0800272// TypeTesterZStreamClientStream is the client stream for TypeTester.ZStream.
273type TypeTesterZStreamClientStream interface {
274 // RecvStream returns the receiver side of the TypeTester.ZStream client stream.
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700275 RecvStream() interface {
Todd Wang702385a2014-11-07 01:54:08 -0800276 // Advance stages an item so that it may be retrieved via Value. Returns
277 // true iff there is an item to retrieve. Advance must be called before
278 // Value is called. May block if an item is not available.
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700279 Advance() bool
Todd Wang702385a2014-11-07 01:54:08 -0800280 // Value returns the item that was staged by Advance. May panic if Advance
281 // returned false or was not called. Never blocks.
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700282 Value() bool
Todd Wang702385a2014-11-07 01:54:08 -0800283 // Err returns any error encountered by Advance. Never blocks.
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700284 Err() error
285 }
Todd Wang702385a2014-11-07 01:54:08 -0800286}
Shyam Jayaramanc4aed6e2014-07-22 14:25:06 -0700287
Todd Wang06eeab02015-01-20 11:34:14 -0800288// TypeTesterZStreamCall represents the call returned from TypeTester.ZStream.
289type TypeTesterZStreamCall interface {
290 TypeTesterZStreamClientStream
Todd Wang702385a2014-11-07 01:54:08 -0800291 // Finish blocks until the server is done, and returns the positional return
292 // values for call.
Shyam Jayaramanc4aed6e2014-07-22 14:25:06 -0700293 //
Matt Rosencrantz9346b412014-12-18 15:59:19 -0800294 // Finish returns immediately if the call has been canceled; depending on the
Todd Wang702385a2014-11-07 01:54:08 -0800295 // timing the output could either be an error signaling cancelation, or the
296 // valid positional return values from the server.
Shyam Jayaramanc4aed6e2014-07-22 14:25:06 -0700297 //
Matt Rosencrantz9346b412014-12-18 15:59:19 -0800298 // Calling Finish is mandatory for releasing stream resources, unless the call
299 // has been canceled or any of the other methods return an error. Finish should
Todd Wang702385a2014-11-07 01:54:08 -0800300 // be called at most once.
301 Finish() error
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700302}
303
Todd Wang06eeab02015-01-20 11:34:14 -0800304type implTypeTesterZStreamCall struct {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800305 __ipc.Call
306 valRecv bool
307 errRecv error
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700308}
309
Todd Wang06eeab02015-01-20 11:34:14 -0800310func (c *implTypeTesterZStreamCall) RecvStream() interface {
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700311 Advance() bool
312 Value() bool
313 Err() error
314} {
Todd Wang06eeab02015-01-20 11:34:14 -0800315 return implTypeTesterZStreamCallRecv{c}
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800316}
317
Todd Wang06eeab02015-01-20 11:34:14 -0800318type implTypeTesterZStreamCallRecv struct {
319 c *implTypeTesterZStreamCall
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800320}
321
Todd Wang06eeab02015-01-20 11:34:14 -0800322func (c implTypeTesterZStreamCallRecv) Advance() bool {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800323 c.c.errRecv = c.c.Recv(&c.c.valRecv)
324 return c.c.errRecv == nil
325}
Todd Wang06eeab02015-01-20 11:34:14 -0800326func (c implTypeTesterZStreamCallRecv) Value() bool {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800327 return c.c.valRecv
328}
Todd Wang06eeab02015-01-20 11:34:14 -0800329func (c implTypeTesterZStreamCallRecv) Err() error {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800330 if c.c.errRecv == __io.EOF {
331 return nil
332 }
333 return c.c.errRecv
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700334}
Todd Wang06eeab02015-01-20 11:34:14 -0800335func (c *implTypeTesterZStreamCall) Finish() (err error) {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800336 if ierr := c.Call.Finish(&err); ierr != nil {
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700337 err = ierr
338 }
339 return
340}
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700341
Todd Wang702385a2014-11-07 01:54:08 -0800342// TypeTesterServerMethods is the interface a server writer
343// implements for TypeTester.
Todd Wang06eeab02015-01-20 11:34:14 -0800344//
345// TypeTester methods are listed in alphabetical order, to make it easier to
346// test Signature output, which sorts methods alphabetically.
Todd Wang702385a2014-11-07 01:54:08 -0800347type TypeTesterServerMethods interface {
Todd Wang06eeab02015-01-20 11:34:14 -0800348 // Methods to test support for primitive types.
Todd Wang383e88c2014-12-18 01:52:34 -0800349 EchoBool(ctx __ipc.ServerContext, I1 bool) (O1 bool, err error)
350 EchoFloat32(ctx __ipc.ServerContext, I1 float32) (O1 float32, err error)
351 EchoFloat64(ctx __ipc.ServerContext, I1 float64) (O1 float64, err error)
352 EchoInt32(ctx __ipc.ServerContext, I1 int32) (O1 int32, err error)
353 EchoInt64(ctx __ipc.ServerContext, I1 int64) (O1 int64, err error)
354 EchoString(ctx __ipc.ServerContext, I1 string) (O1 string, err error)
355 EchoByte(ctx __ipc.ServerContext, I1 byte) (O1 byte, err error)
Todd Wang06eeab02015-01-20 11:34:14 -0800356 EchoUint32(ctx __ipc.ServerContext, I1 uint32) (O1 uint32, err error)
357 EchoUint64(ctx __ipc.ServerContext, I1 uint64) (O1 uint64, err error)
Todd Wang702385a2014-11-07 01:54:08 -0800358 // Methods to test support for composite types.
Todd Wang06eeab02015-01-20 11:34:14 -0800359 XEchoArray(ctx __ipc.ServerContext, I1 [2]int32) (O1 [2]int32, err error)
360 XEchoMap(ctx __ipc.ServerContext, I1 map[int32]string) (O1 map[int32]string, err error)
361 XEchoSet(ctx __ipc.ServerContext, I1 map[int32]struct{}) (O1 map[int32]struct{}, err error)
362 XEchoSlice(ctx __ipc.ServerContext, I1 []int32) (O1 []int32, err error)
363 XEchoStruct(ctx __ipc.ServerContext, I1 Struct) (O1 Struct, err error)
Todd Wang702385a2014-11-07 01:54:08 -0800364 // Methods to test support for different number of arguments.
Todd Wang06eeab02015-01-20 11:34:14 -0800365 YMultiArg(ctx __ipc.ServerContext, I1 int32, I2 int32) (O1 int32, O2 int32, err error)
366 YNoArgs(__ipc.ServerContext) error
Todd Wang702385a2014-11-07 01:54:08 -0800367 // Methods to test support for streaming.
Todd Wang06eeab02015-01-20 11:34:14 -0800368 ZStream(ctx TypeTesterZStreamContext, NumStreamItems int32, StreamItem bool) error
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700369}
370
Todd Wang702385a2014-11-07 01:54:08 -0800371// TypeTesterServerStubMethods is the server interface containing
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800372// TypeTester methods, as expected by ipc.Server.
373// The only difference between this interface and TypeTesterServerMethods
374// is the streaming methods.
Todd Wang702385a2014-11-07 01:54:08 -0800375type TypeTesterServerStubMethods interface {
Todd Wang06eeab02015-01-20 11:34:14 -0800376 // Methods to test support for primitive types.
Todd Wang383e88c2014-12-18 01:52:34 -0800377 EchoBool(ctx __ipc.ServerContext, I1 bool) (O1 bool, err error)
378 EchoFloat32(ctx __ipc.ServerContext, I1 float32) (O1 float32, err error)
379 EchoFloat64(ctx __ipc.ServerContext, I1 float64) (O1 float64, err error)
380 EchoInt32(ctx __ipc.ServerContext, I1 int32) (O1 int32, err error)
381 EchoInt64(ctx __ipc.ServerContext, I1 int64) (O1 int64, err error)
382 EchoString(ctx __ipc.ServerContext, I1 string) (O1 string, err error)
383 EchoByte(ctx __ipc.ServerContext, I1 byte) (O1 byte, err error)
Todd Wang06eeab02015-01-20 11:34:14 -0800384 EchoUint32(ctx __ipc.ServerContext, I1 uint32) (O1 uint32, err error)
385 EchoUint64(ctx __ipc.ServerContext, I1 uint64) (O1 uint64, err error)
Todd Wang702385a2014-11-07 01:54:08 -0800386 // Methods to test support for composite types.
Todd Wang06eeab02015-01-20 11:34:14 -0800387 XEchoArray(ctx __ipc.ServerContext, I1 [2]int32) (O1 [2]int32, err error)
388 XEchoMap(ctx __ipc.ServerContext, I1 map[int32]string) (O1 map[int32]string, err error)
389 XEchoSet(ctx __ipc.ServerContext, I1 map[int32]struct{}) (O1 map[int32]struct{}, err error)
390 XEchoSlice(ctx __ipc.ServerContext, I1 []int32) (O1 []int32, err error)
391 XEchoStruct(ctx __ipc.ServerContext, I1 Struct) (O1 Struct, err error)
Todd Wang702385a2014-11-07 01:54:08 -0800392 // Methods to test support for different number of arguments.
Todd Wang06eeab02015-01-20 11:34:14 -0800393 YMultiArg(ctx __ipc.ServerContext, I1 int32, I2 int32) (O1 int32, O2 int32, err error)
394 YNoArgs(__ipc.ServerContext) error
Todd Wang702385a2014-11-07 01:54:08 -0800395 // Methods to test support for streaming.
Todd Wang06eeab02015-01-20 11:34:14 -0800396 ZStream(ctx *TypeTesterZStreamContextStub, NumStreamItems int32, StreamItem bool) error
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700397}
398
Todd Wang702385a2014-11-07 01:54:08 -0800399// TypeTesterServerStub adds universal methods to TypeTesterServerStubMethods.
400type TypeTesterServerStub interface {
401 TypeTesterServerStubMethods
Todd Wang5739dda2014-11-16 22:44:02 -0800402 // Describe the TypeTester interfaces.
403 Describe__() []__ipc.InterfaceDesc
Todd Wang702385a2014-11-07 01:54:08 -0800404}
405
406// TypeTesterServer returns a server stub for TypeTester.
407// It converts an implementation of TypeTesterServerMethods into
408// an object that may be used by ipc.Server.
409func TypeTesterServer(impl TypeTesterServerMethods) TypeTesterServerStub {
410 stub := implTypeTesterServerStub{
411 impl: impl,
Shyam Jayaraman97b9dca2014-07-31 13:30:46 -0700412 }
Todd Wang702385a2014-11-07 01:54:08 -0800413 // Initialize GlobState; always check the stub itself first, to handle the
414 // case where the user has the Glob method defined in their VDL source.
415 if gs := __ipc.NewGlobState(stub); gs != nil {
416 stub.gs = gs
417 } else if gs := __ipc.NewGlobState(impl); gs != nil {
418 stub.gs = gs
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700419 }
Robin Thellend94bc4642014-11-05 18:05:08 -0800420 return stub
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700421}
422
Todd Wang702385a2014-11-07 01:54:08 -0800423type implTypeTesterServerStub struct {
424 impl TypeTesterServerMethods
425 gs *__ipc.GlobState
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700426}
427
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800428func (s implTypeTesterServerStub) EchoBool(ctx __ipc.ServerContext, i0 bool) (bool, error) {
429 return s.impl.EchoBool(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700430}
431
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800432func (s implTypeTesterServerStub) EchoFloat32(ctx __ipc.ServerContext, i0 float32) (float32, error) {
433 return s.impl.EchoFloat32(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700434}
435
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800436func (s implTypeTesterServerStub) EchoFloat64(ctx __ipc.ServerContext, i0 float64) (float64, error) {
437 return s.impl.EchoFloat64(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700438}
439
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800440func (s implTypeTesterServerStub) EchoInt32(ctx __ipc.ServerContext, i0 int32) (int32, error) {
441 return s.impl.EchoInt32(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700442}
443
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800444func (s implTypeTesterServerStub) EchoInt64(ctx __ipc.ServerContext, i0 int64) (int64, error) {
445 return s.impl.EchoInt64(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700446}
447
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800448func (s implTypeTesterServerStub) EchoString(ctx __ipc.ServerContext, i0 string) (string, error) {
449 return s.impl.EchoString(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700450}
451
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800452func (s implTypeTesterServerStub) EchoByte(ctx __ipc.ServerContext, i0 byte) (byte, error) {
453 return s.impl.EchoByte(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700454}
455
Todd Wang06eeab02015-01-20 11:34:14 -0800456func (s implTypeTesterServerStub) EchoUint32(ctx __ipc.ServerContext, i0 uint32) (uint32, error) {
457 return s.impl.EchoUint32(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700458}
459
Todd Wang06eeab02015-01-20 11:34:14 -0800460func (s implTypeTesterServerStub) EchoUint64(ctx __ipc.ServerContext, i0 uint64) (uint64, error) {
461 return s.impl.EchoUint64(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700462}
463
Todd Wang06eeab02015-01-20 11:34:14 -0800464func (s implTypeTesterServerStub) XEchoArray(ctx __ipc.ServerContext, i0 [2]int32) ([2]int32, error) {
465 return s.impl.XEchoArray(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700466}
467
Todd Wang06eeab02015-01-20 11:34:14 -0800468func (s implTypeTesterServerStub) XEchoMap(ctx __ipc.ServerContext, i0 map[int32]string) (map[int32]string, error) {
469 return s.impl.XEchoMap(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700470}
471
Todd Wang06eeab02015-01-20 11:34:14 -0800472func (s implTypeTesterServerStub) XEchoSet(ctx __ipc.ServerContext, i0 map[int32]struct{}) (map[int32]struct{}, error) {
473 return s.impl.XEchoSet(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700474}
475
Todd Wang06eeab02015-01-20 11:34:14 -0800476func (s implTypeTesterServerStub) XEchoSlice(ctx __ipc.ServerContext, i0 []int32) ([]int32, error) {
477 return s.impl.XEchoSlice(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700478}
479
Todd Wang06eeab02015-01-20 11:34:14 -0800480func (s implTypeTesterServerStub) XEchoStruct(ctx __ipc.ServerContext, i0 Struct) (Struct, error) {
481 return s.impl.XEchoStruct(ctx, i0)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700482}
483
Todd Wang06eeab02015-01-20 11:34:14 -0800484func (s implTypeTesterServerStub) YMultiArg(ctx __ipc.ServerContext, i0 int32, i1 int32) (int32, int32, error) {
485 return s.impl.YMultiArg(ctx, i0, i1)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700486}
487
Todd Wang06eeab02015-01-20 11:34:14 -0800488func (s implTypeTesterServerStub) YNoArgs(ctx __ipc.ServerContext) error {
489 return s.impl.YNoArgs(ctx)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700490}
491
Todd Wang06eeab02015-01-20 11:34:14 -0800492func (s implTypeTesterServerStub) ZStream(ctx *TypeTesterZStreamContextStub, i0 int32, i1 bool) error {
493 return s.impl.ZStream(ctx, i0, i1)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700494}
495
Robin Thellend39ac3232014-12-02 09:50:41 -0800496func (s implTypeTesterServerStub) Globber() *__ipc.GlobState {
Todd Wang702385a2014-11-07 01:54:08 -0800497 return s.gs
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700498}
499
Todd Wang5739dda2014-11-16 22:44:02 -0800500func (s implTypeTesterServerStub) Describe__() []__ipc.InterfaceDesc {
501 return []__ipc.InterfaceDesc{TypeTesterDesc}
502}
503
504// TypeTesterDesc describes the TypeTester interface.
505var TypeTesterDesc __ipc.InterfaceDesc = descTypeTester
506
507// descTypeTester hides the desc to keep godoc clean.
508var descTypeTester = __ipc.InterfaceDesc{
509 Name: "TypeTester",
Jiri Simsa764efb72014-12-25 20:57:03 -0800510 PkgPath: "v.io/core/veyron/tools/vrpc/test_base",
Todd Wang06eeab02015-01-20 11:34:14 -0800511 Doc: "// TypeTester methods are listed in alphabetical order, to make it easier to\n// test Signature output, which sorts methods alphabetically.",
Todd Wang5739dda2014-11-16 22:44:02 -0800512 Methods: []__ipc.MethodDesc{
513 {
514 Name: "EchoBool",
Todd Wang06eeab02015-01-20 11:34:14 -0800515 Doc: "// Methods to test support for primitive types.",
Todd Wang5739dda2014-11-16 22:44:02 -0800516 InArgs: []__ipc.ArgDesc{
517 {"I1", ``}, // bool
518 },
519 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800520 {"O1", ``}, // bool
521 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800522 },
523 },
524 {
525 Name: "EchoFloat32",
526 InArgs: []__ipc.ArgDesc{
527 {"I1", ``}, // float32
528 },
529 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800530 {"O1", ``}, // float32
531 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800532 },
533 },
534 {
535 Name: "EchoFloat64",
536 InArgs: []__ipc.ArgDesc{
537 {"I1", ``}, // float64
538 },
539 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800540 {"O1", ``}, // float64
541 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800542 },
543 },
544 {
545 Name: "EchoInt32",
546 InArgs: []__ipc.ArgDesc{
547 {"I1", ``}, // int32
548 },
549 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800550 {"O1", ``}, // int32
551 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800552 },
553 },
554 {
555 Name: "EchoInt64",
556 InArgs: []__ipc.ArgDesc{
557 {"I1", ``}, // int64
558 },
559 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800560 {"O1", ``}, // int64
561 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800562 },
563 },
564 {
565 Name: "EchoString",
566 InArgs: []__ipc.ArgDesc{
567 {"I1", ``}, // string
568 },
569 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800570 {"O1", ``}, // string
571 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800572 },
573 },
574 {
575 Name: "EchoByte",
576 InArgs: []__ipc.ArgDesc{
577 {"I1", ``}, // byte
578 },
579 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800580 {"O1", ``}, // byte
581 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800582 },
583 },
584 {
Todd Wang06eeab02015-01-20 11:34:14 -0800585 Name: "EchoUint32",
Todd Wang5739dda2014-11-16 22:44:02 -0800586 InArgs: []__ipc.ArgDesc{
587 {"I1", ``}, // uint32
588 },
589 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800590 {"O1", ``}, // uint32
591 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800592 },
593 },
594 {
Todd Wang06eeab02015-01-20 11:34:14 -0800595 Name: "EchoUint64",
Todd Wang5739dda2014-11-16 22:44:02 -0800596 InArgs: []__ipc.ArgDesc{
597 {"I1", ``}, // uint64
598 },
599 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800600 {"O1", ``}, // uint64
601 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800602 },
603 },
604 {
Todd Wang06eeab02015-01-20 11:34:14 -0800605 Name: "XEchoArray",
Todd Wang5739dda2014-11-16 22:44:02 -0800606 Doc: "// Methods to test support for composite types.",
607 InArgs: []__ipc.ArgDesc{
Todd Wang06eeab02015-01-20 11:34:14 -0800608 {"I1", ``}, // [2]int32
Todd Wang5739dda2014-11-16 22:44:02 -0800609 },
610 OutArgs: []__ipc.ArgDesc{
Todd Wang06eeab02015-01-20 11:34:14 -0800611 {"O1", ``}, // [2]int32
612 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800613 },
614 },
615 {
Todd Wang06eeab02015-01-20 11:34:14 -0800616 Name: "XEchoMap",
Todd Wang5739dda2014-11-16 22:44:02 -0800617 InArgs: []__ipc.ArgDesc{
Todd Wang06eeab02015-01-20 11:34:14 -0800618 {"I1", ``}, // map[int32]string
Todd Wang5739dda2014-11-16 22:44:02 -0800619 },
620 OutArgs: []__ipc.ArgDesc{
Todd Wang06eeab02015-01-20 11:34:14 -0800621 {"O1", ``}, // map[int32]string
622 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800623 },
624 },
625 {
Todd Wang06eeab02015-01-20 11:34:14 -0800626 Name: "XEchoSet",
Todd Wang5739dda2014-11-16 22:44:02 -0800627 InArgs: []__ipc.ArgDesc{
Todd Wang06eeab02015-01-20 11:34:14 -0800628 {"I1", ``}, // map[int32]struct{}
Todd Wang5739dda2014-11-16 22:44:02 -0800629 },
630 OutArgs: []__ipc.ArgDesc{
Todd Wang06eeab02015-01-20 11:34:14 -0800631 {"O1", ``}, // map[int32]struct{}
632 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800633 },
634 },
635 {
Todd Wang06eeab02015-01-20 11:34:14 -0800636 Name: "XEchoSlice",
637 InArgs: []__ipc.ArgDesc{
638 {"I1", ``}, // []int32
639 },
640 OutArgs: []__ipc.ArgDesc{
641 {"O1", ``}, // []int32
642 {"err", ``}, // error
643 },
644 },
645 {
646 Name: "XEchoStruct",
Todd Wang5739dda2014-11-16 22:44:02 -0800647 InArgs: []__ipc.ArgDesc{
648 {"I1", ``}, // Struct
649 },
650 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800651 {"O1", ``}, // Struct
652 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800653 },
654 },
655 {
Todd Wang06eeab02015-01-20 11:34:14 -0800656 Name: "YMultiArg",
Todd Wang5739dda2014-11-16 22:44:02 -0800657 Doc: "// Methods to test support for different number of arguments.",
Todd Wang5739dda2014-11-16 22:44:02 -0800658 InArgs: []__ipc.ArgDesc{
659 {"I1", ``}, // int32
660 {"I2", ``}, // int32
661 },
662 OutArgs: []__ipc.ArgDesc{
Todd Wang383e88c2014-12-18 01:52:34 -0800663 {"O1", ``}, // int32
664 {"O2", ``}, // int32
665 {"err", ``}, // error
Todd Wang5739dda2014-11-16 22:44:02 -0800666 },
667 },
668 {
Todd Wang06eeab02015-01-20 11:34:14 -0800669 Name: "YNoArgs",
670 OutArgs: []__ipc.ArgDesc{
671 {"", ``}, // error
672 },
673 },
674 {
675 Name: "ZStream",
Todd Wang5739dda2014-11-16 22:44:02 -0800676 Doc: "// Methods to test support for streaming.",
677 InArgs: []__ipc.ArgDesc{
678 {"NumStreamItems", ``}, // int32
679 {"StreamItem", ``}, // bool
680 },
681 OutArgs: []__ipc.ArgDesc{
682 {"", ``}, // error
683 },
684 },
685 },
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700686}
687
Todd Wang06eeab02015-01-20 11:34:14 -0800688// TypeTesterZStreamServerStream is the server stream for TypeTester.ZStream.
689type TypeTesterZStreamServerStream interface {
690 // SendStream returns the send side of the TypeTester.ZStream server stream.
Todd Wang702385a2014-11-07 01:54:08 -0800691 SendStream() interface {
692 // Send places the item onto the output stream. Returns errors encountered
693 // while sending. Blocks if there is no buffer space; will unblock when
694 // buffer space is available.
695 Send(item bool) error
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700696 }
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700697}
698
Todd Wang06eeab02015-01-20 11:34:14 -0800699// TypeTesterZStreamContext represents the context passed to TypeTester.ZStream.
700type TypeTesterZStreamContext interface {
Todd Wang702385a2014-11-07 01:54:08 -0800701 __ipc.ServerContext
Todd Wang06eeab02015-01-20 11:34:14 -0800702 TypeTesterZStreamServerStream
Robin Thellend94bc4642014-11-05 18:05:08 -0800703}
704
Todd Wang06eeab02015-01-20 11:34:14 -0800705// TypeTesterZStreamContextStub is a wrapper that converts ipc.ServerCall into
706// a typesafe stub that implements TypeTesterZStreamContext.
707type TypeTesterZStreamContextStub struct {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800708 __ipc.ServerCall
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700709}
710
Todd Wang06eeab02015-01-20 11:34:14 -0800711// Init initializes TypeTesterZStreamContextStub from ipc.ServerCall.
712func (s *TypeTesterZStreamContextStub) Init(call __ipc.ServerCall) {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800713 s.ServerCall = call
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700714}
715
Todd Wang06eeab02015-01-20 11:34:14 -0800716// SendStream returns the send side of the TypeTester.ZStream server stream.
717func (s *TypeTesterZStreamContextStub) SendStream() interface {
Todd Wang702385a2014-11-07 01:54:08 -0800718 Send(item bool) error
719} {
Todd Wang06eeab02015-01-20 11:34:14 -0800720 return implTypeTesterZStreamContextSend{s}
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800721}
722
Todd Wang06eeab02015-01-20 11:34:14 -0800723type implTypeTesterZStreamContextSend struct {
724 s *TypeTesterZStreamContextStub
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800725}
726
Todd Wang06eeab02015-01-20 11:34:14 -0800727func (s implTypeTesterZStreamContextSend) Send(item bool) error {
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800728 return s.s.Send(item)
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700729}