blob: 43390760efb7ef62465c0ad957cafeed23cc4be7 [file] [log] [blame]
Ryan Brownfed691e2014-09-15 13:09:40 -07001// This file was auto-generated by the veyron vdl tool.
2// Source: wire.vdl
3
4package main
5
6import (
Todd Wang702385a2014-11-07 01:54:08 -08007 // The non-user imports are prefixed with "__" to prevent collisions.
Jiri Simsa764efb72014-12-25 20:57:03 -08008 __veyron2 "v.io/core/veyron2"
9 __context "v.io/core/veyron2/context"
10 __ipc "v.io/core/veyron2/ipc"
11 __vdlutil "v.io/core/veyron2/vdl/vdlutil"
12 __wiretype "v.io/core/veyron2/wiretype"
Ryan Brownfed691e2014-09-15 13:09:40 -070013)
14
Jing Jin896d7762014-11-03 11:18:52 -080015// TODO(toddw): Remove this line once the new signature support is done.
Todd Wang702385a2014-11-07 01:54:08 -080016// It corrects a bug where __wiretype is unused in VDL pacakges where only
Jing Jin896d7762014-11-03 11:18:52 -080017// bootstrap types are used on interfaces.
Todd Wang702385a2014-11-07 01:54:08 -080018const _ = __wiretype.TypeIDInvalid
Ken Ashcrafte027b5c2014-09-16 14:20:20 -070019
Todd Wang702385a2014-11-07 01:54:08 -080020// PingPongClientMethods is the client interface
21// containing PingPong methods.
22//
Ryan Brownf6b92272014-09-16 13:24:28 -070023// Simple service used in the agent tests.
Todd Wang702385a2014-11-07 01:54:08 -080024type PingPongClientMethods interface {
25 Ping(ctx __context.T, message string, opts ...__ipc.CallOpt) (string, error)
Ryan Brownfed691e2014-09-15 13:09:40 -070026}
27
Todd Wang702385a2014-11-07 01:54:08 -080028// PingPongClientStub adds universal methods to PingPongClientMethods.
29type PingPongClientStub interface {
30 PingPongClientMethods
31 __ipc.UniversalServiceMethods
Ryan Brownfed691e2014-09-15 13:09:40 -070032}
33
Todd Wang702385a2014-11-07 01:54:08 -080034// PingPongClient returns a client stub for PingPong.
35func PingPongClient(name string, opts ...__ipc.BindOpt) PingPongClientStub {
36 var client __ipc.Client
37 for _, opt := range opts {
38 if clientOpt, ok := opt.(__ipc.Client); ok {
Ken Ashcrafte027b5c2014-09-16 14:20:20 -070039 client = clientOpt
Ryan Brownfed691e2014-09-15 13:09:40 -070040 }
Ryan Brownfed691e2014-09-15 13:09:40 -070041 }
Todd Wang702385a2014-11-07 01:54:08 -080042 return implPingPongClientStub{name, client}
Ryan Brownfed691e2014-09-15 13:09:40 -070043}
44
Todd Wang702385a2014-11-07 01:54:08 -080045type implPingPongClientStub struct {
46 name string
47 client __ipc.Client
48}
49
50func (c implPingPongClientStub) c(ctx __context.T) __ipc.Client {
51 if c.client != nil {
52 return c.client
53 }
54 return __veyron2.RuntimeFromContext(ctx).Client()
55}
56
57func (c implPingPongClientStub) Ping(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (o0 string, err error) {
58 var call __ipc.Call
59 if call, err = c.c(ctx).StartCall(ctx, c.name, "Ping", []interface{}{i0}, opts...); err != nil {
60 return
61 }
62 if ierr := call.Finish(&o0, &err); ierr != nil {
63 err = ierr
64 }
65 return
66}
67
68func (c implPingPongClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
69 var call __ipc.Call
70 if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
71 return
72 }
73 if ierr := call.Finish(&o0, &err); ierr != nil {
74 err = ierr
75 }
76 return
77}
78
Todd Wang702385a2014-11-07 01:54:08 -080079// PingPongServerMethods is the interface a server writer
80// implements for PingPong.
Ryan Brownfed691e2014-09-15 13:09:40 -070081//
Todd Wang702385a2014-11-07 01:54:08 -080082// Simple service used in the agent tests.
83type PingPongServerMethods interface {
84 Ping(ctx __ipc.ServerContext, message string) (string, error)
85}
86
87// PingPongServerStubMethods is the server interface containing
Todd Wang1fe7cdd2014-11-12 12:51:49 -080088// PingPong methods, as expected by ipc.Server.
89// There is no difference between this interface and PingPongServerMethods
90// since there are no streaming methods.
91type PingPongServerStubMethods PingPongServerMethods
Todd Wang702385a2014-11-07 01:54:08 -080092
93// PingPongServerStub adds universal methods to PingPongServerStubMethods.
94type PingPongServerStub interface {
95 PingPongServerStubMethods
Todd Wang5739dda2014-11-16 22:44:02 -080096 // Describe the PingPong interfaces.
97 Describe__() []__ipc.InterfaceDesc
98 // Signature will be replaced with Describe__.
Todd Wang1fe7cdd2014-11-12 12:51:49 -080099 Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error)
Todd Wang702385a2014-11-07 01:54:08 -0800100}
101
102// PingPongServer returns a server stub for PingPong.
103// It converts an implementation of PingPongServerMethods into
104// an object that may be used by ipc.Server.
105func PingPongServer(impl PingPongServerMethods) PingPongServerStub {
106 stub := implPingPongServerStub{
107 impl: impl,
Ryan Brownfed691e2014-09-15 13:09:40 -0700108 }
Todd Wang702385a2014-11-07 01:54:08 -0800109 // Initialize GlobState; always check the stub itself first, to handle the
110 // case where the user has the Glob method defined in their VDL source.
111 if gs := __ipc.NewGlobState(stub); gs != nil {
112 stub.gs = gs
113 } else if gs := __ipc.NewGlobState(impl); gs != nil {
114 stub.gs = gs
Robin Thellend94bc4642014-11-05 18:05:08 -0800115 }
Robin Thellend94bc4642014-11-05 18:05:08 -0800116 return stub
Ryan Brownfed691e2014-09-15 13:09:40 -0700117}
118
Todd Wang702385a2014-11-07 01:54:08 -0800119type implPingPongServerStub struct {
120 impl PingPongServerMethods
121 gs *__ipc.GlobState
Ken Ashcrafte027b5c2014-09-16 14:20:20 -0700122}
123
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800124func (s implPingPongServerStub) Ping(ctx __ipc.ServerContext, i0 string) (string, error) {
125 return s.impl.Ping(ctx, i0)
Ryan Brownfed691e2014-09-15 13:09:40 -0700126}
127
Robin Thellend39ac3232014-12-02 09:50:41 -0800128func (s implPingPongServerStub) Globber() *__ipc.GlobState {
Todd Wang702385a2014-11-07 01:54:08 -0800129 return s.gs
Ryan Brownfed691e2014-09-15 13:09:40 -0700130}
131
Todd Wang5739dda2014-11-16 22:44:02 -0800132func (s implPingPongServerStub) Describe__() []__ipc.InterfaceDesc {
133 return []__ipc.InterfaceDesc{PingPongDesc}
134}
135
136// PingPongDesc describes the PingPong interface.
137var PingPongDesc __ipc.InterfaceDesc = descPingPong
138
139// descPingPong hides the desc to keep godoc clean.
140var descPingPong = __ipc.InterfaceDesc{
141 Name: "PingPong",
Jiri Simsa764efb72014-12-25 20:57:03 -0800142 PkgPath: "v.io/core/veyron/security/agent/pingpong",
Todd Wang5739dda2014-11-16 22:44:02 -0800143 Doc: "// Simple service used in the agent tests.",
144 Methods: []__ipc.MethodDesc{
145 {
146 Name: "Ping",
147 InArgs: []__ipc.ArgDesc{
148 {"message", ``}, // string
149 },
150 OutArgs: []__ipc.ArgDesc{
151 {"", ``}, // string
152 {"", ``}, // error
153 },
154 },
155 },
Ryan Brownfed691e2014-09-15 13:09:40 -0700156}
157
Todd Wang1fe7cdd2014-11-12 12:51:49 -0800158func (s implPingPongServerStub) Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error) {
Todd Wang5739dda2014-11-16 22:44:02 -0800159 // TODO(toddw): Replace with new Describe__ implementation.
Todd Wang702385a2014-11-07 01:54:08 -0800160 result := __ipc.ServiceSignature{Methods: make(map[string]__ipc.MethodSignature)}
161 result.Methods["Ping"] = __ipc.MethodSignature{
162 InArgs: []__ipc.MethodArgument{
Ryan Brownfed691e2014-09-15 13:09:40 -0700163 {Name: "message", Type: 3},
164 },
Todd Wang702385a2014-11-07 01:54:08 -0800165 OutArgs: []__ipc.MethodArgument{
Ryan Brownfed691e2014-09-15 13:09:40 -0700166 {Name: "", Type: 3},
167 {Name: "", Type: 65},
168 },
169 }
170
Todd Wang702385a2014-11-07 01:54:08 -0800171 result.TypeDefs = []__vdlutil.Any{
172 __wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
Ryan Brownfed691e2014-09-15 13:09:40 -0700173
174 return result, nil
175}