blob: c8cd486df4e2b53400fbffe4bf0e36123ceea516 [file] [log] [blame]
Jungho Ahn48d43072015-02-23 18:50:27 -08001// This file was auto-generated by the veyron vdl tool.
2// Source: stress.vdl
3
4package stress
5
6import (
7 // VDL system imports
8 "io"
9 "v.io/v23"
10 "v.io/v23/context"
11 "v.io/v23/ipc"
12 "v.io/v23/vdl"
13
14 // VDL user imports
15 "v.io/v23/services/security/access"
16)
17
18type Arg struct {
19 ABool bool
20 AInt64 int64
21 AListOfBytes []byte
22}
23
24func (Arg) __VDLReflect(struct {
Matt Rosencrantzdbc1be22015-02-28 15:15:49 -080025 Name string "v.io/x/ref/profiles/internal/ipc/stress.Arg"
Jungho Ahn48d43072015-02-23 18:50:27 -080026}) {
27}
28
29type Stats struct {
30 SumCount uint64
31 SumStreamCount uint64
32}
33
34func (Stats) __VDLReflect(struct {
Matt Rosencrantzdbc1be22015-02-28 15:15:49 -080035 Name string "v.io/x/ref/profiles/internal/ipc/stress.Stats"
Jungho Ahn48d43072015-02-23 18:50:27 -080036}) {
37}
38
39func init() {
40 vdl.Register((*Arg)(nil))
41 vdl.Register((*Stats)(nil))
42}
43
44// StressClientMethods is the client interface
45// containing Stress methods.
46type StressClientMethods interface {
47 // Do returns the checksum of the payload that it receives.
48 Sum(ctx *context.T, arg Arg, opts ...ipc.CallOpt) ([]byte, error)
49 // DoStream returns the checksum of the payload that it receives via the stream.
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -080050 SumStream(*context.T, ...ipc.CallOpt) (StressSumStreamClientCall, error)
Jungho Ahn48d43072015-02-23 18:50:27 -080051 // GetStats returns the stats on the calls that the server received.
52 GetStats(*context.T, ...ipc.CallOpt) (Stats, error)
53 // Stop stops the server.
54 Stop(*context.T, ...ipc.CallOpt) error
55}
56
57// StressClientStub adds universal methods to StressClientMethods.
58type StressClientStub interface {
59 StressClientMethods
60 ipc.UniversalServiceMethods
61}
62
63// StressClient returns a client stub for Stress.
64func StressClient(name string, opts ...ipc.BindOpt) StressClientStub {
65 var client ipc.Client
66 for _, opt := range opts {
67 if clientOpt, ok := opt.(ipc.Client); ok {
68 client = clientOpt
69 }
70 }
71 return implStressClientStub{name, client}
72}
73
74type implStressClientStub struct {
75 name string
76 client ipc.Client
77}
78
79func (c implStressClientStub) c(ctx *context.T) ipc.Client {
80 if c.client != nil {
81 return c.client
82 }
83 return v23.GetClient(ctx)
84}
85
86func (c implStressClientStub) Sum(ctx *context.T, i0 Arg, opts ...ipc.CallOpt) (o0 []byte, err error) {
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -080087 var call ipc.ClientCall
Jungho Ahn48d43072015-02-23 18:50:27 -080088 if call, err = c.c(ctx).StartCall(ctx, c.name, "Sum", []interface{}{i0}, opts...); err != nil {
89 return
90 }
91 err = call.Finish(&o0)
92 return
93}
94
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -080095func (c implStressClientStub) SumStream(ctx *context.T, opts ...ipc.CallOpt) (ocall StressSumStreamClientCall, err error) {
96 var call ipc.ClientCall
Jungho Ahn48d43072015-02-23 18:50:27 -080097 if call, err = c.c(ctx).StartCall(ctx, c.name, "SumStream", nil, opts...); err != nil {
98 return
99 }
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800100 ocall = &implStressSumStreamClientCall{ClientCall: call}
Jungho Ahn48d43072015-02-23 18:50:27 -0800101 return
102}
103
104func (c implStressClientStub) GetStats(ctx *context.T, opts ...ipc.CallOpt) (o0 Stats, err error) {
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800105 var call ipc.ClientCall
Jungho Ahn48d43072015-02-23 18:50:27 -0800106 if call, err = c.c(ctx).StartCall(ctx, c.name, "GetStats", nil, opts...); err != nil {
107 return
108 }
109 err = call.Finish(&o0)
110 return
111}
112
113func (c implStressClientStub) Stop(ctx *context.T, opts ...ipc.CallOpt) (err error) {
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800114 var call ipc.ClientCall
Jungho Ahn48d43072015-02-23 18:50:27 -0800115 if call, err = c.c(ctx).StartCall(ctx, c.name, "Stop", nil, opts...); err != nil {
116 return
117 }
118 err = call.Finish()
119 return
120}
121
122// StressSumStreamClientStream is the client stream for Stress.SumStream.
123type StressSumStreamClientStream interface {
124 // RecvStream returns the receiver side of the Stress.SumStream client stream.
125 RecvStream() interface {
126 // Advance stages an item so that it may be retrieved via Value. Returns
127 // true iff there is an item to retrieve. Advance must be called before
128 // Value is called. May block if an item is not available.
129 Advance() bool
130 // Value returns the item that was staged by Advance. May panic if Advance
131 // returned false or was not called. Never blocks.
132 Value() []byte
133 // Err returns any error encountered by Advance. Never blocks.
134 Err() error
135 }
136 // SendStream returns the send side of the Stress.SumStream client stream.
137 SendStream() interface {
138 // Send places the item onto the output stream. Returns errors
139 // encountered while sending, or if Send is called after Close or
140 // the stream has been canceled. Blocks if there is no buffer
141 // space; will unblock when buffer space is available or after
142 // the stream has been canceled.
143 Send(item Arg) error
144 // Close indicates to the server that no more items will be sent;
145 // server Recv calls will receive io.EOF after all sent items.
146 // This is an optional call - e.g. a client might call Close if it
147 // needs to continue receiving items from the server after it's
148 // done sending. Returns errors encountered while closing, or if
149 // Close is called after the stream has been canceled. Like Send,
150 // blocks if there is no buffer space available.
151 Close() error
152 }
153}
154
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800155// StressSumStreamClientCall represents the call returned from Stress.SumStream.
156type StressSumStreamClientCall interface {
Jungho Ahn48d43072015-02-23 18:50:27 -0800157 StressSumStreamClientStream
158 // Finish performs the equivalent of SendStream().Close, then blocks until
159 // the server is done, and returns the positional return values for the call.
160 //
161 // Finish returns immediately if the call has been canceled; depending on the
162 // timing the output could either be an error signaling cancelation, or the
163 // valid positional return values from the server.
164 //
165 // Calling Finish is mandatory for releasing stream resources, unless the call
166 // has been canceled or any of the other methods return an error. Finish should
167 // be called at most once.
168 Finish() error
169}
170
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800171type implStressSumStreamClientCall struct {
172 ipc.ClientCall
Jungho Ahn48d43072015-02-23 18:50:27 -0800173 valRecv []byte
174 errRecv error
175}
176
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800177func (c *implStressSumStreamClientCall) RecvStream() interface {
Jungho Ahn48d43072015-02-23 18:50:27 -0800178 Advance() bool
179 Value() []byte
180 Err() error
181} {
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800182 return implStressSumStreamClientCallRecv{c}
Jungho Ahn48d43072015-02-23 18:50:27 -0800183}
184
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800185type implStressSumStreamClientCallRecv struct {
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800186 c *implStressSumStreamClientCall
Jungho Ahn48d43072015-02-23 18:50:27 -0800187}
188
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800189func (c implStressSumStreamClientCallRecv) Advance() bool {
Jungho Ahn48d43072015-02-23 18:50:27 -0800190 c.c.errRecv = c.c.Recv(&c.c.valRecv)
191 return c.c.errRecv == nil
192}
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800193func (c implStressSumStreamClientCallRecv) Value() []byte {
Jungho Ahn48d43072015-02-23 18:50:27 -0800194 return c.c.valRecv
195}
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800196func (c implStressSumStreamClientCallRecv) Err() error {
Jungho Ahn48d43072015-02-23 18:50:27 -0800197 if c.c.errRecv == io.EOF {
198 return nil
199 }
200 return c.c.errRecv
201}
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800202func (c *implStressSumStreamClientCall) SendStream() interface {
Jungho Ahn48d43072015-02-23 18:50:27 -0800203 Send(item Arg) error
204 Close() error
205} {
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800206 return implStressSumStreamClientCallSend{c}
Jungho Ahn48d43072015-02-23 18:50:27 -0800207}
208
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800209type implStressSumStreamClientCallSend struct {
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800210 c *implStressSumStreamClientCall
Jungho Ahn48d43072015-02-23 18:50:27 -0800211}
212
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800213func (c implStressSumStreamClientCallSend) Send(item Arg) error {
Jungho Ahn48d43072015-02-23 18:50:27 -0800214 return c.c.Send(item)
215}
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800216func (c implStressSumStreamClientCallSend) Close() error {
Jungho Ahn48d43072015-02-23 18:50:27 -0800217 return c.c.CloseSend()
218}
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800219func (c *implStressSumStreamClientCall) Finish() (err error) {
220 err = c.ClientCall.Finish()
Jungho Ahn48d43072015-02-23 18:50:27 -0800221 return
222}
223
224// StressServerMethods is the interface a server writer
225// implements for Stress.
226type StressServerMethods interface {
227 // Do returns the checksum of the payload that it receives.
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800228 Sum(call ipc.ServerCall, arg Arg) ([]byte, error)
Jungho Ahn48d43072015-02-23 18:50:27 -0800229 // DoStream returns the checksum of the payload that it receives via the stream.
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800230 SumStream(StressSumStreamServerCall) error
Jungho Ahn48d43072015-02-23 18:50:27 -0800231 // GetStats returns the stats on the calls that the server received.
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800232 GetStats(ipc.ServerCall) (Stats, error)
Jungho Ahn48d43072015-02-23 18:50:27 -0800233 // Stop stops the server.
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800234 Stop(ipc.ServerCall) error
Jungho Ahn48d43072015-02-23 18:50:27 -0800235}
236
237// StressServerStubMethods is the server interface containing
238// Stress methods, as expected by ipc.Server.
239// The only difference between this interface and StressServerMethods
240// is the streaming methods.
241type StressServerStubMethods interface {
242 // Do returns the checksum of the payload that it receives.
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800243 Sum(call ipc.ServerCall, arg Arg) ([]byte, error)
Jungho Ahn48d43072015-02-23 18:50:27 -0800244 // DoStream returns the checksum of the payload that it receives via the stream.
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800245 SumStream(*StressSumStreamServerCallStub) error
Jungho Ahn48d43072015-02-23 18:50:27 -0800246 // GetStats returns the stats on the calls that the server received.
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800247 GetStats(ipc.ServerCall) (Stats, error)
Jungho Ahn48d43072015-02-23 18:50:27 -0800248 // Stop stops the server.
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800249 Stop(ipc.ServerCall) error
Jungho Ahn48d43072015-02-23 18:50:27 -0800250}
251
252// StressServerStub adds universal methods to StressServerStubMethods.
253type StressServerStub interface {
254 StressServerStubMethods
255 // Describe the Stress interfaces.
256 Describe__() []ipc.InterfaceDesc
257}
258
259// StressServer returns a server stub for Stress.
260// It converts an implementation of StressServerMethods into
261// an object that may be used by ipc.Server.
262func StressServer(impl StressServerMethods) StressServerStub {
263 stub := implStressServerStub{
264 impl: impl,
265 }
266 // Initialize GlobState; always check the stub itself first, to handle the
267 // case where the user has the Glob method defined in their VDL source.
268 if gs := ipc.NewGlobState(stub); gs != nil {
269 stub.gs = gs
270 } else if gs := ipc.NewGlobState(impl); gs != nil {
271 stub.gs = gs
272 }
273 return stub
274}
275
276type implStressServerStub struct {
277 impl StressServerMethods
278 gs *ipc.GlobState
279}
280
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800281func (s implStressServerStub) Sum(call ipc.ServerCall, i0 Arg) ([]byte, error) {
282 return s.impl.Sum(call, i0)
Jungho Ahn48d43072015-02-23 18:50:27 -0800283}
284
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800285func (s implStressServerStub) SumStream(call *StressSumStreamServerCallStub) error {
286 return s.impl.SumStream(call)
Jungho Ahn48d43072015-02-23 18:50:27 -0800287}
288
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800289func (s implStressServerStub) GetStats(call ipc.ServerCall) (Stats, error) {
290 return s.impl.GetStats(call)
Jungho Ahn48d43072015-02-23 18:50:27 -0800291}
292
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800293func (s implStressServerStub) Stop(call ipc.ServerCall) error {
294 return s.impl.Stop(call)
Jungho Ahn48d43072015-02-23 18:50:27 -0800295}
296
297func (s implStressServerStub) Globber() *ipc.GlobState {
298 return s.gs
299}
300
301func (s implStressServerStub) Describe__() []ipc.InterfaceDesc {
302 return []ipc.InterfaceDesc{StressDesc}
303}
304
305// StressDesc describes the Stress interface.
306var StressDesc ipc.InterfaceDesc = descStress
307
308// descStress hides the desc to keep godoc clean.
309var descStress = ipc.InterfaceDesc{
310 Name: "Stress",
Matt Rosencrantzdbc1be22015-02-28 15:15:49 -0800311 PkgPath: "v.io/x/ref/profiles/internal/ipc/stress",
Jungho Ahn48d43072015-02-23 18:50:27 -0800312 Methods: []ipc.MethodDesc{
313 {
314 Name: "Sum",
315 Doc: "// Do returns the checksum of the payload that it receives.",
316 InArgs: []ipc.ArgDesc{
317 {"arg", ``}, // Arg
318 },
319 OutArgs: []ipc.ArgDesc{
320 {"", ``}, // []byte
321 },
322 Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Read"))},
323 },
324 {
325 Name: "SumStream",
326 Doc: "// DoStream returns the checksum of the payload that it receives via the stream.",
327 Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Read"))},
328 },
329 {
330 Name: "GetStats",
331 Doc: "// GetStats returns the stats on the calls that the server received.",
332 OutArgs: []ipc.ArgDesc{
333 {"", ``}, // Stats
334 },
335 Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Read"))},
336 },
337 {
338 Name: "Stop",
339 Doc: "// Stop stops the server.",
340 Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Admin"))},
341 },
342 },
343}
344
345// StressSumStreamServerStream is the server stream for Stress.SumStream.
346type StressSumStreamServerStream interface {
347 // RecvStream returns the receiver side of the Stress.SumStream server stream.
348 RecvStream() interface {
349 // Advance stages an item so that it may be retrieved via Value. Returns
350 // true iff there is an item to retrieve. Advance must be called before
351 // Value is called. May block if an item is not available.
352 Advance() bool
353 // Value returns the item that was staged by Advance. May panic if Advance
354 // returned false or was not called. Never blocks.
355 Value() Arg
356 // Err returns any error encountered by Advance. Never blocks.
357 Err() error
358 }
359 // SendStream returns the send side of the Stress.SumStream server stream.
360 SendStream() interface {
361 // Send places the item onto the output stream. Returns errors encountered
362 // while sending. Blocks if there is no buffer space; will unblock when
363 // buffer space is available.
364 Send(item []byte) error
365 }
366}
367
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800368// StressSumStreamServerCall represents the context passed to Stress.SumStream.
369type StressSumStreamServerCall interface {
Matt Rosencrantz5c7ed212015-02-27 22:42:35 -0800370 ipc.ServerCall
Jungho Ahn48d43072015-02-23 18:50:27 -0800371 StressSumStreamServerStream
372}
373
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800374// StressSumStreamServerCallStub is a wrapper that converts ipc.StreamServerCall into
375// a typesafe stub that implements StressSumStreamServerCall.
376type StressSumStreamServerCallStub struct {
Matt Rosencrantz1dcd0a92015-02-27 11:05:59 -0800377 ipc.StreamServerCall
Jungho Ahn48d43072015-02-23 18:50:27 -0800378 valRecv Arg
379 errRecv error
380}
381
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800382// Init initializes StressSumStreamServerCallStub from ipc.StreamServerCall.
383func (s *StressSumStreamServerCallStub) Init(call ipc.StreamServerCall) {
Matt Rosencrantz1dcd0a92015-02-27 11:05:59 -0800384 s.StreamServerCall = call
Jungho Ahn48d43072015-02-23 18:50:27 -0800385}
386
387// RecvStream returns the receiver side of the Stress.SumStream server stream.
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800388func (s *StressSumStreamServerCallStub) RecvStream() interface {
Jungho Ahn48d43072015-02-23 18:50:27 -0800389 Advance() bool
390 Value() Arg
391 Err() error
392} {
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800393 return implStressSumStreamServerCallRecv{s}
Jungho Ahn48d43072015-02-23 18:50:27 -0800394}
395
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800396type implStressSumStreamServerCallRecv struct {
397 s *StressSumStreamServerCallStub
Jungho Ahn48d43072015-02-23 18:50:27 -0800398}
399
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800400func (s implStressSumStreamServerCallRecv) Advance() bool {
Jungho Ahn48d43072015-02-23 18:50:27 -0800401 s.s.valRecv = Arg{}
402 s.s.errRecv = s.s.Recv(&s.s.valRecv)
403 return s.s.errRecv == nil
404}
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800405func (s implStressSumStreamServerCallRecv) Value() Arg {
Jungho Ahn48d43072015-02-23 18:50:27 -0800406 return s.s.valRecv
407}
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800408func (s implStressSumStreamServerCallRecv) Err() error {
Jungho Ahn48d43072015-02-23 18:50:27 -0800409 if s.s.errRecv == io.EOF {
410 return nil
411 }
412 return s.s.errRecv
413}
414
415// SendStream returns the send side of the Stress.SumStream server stream.
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800416func (s *StressSumStreamServerCallStub) SendStream() interface {
Jungho Ahn48d43072015-02-23 18:50:27 -0800417 Send(item []byte) error
418} {
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800419 return implStressSumStreamServerCallSend{s}
Jungho Ahn48d43072015-02-23 18:50:27 -0800420}
421
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800422type implStressSumStreamServerCallSend struct {
423 s *StressSumStreamServerCallStub
Jungho Ahn48d43072015-02-23 18:50:27 -0800424}
425
Suharsh Sivakumar31f49852015-03-03 16:13:20 -0800426func (s implStressSumStreamServerCallSend) Send(item []byte) error {
Jungho Ahn48d43072015-02-23 18:50:27 -0800427 return s.s.Send(item)
428}