blob: 57ac530e519d181b8a0e1fc52a4b3647ccf3f866 [file] [log] [blame]
Jiri Simsaddbfebb2014-06-20 15:56:06 -07001// This file was auto-generated by the veyron vdl tool.
2// Source: repository.vdl
3
4// Package repository contains implementation of the interface for
5// storing and serving various veyron management objects.
6package repository
7
8import (
Jiri Simsa519c5072014-09-17 21:37:57 -07009 "veyron.io/veyron/veyron/services/mgmt/profile"
Jiri Simsaddbfebb2014-06-20 15:56:06 -070010
Jiri Simsa519c5072014-09-17 21:37:57 -070011 "veyron.io/veyron/veyron2/security"
Jiri Simsaddbfebb2014-06-20 15:56:06 -070012
Jiri Simsa519c5072014-09-17 21:37:57 -070013 "veyron.io/veyron/veyron2/services/mgmt/application"
Jiri Simsaddbfebb2014-06-20 15:56:06 -070014
Jiri Simsa519c5072014-09-17 21:37:57 -070015 "veyron.io/veyron/veyron2/services/mgmt/repository"
Jiri Simsaddbfebb2014-06-20 15:56:06 -070016
17 // The non-user imports are prefixed with "_gen_" to prevent collisions.
Jiri Simsa519c5072014-09-17 21:37:57 -070018 _gen_veyron2 "veyron.io/veyron/veyron2"
19 _gen_context "veyron.io/veyron/veyron2/context"
20 _gen_ipc "veyron.io/veyron/veyron2/ipc"
21 _gen_naming "veyron.io/veyron/veyron2/naming"
22 _gen_vdlutil "veyron.io/veyron/veyron2/vdl/vdlutil"
23 _gen_wiretype "veyron.io/veyron/veyron2/wiretype"
Jiri Simsaddbfebb2014-06-20 15:56:06 -070024)
25
Jing Jin896d7762014-11-03 11:18:52 -080026// TODO(toddw): Remove this line once the new signature support is done.
27// It corrects a bug where _gen_wiretype is unused in VDL pacakges where only
28// bootstrap types are used on interfaces.
Shyam Jayaramanc4aed6e2014-07-22 14:25:06 -070029const _ = _gen_wiretype.TypeIDInvalid
30
Jiri Simsaddbfebb2014-06-20 15:56:06 -070031// Application describes an application repository internally. Besides
32// the public Application interface, it allows to add and remove
33// application envelopes.
34// Application is the interface the client binds and uses.
35// Application_ExcludingUniversal is the interface without internal framework-added methods
36// to enable embedding without method collisions. Not to be used directly by clients.
37type Application_ExcludingUniversal interface {
38 // Application provides access to application envelopes. An
39 // application envelope is identified by an application name and an
Bogdan Capritad9281a32014-07-02 14:40:39 -070040 // application version, which are specified through the object name,
Jiri Simsaddbfebb2014-06-20 15:56:06 -070041 // and a profile name, which is specified using a method argument.
42 //
43 // Example:
44 // /apps/search/v1.Match([]string{"base", "media"})
45 // returns an application envelope that can be used for downloading
46 // and executing the "search" application, version "v1", runnable
47 // on either the "base" or "media" profile.
48 repository.Application_ExcludingUniversal
49 // Put adds the given tuple of application version (specified
Bogdan Capritad9281a32014-07-02 14:40:39 -070050 // through the object name suffix) and application envelope to all
Jiri Simsaddbfebb2014-06-20 15:56:06 -070051 // of the given application profiles.
52 Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error)
53 // Remove removes the application envelope for the given profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070054 // name and application version (specified through the object name
Jiri Simsaddbfebb2014-06-20 15:56:06 -070055 // suffix). If no version is specified as part of the suffix, the
56 // method removes all versions for the given profile.
57 //
58 // TODO(jsimsa): Add support for using "*" to specify all profiles
59 // when Matt implements Globing (or Ken implements querying).
60 Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error)
61}
62type Application interface {
63 _gen_ipc.UniversalServiceMethods
64 Application_ExcludingUniversal
65}
66
67// ApplicationService is the interface the server implements.
68type ApplicationService interface {
69
70 // Application provides access to application envelopes. An
71 // application envelope is identified by an application name and an
Bogdan Capritad9281a32014-07-02 14:40:39 -070072 // application version, which are specified through the object name,
Jiri Simsaddbfebb2014-06-20 15:56:06 -070073 // and a profile name, which is specified using a method argument.
74 //
75 // Example:
76 // /apps/search/v1.Match([]string{"base", "media"})
77 // returns an application envelope that can be used for downloading
78 // and executing the "search" application, version "v1", runnable
79 // on either the "base" or "media" profile.
80 repository.ApplicationService
81 // Put adds the given tuple of application version (specified
Bogdan Capritad9281a32014-07-02 14:40:39 -070082 // through the object name suffix) and application envelope to all
Jiri Simsaddbfebb2014-06-20 15:56:06 -070083 // of the given application profiles.
84 Put(context _gen_ipc.ServerContext, Profiles []string, Envelope application.Envelope) (err error)
85 // Remove removes the application envelope for the given profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070086 // name and application version (specified through the object name
Jiri Simsaddbfebb2014-06-20 15:56:06 -070087 // suffix). If no version is specified as part of the suffix, the
88 // method removes all versions for the given profile.
89 //
90 // TODO(jsimsa): Add support for using "*" to specify all profiles
91 // when Matt implements Globing (or Ken implements querying).
92 Remove(context _gen_ipc.ServerContext, Profile string) (err error)
93}
94
95// BindApplication returns the client stub implementing the Application
96// interface.
97//
98// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
99// global Runtime is used.
100func BindApplication(name string, opts ..._gen_ipc.BindOpt) (Application, error) {
101 var client _gen_ipc.Client
102 switch len(opts) {
103 case 0:
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700104 // Do nothing.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700105 case 1:
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700106 if clientOpt, ok := opts[0].(_gen_ipc.Client); opts[0] == nil || ok {
107 client = clientOpt
108 } else {
Todd Wang0ecdd7a2014-07-14 16:24:38 -0700109 return nil, _gen_vdlutil.ErrUnrecognizedOption
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700110 }
111 default:
Todd Wang0ecdd7a2014-07-14 16:24:38 -0700112 return nil, _gen_vdlutil.ErrTooManyOptionsToBind
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700113 }
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700114 stub := &clientStubApplication{defaultClient: client, name: name}
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700115 stub.Application_ExcludingUniversal, _ = repository.BindApplication(name, client)
116
117 return stub, nil
118}
119
120// NewServerApplication creates a new server stub.
121//
122// It takes a regular server implementing the ApplicationService
123// interface, and returns a new server stub.
124func NewServerApplication(server ApplicationService) interface{} {
125 return &ServerStubApplication{
126 ServerStubApplication: *repository.NewServerApplication(server).(*repository.ServerStubApplication),
127 service: server,
128 }
129}
130
131// clientStubApplication implements Application.
132type clientStubApplication struct {
133 repository.Application_ExcludingUniversal
134
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700135 defaultClient _gen_ipc.Client
136 name string
137}
138
139func (__gen_c *clientStubApplication) client(ctx _gen_context.T) _gen_ipc.Client {
140 if __gen_c.defaultClient != nil {
141 return __gen_c.defaultClient
142 }
143 return _gen_veyron2.RuntimeFromContext(ctx).Client()
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700144}
145
146func (__gen_c *clientStubApplication) Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error) {
147 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700148 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Put", []interface{}{Profiles, Envelope}, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700149 return
150 }
151 if ierr := call.Finish(&err); ierr != nil {
152 err = ierr
153 }
154 return
155}
156
157func (__gen_c *clientStubApplication) Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error) {
158 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700159 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Remove", []interface{}{Profile}, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700160 return
161 }
162 if ierr := call.Finish(&err); ierr != nil {
163 err = ierr
164 }
165 return
166}
167
168func (__gen_c *clientStubApplication) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
169 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700170 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700171 return
172 }
173 if ierr := call.Finish(&reply, &err); ierr != nil {
174 err = ierr
175 }
176 return
177}
178
179func (__gen_c *clientStubApplication) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
180 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700181 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700182 return
183 }
184 if ierr := call.Finish(&reply, &err); ierr != nil {
185 err = ierr
186 }
187 return
188}
189
190func (__gen_c *clientStubApplication) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
191 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700192 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700193 return
194 }
195 if ierr := call.Finish(&reply, &err); ierr != nil {
196 err = ierr
197 }
198 return
199}
200
201// ServerStubApplication wraps a server that implements
202// ApplicationService and provides an object that satisfies
203// the requirements of veyron2/ipc.ReflectInvoker.
204type ServerStubApplication struct {
205 repository.ServerStubApplication
206
207 service ApplicationService
208}
209
210func (__gen_s *ServerStubApplication) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
211 // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
212 // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
213 // This will change when it is replaced with Signature().
214 if resp, err := __gen_s.ServerStubApplication.GetMethodTags(call, method); resp != nil || err != nil {
215 return resp, err
216 }
217 switch method {
218 case "Put":
Tilak Sharmaab4f10d2014-07-23 11:28:37 -0700219 return []interface{}{security.Label(4)}, nil
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700220 case "Remove":
Tilak Sharmaab4f10d2014-07-23 11:28:37 -0700221 return []interface{}{security.Label(4)}, nil
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700222 default:
223 return nil, nil
224 }
225}
226
227func (__gen_s *ServerStubApplication) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
228 result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
229 result.Methods["Put"] = _gen_ipc.MethodSignature{
230 InArgs: []_gen_ipc.MethodArgument{
231 {Name: "Profiles", Type: 61},
232 {Name: "Envelope", Type: 65},
233 },
234 OutArgs: []_gen_ipc.MethodArgument{
235 {Name: "", Type: 66},
236 },
237 }
238 result.Methods["Remove"] = _gen_ipc.MethodSignature{
239 InArgs: []_gen_ipc.MethodArgument{
240 {Name: "Profile", Type: 3},
241 },
242 OutArgs: []_gen_ipc.MethodArgument{
243 {Name: "", Type: 66},
244 },
245 }
246
Todd Wang0ecdd7a2014-07-14 16:24:38 -0700247 result.TypeDefs = []_gen_vdlutil.Any{
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700248 _gen_wiretype.StructType{
249 []_gen_wiretype.FieldType{
Srdjan Petrovicd9c222c2014-07-14 11:23:19 -0700250 _gen_wiretype.FieldType{Type: 0x3, Name: "Title"},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700251 _gen_wiretype.FieldType{Type: 0x3d, Name: "Args"},
252 _gen_wiretype.FieldType{Type: 0x3, Name: "Binary"},
253 _gen_wiretype.FieldType{Type: 0x3d, Name: "Env"},
254 },
Jiri Simsa519c5072014-09-17 21:37:57 -0700255 "veyron.io/veyron/veyron2/services/mgmt/application.Envelope", []string(nil)},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700256 _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
257 var ss _gen_ipc.ServiceSignature
258 var firstAdded int
259 ss, _ = __gen_s.ServerStubApplication.Signature(call)
260 firstAdded = len(result.TypeDefs)
261 for k, v := range ss.Methods {
262 for i, _ := range v.InArgs {
263 if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst {
264 v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
265 }
266 }
267 for i, _ := range v.OutArgs {
268 if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst {
269 v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
270 }
271 }
272 if v.InStream >= _gen_wiretype.TypeIDFirst {
273 v.InStream += _gen_wiretype.TypeID(firstAdded)
274 }
275 if v.OutStream >= _gen_wiretype.TypeIDFirst {
276 v.OutStream += _gen_wiretype.TypeID(firstAdded)
277 }
278 result.Methods[k] = v
279 }
280 //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication.
281 for _, d := range ss.TypeDefs {
282 switch wt := d.(type) {
283 case _gen_wiretype.SliceType:
284 if wt.Elem >= _gen_wiretype.TypeIDFirst {
285 wt.Elem += _gen_wiretype.TypeID(firstAdded)
286 }
287 d = wt
288 case _gen_wiretype.ArrayType:
289 if wt.Elem >= _gen_wiretype.TypeIDFirst {
290 wt.Elem += _gen_wiretype.TypeID(firstAdded)
291 }
292 d = wt
293 case _gen_wiretype.MapType:
294 if wt.Key >= _gen_wiretype.TypeIDFirst {
295 wt.Key += _gen_wiretype.TypeID(firstAdded)
296 }
297 if wt.Elem >= _gen_wiretype.TypeIDFirst {
298 wt.Elem += _gen_wiretype.TypeID(firstAdded)
299 }
300 d = wt
301 case _gen_wiretype.StructType:
302 for i, fld := range wt.Fields {
303 if fld.Type >= _gen_wiretype.TypeIDFirst {
304 wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded)
305 }
306 }
307 d = wt
308 // NOTE: other types are missing, but we are upgrading anyways.
309 }
310 result.TypeDefs = append(result.TypeDefs, d)
311 }
312
313 return result, nil
314}
315
316func (__gen_s *ServerStubApplication) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
317 if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
318 return unresolver.UnresolveStep(call)
319 }
320 if call.Server() == nil {
321 return
322 }
323 var published []string
324 if published, err = call.Server().Published(); err != nil || published == nil {
325 return
326 }
327 reply = make([]string, len(published))
328 for i, p := range published {
329 reply[i] = _gen_naming.Join(p, call.Name())
330 }
331 return
332}
333
334func (__gen_s *ServerStubApplication) Put(call _gen_ipc.ServerCall, Profiles []string, Envelope application.Envelope) (err error) {
335 err = __gen_s.service.Put(call, Profiles, Envelope)
336 return
337}
338
339func (__gen_s *ServerStubApplication) Remove(call _gen_ipc.ServerCall, Profile string) (err error) {
340 err = __gen_s.service.Remove(call, Profile)
341 return
342}
343
344// Profile describes a profile internally. Besides the public Profile
345// interface, it allows to add and remove profile specifications.
346// Profile is the interface the client binds and uses.
347// Profile_ExcludingUniversal is the interface without internal framework-added methods
348// to enable embedding without method collisions. Not to be used directly by clients.
349type Profile_ExcludingUniversal interface {
350 // Profile abstracts a device's ability to run binaries, and hides
351 // specifics such as the operating system, hardware architecture, and
352 // the set of installed libraries. Profiles describe binaries and
353 // devices, and are used to match them.
354 repository.Profile_ExcludingUniversal
355 // Specification returns the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -0700356 // identified through the object name suffix.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700357 Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply profile.Specification, err error)
358 // Put sets the profile specification for the profile identified
Bogdan Capritad9281a32014-07-02 14:40:39 -0700359 // through the object name suffix.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700360 Put(ctx _gen_context.T, Specification profile.Specification, opts ..._gen_ipc.CallOpt) (err error)
361 // Remove removes the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -0700362 // identified through the object name suffix.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700363 Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error)
364}
365type Profile interface {
366 _gen_ipc.UniversalServiceMethods
367 Profile_ExcludingUniversal
368}
369
370// ProfileService is the interface the server implements.
371type ProfileService interface {
372
373 // Profile abstracts a device's ability to run binaries, and hides
374 // specifics such as the operating system, hardware architecture, and
375 // the set of installed libraries. Profiles describe binaries and
376 // devices, and are used to match them.
377 repository.ProfileService
378 // Specification returns the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -0700379 // identified through the object name suffix.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700380 Specification(context _gen_ipc.ServerContext) (reply profile.Specification, err error)
381 // Put sets the profile specification for the profile identified
Bogdan Capritad9281a32014-07-02 14:40:39 -0700382 // through the object name suffix.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700383 Put(context _gen_ipc.ServerContext, Specification profile.Specification) (err error)
384 // Remove removes the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -0700385 // identified through the object name suffix.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700386 Remove(context _gen_ipc.ServerContext) (err error)
387}
388
389// BindProfile returns the client stub implementing the Profile
390// interface.
391//
392// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
393// global Runtime is used.
394func BindProfile(name string, opts ..._gen_ipc.BindOpt) (Profile, error) {
395 var client _gen_ipc.Client
396 switch len(opts) {
397 case 0:
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700398 // Do nothing.
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700399 case 1:
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700400 if clientOpt, ok := opts[0].(_gen_ipc.Client); opts[0] == nil || ok {
401 client = clientOpt
402 } else {
Todd Wang0ecdd7a2014-07-14 16:24:38 -0700403 return nil, _gen_vdlutil.ErrUnrecognizedOption
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700404 }
405 default:
Todd Wang0ecdd7a2014-07-14 16:24:38 -0700406 return nil, _gen_vdlutil.ErrTooManyOptionsToBind
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700407 }
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700408 stub := &clientStubProfile{defaultClient: client, name: name}
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700409 stub.Profile_ExcludingUniversal, _ = repository.BindProfile(name, client)
410
411 return stub, nil
412}
413
414// NewServerProfile creates a new server stub.
415//
416// It takes a regular server implementing the ProfileService
417// interface, and returns a new server stub.
418func NewServerProfile(server ProfileService) interface{} {
419 return &ServerStubProfile{
420 ServerStubProfile: *repository.NewServerProfile(server).(*repository.ServerStubProfile),
421 service: server,
422 }
423}
424
425// clientStubProfile implements Profile.
426type clientStubProfile struct {
427 repository.Profile_ExcludingUniversal
428
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700429 defaultClient _gen_ipc.Client
430 name string
431}
432
433func (__gen_c *clientStubProfile) client(ctx _gen_context.T) _gen_ipc.Client {
434 if __gen_c.defaultClient != nil {
435 return __gen_c.defaultClient
436 }
437 return _gen_veyron2.RuntimeFromContext(ctx).Client()
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700438}
439
440func (__gen_c *clientStubProfile) Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply profile.Specification, err error) {
441 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700442 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Specification", nil, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700443 return
444 }
445 if ierr := call.Finish(&reply, &err); ierr != nil {
446 err = ierr
447 }
448 return
449}
450
451func (__gen_c *clientStubProfile) Put(ctx _gen_context.T, Specification profile.Specification, opts ..._gen_ipc.CallOpt) (err error) {
452 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700453 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Put", []interface{}{Specification}, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700454 return
455 }
456 if ierr := call.Finish(&err); ierr != nil {
457 err = ierr
458 }
459 return
460}
461
462func (__gen_c *clientStubProfile) Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error) {
463 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700464 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Remove", nil, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700465 return
466 }
467 if ierr := call.Finish(&err); ierr != nil {
468 err = ierr
469 }
470 return
471}
472
473func (__gen_c *clientStubProfile) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
474 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700475 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700476 return
477 }
478 if ierr := call.Finish(&reply, &err); ierr != nil {
479 err = ierr
480 }
481 return
482}
483
484func (__gen_c *clientStubProfile) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
485 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700486 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700487 return
488 }
489 if ierr := call.Finish(&reply, &err); ierr != nil {
490 err = ierr
491 }
492 return
493}
494
495func (__gen_c *clientStubProfile) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
496 var call _gen_ipc.Call
Matt Rosencrantzbf85d542014-08-22 13:31:14 -0700497 if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700498 return
499 }
500 if ierr := call.Finish(&reply, &err); ierr != nil {
501 err = ierr
502 }
503 return
504}
505
506// ServerStubProfile wraps a server that implements
507// ProfileService and provides an object that satisfies
508// the requirements of veyron2/ipc.ReflectInvoker.
509type ServerStubProfile struct {
510 repository.ServerStubProfile
511
512 service ProfileService
513}
514
515func (__gen_s *ServerStubProfile) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
516 // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
517 // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
518 // This will change when it is replaced with Signature().
519 if resp, err := __gen_s.ServerStubProfile.GetMethodTags(call, method); resp != nil || err != nil {
520 return resp, err
521 }
522 switch method {
523 case "Specification":
Tilak Sharmaab4f10d2014-07-23 11:28:37 -0700524 return []interface{}{security.Label(2)}, nil
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700525 case "Put":
Tilak Sharmaab4f10d2014-07-23 11:28:37 -0700526 return []interface{}{security.Label(4)}, nil
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700527 case "Remove":
Tilak Sharmaab4f10d2014-07-23 11:28:37 -0700528 return []interface{}{security.Label(4)}, nil
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700529 default:
530 return nil, nil
531 }
532}
533
534func (__gen_s *ServerStubProfile) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
535 result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
536 result.Methods["Put"] = _gen_ipc.MethodSignature{
537 InArgs: []_gen_ipc.MethodArgument{
Jiri Simsa2f8bc272014-07-16 12:29:15 -0700538 {Name: "Specification", Type: 70},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700539 },
540 OutArgs: []_gen_ipc.MethodArgument{
Jiri Simsa2f8bc272014-07-16 12:29:15 -0700541 {Name: "", Type: 71},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700542 },
543 }
544 result.Methods["Remove"] = _gen_ipc.MethodSignature{
545 InArgs: []_gen_ipc.MethodArgument{},
546 OutArgs: []_gen_ipc.MethodArgument{
Jiri Simsa2f8bc272014-07-16 12:29:15 -0700547 {Name: "", Type: 71},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700548 },
549 }
550 result.Methods["Specification"] = _gen_ipc.MethodSignature{
551 InArgs: []_gen_ipc.MethodArgument{},
552 OutArgs: []_gen_ipc.MethodArgument{
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700553 {Name: "", Type: 70},
Jiri Simsa2f8bc272014-07-16 12:29:15 -0700554 {Name: "", Type: 71},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700555 },
556 }
557
Todd Wang0ecdd7a2014-07-14 16:24:38 -0700558 result.TypeDefs = []_gen_vdlutil.Any{
Jiri Simsa519c5072014-09-17 21:37:57 -0700559 _gen_wiretype.NamedPrimitiveType{Type: 0x3, Name: "veyron.io/veyron/veyron2/services/mgmt/build.Architecture", Tags: []string(nil)}, _gen_wiretype.NamedPrimitiveType{Type: 0x3, Name: "veyron.io/veyron/veyron2/services/mgmt/build.Format", Tags: []string(nil)}, _gen_wiretype.StructType{
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700560 []_gen_wiretype.FieldType{
561 _gen_wiretype.FieldType{Type: 0x3, Name: "Name"},
562 _gen_wiretype.FieldType{Type: 0x3, Name: "MajorVersion"},
563 _gen_wiretype.FieldType{Type: 0x3, Name: "MinorVersion"},
564 },
Jiri Simsa519c5072014-09-17 21:37:57 -0700565 "veyron.io/veyron/veyron/services/mgmt/profile.Library", []string(nil)},
566 _gen_wiretype.MapType{Key: 0x43, Elem: 0x2, Name: "", Tags: []string(nil)}, _gen_wiretype.NamedPrimitiveType{Type: 0x3, Name: "veyron.io/veyron/veyron2/services/mgmt/build.OperatingSystem", Tags: []string(nil)}, _gen_wiretype.StructType{
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700567 []_gen_wiretype.FieldType{
Jiri Simsa2f8bc272014-07-16 12:29:15 -0700568 _gen_wiretype.FieldType{Type: 0x41, Name: "Arch"},
569 _gen_wiretype.FieldType{Type: 0x3, Name: "Description"},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700570 _gen_wiretype.FieldType{Type: 0x42, Name: "Format"},
571 _gen_wiretype.FieldType{Type: 0x44, Name: "Libraries"},
572 _gen_wiretype.FieldType{Type: 0x3, Name: "Label"},
Jiri Simsa2f8bc272014-07-16 12:29:15 -0700573 _gen_wiretype.FieldType{Type: 0x45, Name: "OS"},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700574 },
Jiri Simsa519c5072014-09-17 21:37:57 -0700575 "veyron.io/veyron/veyron/services/mgmt/profile.Specification", []string(nil)},
Jiri Simsaddbfebb2014-06-20 15:56:06 -0700576 _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
577 var ss _gen_ipc.ServiceSignature
578 var firstAdded int
579 ss, _ = __gen_s.ServerStubProfile.Signature(call)
580 firstAdded = len(result.TypeDefs)
581 for k, v := range ss.Methods {
582 for i, _ := range v.InArgs {
583 if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst {
584 v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
585 }
586 }
587 for i, _ := range v.OutArgs {
588 if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst {
589 v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
590 }
591 }
592 if v.InStream >= _gen_wiretype.TypeIDFirst {
593 v.InStream += _gen_wiretype.TypeID(firstAdded)
594 }
595 if v.OutStream >= _gen_wiretype.TypeIDFirst {
596 v.OutStream += _gen_wiretype.TypeID(firstAdded)
597 }
598 result.Methods[k] = v
599 }
600 //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication.
601 for _, d := range ss.TypeDefs {
602 switch wt := d.(type) {
603 case _gen_wiretype.SliceType:
604 if wt.Elem >= _gen_wiretype.TypeIDFirst {
605 wt.Elem += _gen_wiretype.TypeID(firstAdded)
606 }
607 d = wt
608 case _gen_wiretype.ArrayType:
609 if wt.Elem >= _gen_wiretype.TypeIDFirst {
610 wt.Elem += _gen_wiretype.TypeID(firstAdded)
611 }
612 d = wt
613 case _gen_wiretype.MapType:
614 if wt.Key >= _gen_wiretype.TypeIDFirst {
615 wt.Key += _gen_wiretype.TypeID(firstAdded)
616 }
617 if wt.Elem >= _gen_wiretype.TypeIDFirst {
618 wt.Elem += _gen_wiretype.TypeID(firstAdded)
619 }
620 d = wt
621 case _gen_wiretype.StructType:
622 for i, fld := range wt.Fields {
623 if fld.Type >= _gen_wiretype.TypeIDFirst {
624 wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded)
625 }
626 }
627 d = wt
628 // NOTE: other types are missing, but we are upgrading anyways.
629 }
630 result.TypeDefs = append(result.TypeDefs, d)
631 }
632
633 return result, nil
634}
635
636func (__gen_s *ServerStubProfile) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
637 if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
638 return unresolver.UnresolveStep(call)
639 }
640 if call.Server() == nil {
641 return
642 }
643 var published []string
644 if published, err = call.Server().Published(); err != nil || published == nil {
645 return
646 }
647 reply = make([]string, len(published))
648 for i, p := range published {
649 reply[i] = _gen_naming.Join(p, call.Name())
650 }
651 return
652}
653
654func (__gen_s *ServerStubProfile) Specification(call _gen_ipc.ServerCall) (reply profile.Specification, err error) {
655 reply, err = __gen_s.service.Specification(call)
656 return
657}
658
659func (__gen_s *ServerStubProfile) Put(call _gen_ipc.ServerCall, Specification profile.Specification) (err error) {
660 err = __gen_s.service.Put(call, Specification)
661 return
662}
663
664func (__gen_s *ServerStubProfile) Remove(call _gen_ipc.ServerCall) (err error) {
665 err = __gen_s.service.Remove(call)
666 return
667}