Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame^] | 1 | // 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. |
| 6 | package repository |
| 7 | |
| 8 | import ( |
| 9 | "veyron/services/mgmt/profile" |
| 10 | |
| 11 | "veyron2/security" |
| 12 | |
| 13 | "veyron2/services/mgmt/application" |
| 14 | |
| 15 | "veyron2/services/mgmt/repository" |
| 16 | |
| 17 | // The non-user imports are prefixed with "_gen_" to prevent collisions. |
| 18 | _gen_veyron2 "veyron2" |
| 19 | _gen_context "veyron2/context" |
| 20 | _gen_ipc "veyron2/ipc" |
| 21 | _gen_naming "veyron2/naming" |
| 22 | _gen_rt "veyron2/rt" |
| 23 | _gen_vdl "veyron2/vdl" |
| 24 | _gen_wiretype "veyron2/wiretype" |
| 25 | ) |
| 26 | |
| 27 | // Application describes an application repository internally. Besides |
| 28 | // the public Application interface, it allows to add and remove |
| 29 | // application envelopes. |
| 30 | // Application is the interface the client binds and uses. |
| 31 | // Application_ExcludingUniversal is the interface without internal framework-added methods |
| 32 | // to enable embedding without method collisions. Not to be used directly by clients. |
| 33 | type Application_ExcludingUniversal interface { |
| 34 | // Application provides access to application envelopes. An |
| 35 | // application envelope is identified by an application name and an |
| 36 | // application version, which are specified through the veyron name, |
| 37 | // and a profile name, which is specified using a method argument. |
| 38 | // |
| 39 | // Example: |
| 40 | // /apps/search/v1.Match([]string{"base", "media"}) |
| 41 | // returns an application envelope that can be used for downloading |
| 42 | // and executing the "search" application, version "v1", runnable |
| 43 | // on either the "base" or "media" profile. |
| 44 | repository.Application_ExcludingUniversal |
| 45 | // Put adds the given tuple of application version (specified |
| 46 | // through the veyron name suffix) and application envelope to all |
| 47 | // of the given application profiles. |
| 48 | Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error) |
| 49 | // Remove removes the application envelope for the given profile |
| 50 | // name and application version (specified through the veyron name |
| 51 | // suffix). If no version is specified as part of the suffix, the |
| 52 | // method removes all versions for the given profile. |
| 53 | // |
| 54 | // TODO(jsimsa): Add support for using "*" to specify all profiles |
| 55 | // when Matt implements Globing (or Ken implements querying). |
| 56 | Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error) |
| 57 | } |
| 58 | type Application interface { |
| 59 | _gen_ipc.UniversalServiceMethods |
| 60 | Application_ExcludingUniversal |
| 61 | } |
| 62 | |
| 63 | // ApplicationService is the interface the server implements. |
| 64 | type ApplicationService interface { |
| 65 | |
| 66 | // Application provides access to application envelopes. An |
| 67 | // application envelope is identified by an application name and an |
| 68 | // application version, which are specified through the veyron name, |
| 69 | // and a profile name, which is specified using a method argument. |
| 70 | // |
| 71 | // Example: |
| 72 | // /apps/search/v1.Match([]string{"base", "media"}) |
| 73 | // returns an application envelope that can be used for downloading |
| 74 | // and executing the "search" application, version "v1", runnable |
| 75 | // on either the "base" or "media" profile. |
| 76 | repository.ApplicationService |
| 77 | // Put adds the given tuple of application version (specified |
| 78 | // through the veyron name suffix) and application envelope to all |
| 79 | // of the given application profiles. |
| 80 | Put(context _gen_ipc.ServerContext, Profiles []string, Envelope application.Envelope) (err error) |
| 81 | // Remove removes the application envelope for the given profile |
| 82 | // name and application version (specified through the veyron name |
| 83 | // suffix). If no version is specified as part of the suffix, the |
| 84 | // method removes all versions for the given profile. |
| 85 | // |
| 86 | // TODO(jsimsa): Add support for using "*" to specify all profiles |
| 87 | // when Matt implements Globing (or Ken implements querying). |
| 88 | Remove(context _gen_ipc.ServerContext, Profile string) (err error) |
| 89 | } |
| 90 | |
| 91 | // BindApplication returns the client stub implementing the Application |
| 92 | // interface. |
| 93 | // |
| 94 | // If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the |
| 95 | // global Runtime is used. |
| 96 | func BindApplication(name string, opts ..._gen_ipc.BindOpt) (Application, error) { |
| 97 | var client _gen_ipc.Client |
| 98 | switch len(opts) { |
| 99 | case 0: |
| 100 | client = _gen_rt.R().Client() |
| 101 | case 1: |
| 102 | switch o := opts[0].(type) { |
| 103 | case _gen_veyron2.Runtime: |
| 104 | client = o.Client() |
| 105 | case _gen_ipc.Client: |
| 106 | client = o |
| 107 | default: |
| 108 | return nil, _gen_vdl.ErrUnrecognizedOption |
| 109 | } |
| 110 | default: |
| 111 | return nil, _gen_vdl.ErrTooManyOptionsToBind |
| 112 | } |
| 113 | stub := &clientStubApplication{client: client, name: name} |
| 114 | stub.Application_ExcludingUniversal, _ = repository.BindApplication(name, client) |
| 115 | |
| 116 | return stub, nil |
| 117 | } |
| 118 | |
| 119 | // NewServerApplication creates a new server stub. |
| 120 | // |
| 121 | // It takes a regular server implementing the ApplicationService |
| 122 | // interface, and returns a new server stub. |
| 123 | func NewServerApplication(server ApplicationService) interface{} { |
| 124 | return &ServerStubApplication{ |
| 125 | ServerStubApplication: *repository.NewServerApplication(server).(*repository.ServerStubApplication), |
| 126 | service: server, |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // clientStubApplication implements Application. |
| 131 | type clientStubApplication struct { |
| 132 | repository.Application_ExcludingUniversal |
| 133 | |
| 134 | client _gen_ipc.Client |
| 135 | name string |
| 136 | } |
| 137 | |
| 138 | func (__gen_c *clientStubApplication) Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error) { |
| 139 | var call _gen_ipc.Call |
| 140 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Profiles, Envelope}, opts...); err != nil { |
| 141 | return |
| 142 | } |
| 143 | if ierr := call.Finish(&err); ierr != nil { |
| 144 | err = ierr |
| 145 | } |
| 146 | return |
| 147 | } |
| 148 | |
| 149 | func (__gen_c *clientStubApplication) Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error) { |
| 150 | var call _gen_ipc.Call |
| 151 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", []interface{}{Profile}, opts...); err != nil { |
| 152 | return |
| 153 | } |
| 154 | if ierr := call.Finish(&err); ierr != nil { |
| 155 | err = ierr |
| 156 | } |
| 157 | return |
| 158 | } |
| 159 | |
| 160 | func (__gen_c *clientStubApplication) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) { |
| 161 | var call _gen_ipc.Call |
| 162 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil { |
| 163 | return |
| 164 | } |
| 165 | if ierr := call.Finish(&reply, &err); ierr != nil { |
| 166 | err = ierr |
| 167 | } |
| 168 | return |
| 169 | } |
| 170 | |
| 171 | func (__gen_c *clientStubApplication) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) { |
| 172 | var call _gen_ipc.Call |
| 173 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil { |
| 174 | return |
| 175 | } |
| 176 | if ierr := call.Finish(&reply, &err); ierr != nil { |
| 177 | err = ierr |
| 178 | } |
| 179 | return |
| 180 | } |
| 181 | |
| 182 | func (__gen_c *clientStubApplication) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) { |
| 183 | var call _gen_ipc.Call |
| 184 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil { |
| 185 | return |
| 186 | } |
| 187 | if ierr := call.Finish(&reply, &err); ierr != nil { |
| 188 | err = ierr |
| 189 | } |
| 190 | return |
| 191 | } |
| 192 | |
| 193 | // ServerStubApplication wraps a server that implements |
| 194 | // ApplicationService and provides an object that satisfies |
| 195 | // the requirements of veyron2/ipc.ReflectInvoker. |
| 196 | type ServerStubApplication struct { |
| 197 | repository.ServerStubApplication |
| 198 | |
| 199 | service ApplicationService |
| 200 | } |
| 201 | |
| 202 | func (__gen_s *ServerStubApplication) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) { |
| 203 | // TODO(bprosnitz) GetMethodTags() will be replaces with Signature(). |
| 204 | // Note: This exhibits some weird behavior like returning a nil error if the method isn't found. |
| 205 | // This will change when it is replaced with Signature(). |
| 206 | if resp, err := __gen_s.ServerStubApplication.GetMethodTags(call, method); resp != nil || err != nil { |
| 207 | return resp, err |
| 208 | } |
| 209 | switch method { |
| 210 | case "Put": |
| 211 | return []interface{}{security.Label(2)}, nil |
| 212 | case "Remove": |
| 213 | return []interface{}{security.Label(2)}, nil |
| 214 | default: |
| 215 | return nil, nil |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | func (__gen_s *ServerStubApplication) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) { |
| 220 | result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)} |
| 221 | result.Methods["Put"] = _gen_ipc.MethodSignature{ |
| 222 | InArgs: []_gen_ipc.MethodArgument{ |
| 223 | {Name: "Profiles", Type: 61}, |
| 224 | {Name: "Envelope", Type: 65}, |
| 225 | }, |
| 226 | OutArgs: []_gen_ipc.MethodArgument{ |
| 227 | {Name: "", Type: 66}, |
| 228 | }, |
| 229 | } |
| 230 | result.Methods["Remove"] = _gen_ipc.MethodSignature{ |
| 231 | InArgs: []_gen_ipc.MethodArgument{ |
| 232 | {Name: "Profile", Type: 3}, |
| 233 | }, |
| 234 | OutArgs: []_gen_ipc.MethodArgument{ |
| 235 | {Name: "", Type: 66}, |
| 236 | }, |
| 237 | } |
| 238 | |
| 239 | result.TypeDefs = []_gen_vdl.Any{ |
| 240 | _gen_wiretype.StructType{ |
| 241 | []_gen_wiretype.FieldType{ |
| 242 | _gen_wiretype.FieldType{Type: 0x3d, Name: "Args"}, |
| 243 | _gen_wiretype.FieldType{Type: 0x3, Name: "Binary"}, |
| 244 | _gen_wiretype.FieldType{Type: 0x3d, Name: "Env"}, |
| 245 | }, |
| 246 | "veyron2/services/mgmt/application.Envelope", []string(nil)}, |
| 247 | _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}} |
| 248 | var ss _gen_ipc.ServiceSignature |
| 249 | var firstAdded int |
| 250 | ss, _ = __gen_s.ServerStubApplication.Signature(call) |
| 251 | firstAdded = len(result.TypeDefs) |
| 252 | for k, v := range ss.Methods { |
| 253 | for i, _ := range v.InArgs { |
| 254 | if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst { |
| 255 | v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded) |
| 256 | } |
| 257 | } |
| 258 | for i, _ := range v.OutArgs { |
| 259 | if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst { |
| 260 | v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded) |
| 261 | } |
| 262 | } |
| 263 | if v.InStream >= _gen_wiretype.TypeIDFirst { |
| 264 | v.InStream += _gen_wiretype.TypeID(firstAdded) |
| 265 | } |
| 266 | if v.OutStream >= _gen_wiretype.TypeIDFirst { |
| 267 | v.OutStream += _gen_wiretype.TypeID(firstAdded) |
| 268 | } |
| 269 | result.Methods[k] = v |
| 270 | } |
| 271 | //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication. |
| 272 | for _, d := range ss.TypeDefs { |
| 273 | switch wt := d.(type) { |
| 274 | case _gen_wiretype.SliceType: |
| 275 | if wt.Elem >= _gen_wiretype.TypeIDFirst { |
| 276 | wt.Elem += _gen_wiretype.TypeID(firstAdded) |
| 277 | } |
| 278 | d = wt |
| 279 | case _gen_wiretype.ArrayType: |
| 280 | if wt.Elem >= _gen_wiretype.TypeIDFirst { |
| 281 | wt.Elem += _gen_wiretype.TypeID(firstAdded) |
| 282 | } |
| 283 | d = wt |
| 284 | case _gen_wiretype.MapType: |
| 285 | if wt.Key >= _gen_wiretype.TypeIDFirst { |
| 286 | wt.Key += _gen_wiretype.TypeID(firstAdded) |
| 287 | } |
| 288 | if wt.Elem >= _gen_wiretype.TypeIDFirst { |
| 289 | wt.Elem += _gen_wiretype.TypeID(firstAdded) |
| 290 | } |
| 291 | d = wt |
| 292 | case _gen_wiretype.StructType: |
| 293 | for i, fld := range wt.Fields { |
| 294 | if fld.Type >= _gen_wiretype.TypeIDFirst { |
| 295 | wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded) |
| 296 | } |
| 297 | } |
| 298 | d = wt |
| 299 | // NOTE: other types are missing, but we are upgrading anyways. |
| 300 | } |
| 301 | result.TypeDefs = append(result.TypeDefs, d) |
| 302 | } |
| 303 | |
| 304 | return result, nil |
| 305 | } |
| 306 | |
| 307 | func (__gen_s *ServerStubApplication) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) { |
| 308 | if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok { |
| 309 | return unresolver.UnresolveStep(call) |
| 310 | } |
| 311 | if call.Server() == nil { |
| 312 | return |
| 313 | } |
| 314 | var published []string |
| 315 | if published, err = call.Server().Published(); err != nil || published == nil { |
| 316 | return |
| 317 | } |
| 318 | reply = make([]string, len(published)) |
| 319 | for i, p := range published { |
| 320 | reply[i] = _gen_naming.Join(p, call.Name()) |
| 321 | } |
| 322 | return |
| 323 | } |
| 324 | |
| 325 | func (__gen_s *ServerStubApplication) Put(call _gen_ipc.ServerCall, Profiles []string, Envelope application.Envelope) (err error) { |
| 326 | err = __gen_s.service.Put(call, Profiles, Envelope) |
| 327 | return |
| 328 | } |
| 329 | |
| 330 | func (__gen_s *ServerStubApplication) Remove(call _gen_ipc.ServerCall, Profile string) (err error) { |
| 331 | err = __gen_s.service.Remove(call, Profile) |
| 332 | return |
| 333 | } |
| 334 | |
| 335 | // Profile describes a profile internally. Besides the public Profile |
| 336 | // interface, it allows to add and remove profile specifications. |
| 337 | // Profile is the interface the client binds and uses. |
| 338 | // Profile_ExcludingUniversal is the interface without internal framework-added methods |
| 339 | // to enable embedding without method collisions. Not to be used directly by clients. |
| 340 | type Profile_ExcludingUniversal interface { |
| 341 | // Profile abstracts a device's ability to run binaries, and hides |
| 342 | // specifics such as the operating system, hardware architecture, and |
| 343 | // the set of installed libraries. Profiles describe binaries and |
| 344 | // devices, and are used to match them. |
| 345 | repository.Profile_ExcludingUniversal |
| 346 | // Specification returns the profile specification for the profile |
| 347 | // identified through the veyron name suffix. |
| 348 | Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply profile.Specification, err error) |
| 349 | // Put sets the profile specification for the profile identified |
| 350 | // through the veyron name suffix. |
| 351 | Put(ctx _gen_context.T, Specification profile.Specification, opts ..._gen_ipc.CallOpt) (err error) |
| 352 | // Remove removes the profile specification for the profile |
| 353 | // identified through the veyron name suffix. |
| 354 | Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error) |
| 355 | } |
| 356 | type Profile interface { |
| 357 | _gen_ipc.UniversalServiceMethods |
| 358 | Profile_ExcludingUniversal |
| 359 | } |
| 360 | |
| 361 | // ProfileService is the interface the server implements. |
| 362 | type ProfileService interface { |
| 363 | |
| 364 | // Profile abstracts a device's ability to run binaries, and hides |
| 365 | // specifics such as the operating system, hardware architecture, and |
| 366 | // the set of installed libraries. Profiles describe binaries and |
| 367 | // devices, and are used to match them. |
| 368 | repository.ProfileService |
| 369 | // Specification returns the profile specification for the profile |
| 370 | // identified through the veyron name suffix. |
| 371 | Specification(context _gen_ipc.ServerContext) (reply profile.Specification, err error) |
| 372 | // Put sets the profile specification for the profile identified |
| 373 | // through the veyron name suffix. |
| 374 | Put(context _gen_ipc.ServerContext, Specification profile.Specification) (err error) |
| 375 | // Remove removes the profile specification for the profile |
| 376 | // identified through the veyron name suffix. |
| 377 | Remove(context _gen_ipc.ServerContext) (err error) |
| 378 | } |
| 379 | |
| 380 | // BindProfile returns the client stub implementing the Profile |
| 381 | // interface. |
| 382 | // |
| 383 | // If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the |
| 384 | // global Runtime is used. |
| 385 | func BindProfile(name string, opts ..._gen_ipc.BindOpt) (Profile, error) { |
| 386 | var client _gen_ipc.Client |
| 387 | switch len(opts) { |
| 388 | case 0: |
| 389 | client = _gen_rt.R().Client() |
| 390 | case 1: |
| 391 | switch o := opts[0].(type) { |
| 392 | case _gen_veyron2.Runtime: |
| 393 | client = o.Client() |
| 394 | case _gen_ipc.Client: |
| 395 | client = o |
| 396 | default: |
| 397 | return nil, _gen_vdl.ErrUnrecognizedOption |
| 398 | } |
| 399 | default: |
| 400 | return nil, _gen_vdl.ErrTooManyOptionsToBind |
| 401 | } |
| 402 | stub := &clientStubProfile{client: client, name: name} |
| 403 | stub.Profile_ExcludingUniversal, _ = repository.BindProfile(name, client) |
| 404 | |
| 405 | return stub, nil |
| 406 | } |
| 407 | |
| 408 | // NewServerProfile creates a new server stub. |
| 409 | // |
| 410 | // It takes a regular server implementing the ProfileService |
| 411 | // interface, and returns a new server stub. |
| 412 | func NewServerProfile(server ProfileService) interface{} { |
| 413 | return &ServerStubProfile{ |
| 414 | ServerStubProfile: *repository.NewServerProfile(server).(*repository.ServerStubProfile), |
| 415 | service: server, |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | // clientStubProfile implements Profile. |
| 420 | type clientStubProfile struct { |
| 421 | repository.Profile_ExcludingUniversal |
| 422 | |
| 423 | client _gen_ipc.Client |
| 424 | name string |
| 425 | } |
| 426 | |
| 427 | func (__gen_c *clientStubProfile) Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply profile.Specification, err error) { |
| 428 | var call _gen_ipc.Call |
| 429 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Specification", nil, opts...); err != nil { |
| 430 | return |
| 431 | } |
| 432 | if ierr := call.Finish(&reply, &err); ierr != nil { |
| 433 | err = ierr |
| 434 | } |
| 435 | return |
| 436 | } |
| 437 | |
| 438 | func (__gen_c *clientStubProfile) Put(ctx _gen_context.T, Specification profile.Specification, opts ..._gen_ipc.CallOpt) (err error) { |
| 439 | var call _gen_ipc.Call |
| 440 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Specification}, opts...); err != nil { |
| 441 | return |
| 442 | } |
| 443 | if ierr := call.Finish(&err); ierr != nil { |
| 444 | err = ierr |
| 445 | } |
| 446 | return |
| 447 | } |
| 448 | |
| 449 | func (__gen_c *clientStubProfile) Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error) { |
| 450 | var call _gen_ipc.Call |
| 451 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", nil, opts...); err != nil { |
| 452 | return |
| 453 | } |
| 454 | if ierr := call.Finish(&err); ierr != nil { |
| 455 | err = ierr |
| 456 | } |
| 457 | return |
| 458 | } |
| 459 | |
| 460 | func (__gen_c *clientStubProfile) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) { |
| 461 | var call _gen_ipc.Call |
| 462 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil { |
| 463 | return |
| 464 | } |
| 465 | if ierr := call.Finish(&reply, &err); ierr != nil { |
| 466 | err = ierr |
| 467 | } |
| 468 | return |
| 469 | } |
| 470 | |
| 471 | func (__gen_c *clientStubProfile) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) { |
| 472 | var call _gen_ipc.Call |
| 473 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil { |
| 474 | return |
| 475 | } |
| 476 | if ierr := call.Finish(&reply, &err); ierr != nil { |
| 477 | err = ierr |
| 478 | } |
| 479 | return |
| 480 | } |
| 481 | |
| 482 | func (__gen_c *clientStubProfile) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) { |
| 483 | var call _gen_ipc.Call |
| 484 | if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil { |
| 485 | return |
| 486 | } |
| 487 | if ierr := call.Finish(&reply, &err); ierr != nil { |
| 488 | err = ierr |
| 489 | } |
| 490 | return |
| 491 | } |
| 492 | |
| 493 | // ServerStubProfile wraps a server that implements |
| 494 | // ProfileService and provides an object that satisfies |
| 495 | // the requirements of veyron2/ipc.ReflectInvoker. |
| 496 | type ServerStubProfile struct { |
| 497 | repository.ServerStubProfile |
| 498 | |
| 499 | service ProfileService |
| 500 | } |
| 501 | |
| 502 | func (__gen_s *ServerStubProfile) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) { |
| 503 | // TODO(bprosnitz) GetMethodTags() will be replaces with Signature(). |
| 504 | // Note: This exhibits some weird behavior like returning a nil error if the method isn't found. |
| 505 | // This will change when it is replaced with Signature(). |
| 506 | if resp, err := __gen_s.ServerStubProfile.GetMethodTags(call, method); resp != nil || err != nil { |
| 507 | return resp, err |
| 508 | } |
| 509 | switch method { |
| 510 | case "Specification": |
| 511 | return []interface{}{security.Label(1)}, nil |
| 512 | case "Put": |
| 513 | return []interface{}{security.Label(2)}, nil |
| 514 | case "Remove": |
| 515 | return []interface{}{security.Label(2)}, nil |
| 516 | default: |
| 517 | return nil, nil |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | func (__gen_s *ServerStubProfile) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) { |
| 522 | result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)} |
| 523 | result.Methods["Put"] = _gen_ipc.MethodSignature{ |
| 524 | InArgs: []_gen_ipc.MethodArgument{ |
| 525 | {Name: "Specification", Type: 69}, |
| 526 | }, |
| 527 | OutArgs: []_gen_ipc.MethodArgument{ |
| 528 | {Name: "", Type: 70}, |
| 529 | }, |
| 530 | } |
| 531 | result.Methods["Remove"] = _gen_ipc.MethodSignature{ |
| 532 | InArgs: []_gen_ipc.MethodArgument{}, |
| 533 | OutArgs: []_gen_ipc.MethodArgument{ |
| 534 | {Name: "", Type: 70}, |
| 535 | }, |
| 536 | } |
| 537 | result.Methods["Specification"] = _gen_ipc.MethodSignature{ |
| 538 | InArgs: []_gen_ipc.MethodArgument{}, |
| 539 | OutArgs: []_gen_ipc.MethodArgument{ |
| 540 | {Name: "", Type: 69}, |
| 541 | {Name: "", Type: 70}, |
| 542 | }, |
| 543 | } |
| 544 | |
| 545 | result.TypeDefs = []_gen_vdl.Any{ |
| 546 | _gen_wiretype.MapType{Key: 0x3, Elem: 0x3, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{ |
| 547 | []_gen_wiretype.FieldType{ |
| 548 | _gen_wiretype.FieldType{Type: 0x3, Name: "Name"}, |
| 549 | _gen_wiretype.FieldType{Type: 0x41, Name: "Attributes"}, |
| 550 | }, |
| 551 | "veyron/services/mgmt/profile.Format", []string(nil)}, |
| 552 | _gen_wiretype.StructType{ |
| 553 | []_gen_wiretype.FieldType{ |
| 554 | _gen_wiretype.FieldType{Type: 0x3, Name: "Name"}, |
| 555 | _gen_wiretype.FieldType{Type: 0x3, Name: "MajorVersion"}, |
| 556 | _gen_wiretype.FieldType{Type: 0x3, Name: "MinorVersion"}, |
| 557 | }, |
| 558 | "veyron/services/mgmt/profile.Library", []string(nil)}, |
| 559 | _gen_wiretype.MapType{Key: 0x43, Elem: 0x2, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{ |
| 560 | []_gen_wiretype.FieldType{ |
| 561 | _gen_wiretype.FieldType{Type: 0x42, Name: "Format"}, |
| 562 | _gen_wiretype.FieldType{Type: 0x44, Name: "Libraries"}, |
| 563 | _gen_wiretype.FieldType{Type: 0x3, Name: "Label"}, |
| 564 | _gen_wiretype.FieldType{Type: 0x3, Name: "Description"}, |
| 565 | }, |
| 566 | "veyron/services/mgmt/profile.Specification", []string(nil)}, |
| 567 | _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}} |
| 568 | var ss _gen_ipc.ServiceSignature |
| 569 | var firstAdded int |
| 570 | ss, _ = __gen_s.ServerStubProfile.Signature(call) |
| 571 | firstAdded = len(result.TypeDefs) |
| 572 | for k, v := range ss.Methods { |
| 573 | for i, _ := range v.InArgs { |
| 574 | if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst { |
| 575 | v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded) |
| 576 | } |
| 577 | } |
| 578 | for i, _ := range v.OutArgs { |
| 579 | if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst { |
| 580 | v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded) |
| 581 | } |
| 582 | } |
| 583 | if v.InStream >= _gen_wiretype.TypeIDFirst { |
| 584 | v.InStream += _gen_wiretype.TypeID(firstAdded) |
| 585 | } |
| 586 | if v.OutStream >= _gen_wiretype.TypeIDFirst { |
| 587 | v.OutStream += _gen_wiretype.TypeID(firstAdded) |
| 588 | } |
| 589 | result.Methods[k] = v |
| 590 | } |
| 591 | //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication. |
| 592 | for _, d := range ss.TypeDefs { |
| 593 | switch wt := d.(type) { |
| 594 | case _gen_wiretype.SliceType: |
| 595 | if wt.Elem >= _gen_wiretype.TypeIDFirst { |
| 596 | wt.Elem += _gen_wiretype.TypeID(firstAdded) |
| 597 | } |
| 598 | d = wt |
| 599 | case _gen_wiretype.ArrayType: |
| 600 | if wt.Elem >= _gen_wiretype.TypeIDFirst { |
| 601 | wt.Elem += _gen_wiretype.TypeID(firstAdded) |
| 602 | } |
| 603 | d = wt |
| 604 | case _gen_wiretype.MapType: |
| 605 | if wt.Key >= _gen_wiretype.TypeIDFirst { |
| 606 | wt.Key += _gen_wiretype.TypeID(firstAdded) |
| 607 | } |
| 608 | if wt.Elem >= _gen_wiretype.TypeIDFirst { |
| 609 | wt.Elem += _gen_wiretype.TypeID(firstAdded) |
| 610 | } |
| 611 | d = wt |
| 612 | case _gen_wiretype.StructType: |
| 613 | for i, fld := range wt.Fields { |
| 614 | if fld.Type >= _gen_wiretype.TypeIDFirst { |
| 615 | wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded) |
| 616 | } |
| 617 | } |
| 618 | d = wt |
| 619 | // NOTE: other types are missing, but we are upgrading anyways. |
| 620 | } |
| 621 | result.TypeDefs = append(result.TypeDefs, d) |
| 622 | } |
| 623 | |
| 624 | return result, nil |
| 625 | } |
| 626 | |
| 627 | func (__gen_s *ServerStubProfile) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) { |
| 628 | if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok { |
| 629 | return unresolver.UnresolveStep(call) |
| 630 | } |
| 631 | if call.Server() == nil { |
| 632 | return |
| 633 | } |
| 634 | var published []string |
| 635 | if published, err = call.Server().Published(); err != nil || published == nil { |
| 636 | return |
| 637 | } |
| 638 | reply = make([]string, len(published)) |
| 639 | for i, p := range published { |
| 640 | reply[i] = _gen_naming.Join(p, call.Name()) |
| 641 | } |
| 642 | return |
| 643 | } |
| 644 | |
| 645 | func (__gen_s *ServerStubProfile) Specification(call _gen_ipc.ServerCall) (reply profile.Specification, err error) { |
| 646 | reply, err = __gen_s.service.Specification(call) |
| 647 | return |
| 648 | } |
| 649 | |
| 650 | func (__gen_s *ServerStubProfile) Put(call _gen_ipc.ServerCall, Specification profile.Specification) (err error) { |
| 651 | err = __gen_s.service.Put(call, Specification) |
| 652 | return |
| 653 | } |
| 654 | |
| 655 | func (__gen_s *ServerStubProfile) Remove(call _gen_ipc.ServerCall) (err error) { |
| 656 | err = __gen_s.service.Remove(call) |
| 657 | return |
| 658 | } |