Jiri Simsa | 67b8a26 | 2015-03-24 21:14:07 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Vanadium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
Suharsh Sivakumar | a4ac50a | 2015-03-13 16:13:50 -0700 | [diff] [blame] | 5 | // This file was auto-generated by the vanadium vdl tool. |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 6 | // Source: repository.vdl |
| 7 | |
Todd Wang | 8c4e5cc | 2015-04-09 11:30:52 -0700 | [diff] [blame] | 8 | // Package repository augments the v.io/v23/services/repository interfaces with |
| 9 | // implementation-specific configuration methods. |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 10 | package repository |
| 11 | |
| 12 | import ( |
Todd Wang | b0d5dce | 2015-02-05 14:07:55 -0800 | [diff] [blame] | 13 | // VDL system imports |
Jiri Simsa | 6ac9522 | 2015-02-23 16:11:49 -0800 | [diff] [blame] | 14 | "v.io/v23" |
| 15 | "v.io/v23/context" |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 16 | "v.io/v23/rpc" |
Jiri Simsa | 6ac9522 | 2015-02-23 16:11:49 -0800 | [diff] [blame] | 17 | "v.io/v23/vdl" |
Todd Wang | b0d5dce | 2015-02-05 14:07:55 -0800 | [diff] [blame] | 18 | |
| 19 | // VDL user imports |
Todd Wang | 387d8a4 | 2015-03-30 17:09:05 -0700 | [diff] [blame] | 20 | "v.io/v23/security/access" |
Todd Wang | 94c9d0b | 2015-04-01 14:27:00 -0700 | [diff] [blame] | 21 | "v.io/v23/services/application" |
Todd Wang | 30192a2 | 2015-03-31 13:24:41 -0700 | [diff] [blame] | 22 | "v.io/v23/services/permissions" |
Todd Wang | 94c9d0b | 2015-04-01 14:27:00 -0700 | [diff] [blame] | 23 | "v.io/v23/services/repository" |
Robert Kroeger | 3cd5ed5 | 2015-06-23 14:44:47 -0700 | [diff] [blame] | 24 | "v.io/v23/services/tidyable" |
Todd Wang | 159f6ee | 2015-04-02 18:57:46 -0700 | [diff] [blame] | 25 | "v.io/x/ref/services/profile" |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 26 | ) |
| 27 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 28 | // ApplicationClientMethods is the client interface |
| 29 | // containing Application methods. |
| 30 | // |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 31 | // Application describes an application repository internally. Besides the |
| 32 | // public Application interface, it allows adding and removing application |
| 33 | // envelopes, as well as querying for a list of supported profiles. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 34 | type ApplicationClientMethods interface { |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 35 | // Application provides access to application envelopes. An |
| 36 | // application envelope is identified by an application name and an |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 37 | // application version, which are specified through the object name, |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 38 | // and a profile name, which is specified using a method argument. |
| 39 | // |
| 40 | // Example: |
| 41 | // /apps/search/v1.Match([]string{"base", "media"}) |
| 42 | // returns an application envelope that can be used for downloading |
| 43 | // and executing the "search" application, version "v1", runnable |
| 44 | // on either the "base" or "media" profile. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 45 | repository.ApplicationClientMethods |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 46 | // Put adds the given application envelope for the given profile and |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 47 | // application version (required, and specified through the object name |
| 48 | // suffix). |
| 49 | // |
| 50 | // An error is returned if an envelope already exists, unless the |
| 51 | // overwrite option is set. |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 52 | Put(ctx *context.T, Profile string, Envelope application.Envelope, Overwrite bool, opts ...rpc.CallOpt) error |
| 53 | // DEPRECATED. Please use Put for new code. |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 54 | PutX(ctx *context.T, Profile string, Envelope application.Envelope, Overwrite bool, opts ...rpc.CallOpt) error |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 55 | // Remove removes the application envelope for the given profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 56 | // name and application version (specified through the object name |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 57 | // suffix). |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 58 | // |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 59 | // If no version is specified as part of the suffix, the method removes |
| 60 | // all versions for the given profile. |
| 61 | // |
| 62 | // If the profile is the string "*", all profiles are removed for the |
| 63 | // given version (or for all versions if the version is not specified). |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 64 | Remove(ctx *context.T, Profile string, opts ...rpc.CallOpt) error |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 65 | // Profiles returns the supported profiles for the application version |
| 66 | // specified through the object name suffix. If the version is not |
| 67 | // specified, Profiles returns the union of profiles across all |
| 68 | // versions. |
| 69 | Profiles(*context.T, ...rpc.CallOpt) ([]string, error) |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 70 | } |
| 71 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 72 | // ApplicationClientStub adds universal methods to ApplicationClientMethods. |
| 73 | type ApplicationClientStub interface { |
| 74 | ApplicationClientMethods |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 75 | rpc.UniversalServiceMethods |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 78 | // ApplicationClient returns a client stub for Application. |
Asim Shankar | 69fa69f | 2015-04-01 11:34:32 -0700 | [diff] [blame] | 79 | func ApplicationClient(name string) ApplicationClientStub { |
| 80 | return implApplicationClientStub{name, repository.ApplicationClient(name)} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 83 | type implApplicationClientStub struct { |
Asim Shankar | 69fa69f | 2015-04-01 11:34:32 -0700 | [diff] [blame] | 84 | name string |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 85 | |
| 86 | repository.ApplicationClientStub |
| 87 | } |
| 88 | |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 89 | func (c implApplicationClientStub) Put(ctx *context.T, i0 string, i1 application.Envelope, i2 bool, opts ...rpc.CallOpt) (err error) { |
| 90 | err = v23.GetClient(ctx).Call(ctx, c.name, "Put", []interface{}{i0, i1, i2}, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 91 | return |
| 92 | } |
| 93 | |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 94 | func (c implApplicationClientStub) PutX(ctx *context.T, i0 string, i1 application.Envelope, i2 bool, opts ...rpc.CallOpt) (err error) { |
| 95 | err = v23.GetClient(ctx).Call(ctx, c.name, "PutX", []interface{}{i0, i1, i2}, nil, opts...) |
| 96 | return |
| 97 | } |
| 98 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 99 | func (c implApplicationClientStub) Remove(ctx *context.T, i0 string, opts ...rpc.CallOpt) (err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 100 | err = v23.GetClient(ctx).Call(ctx, c.name, "Remove", []interface{}{i0}, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 101 | return |
| 102 | } |
| 103 | |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 104 | func (c implApplicationClientStub) Profiles(ctx *context.T, opts ...rpc.CallOpt) (o0 []string, err error) { |
| 105 | err = v23.GetClient(ctx).Call(ctx, c.name, "Profiles", nil, []interface{}{&o0}, opts...) |
| 106 | return |
| 107 | } |
| 108 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 109 | // ApplicationServerMethods is the interface a server writer |
| 110 | // implements for Application. |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 111 | // |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 112 | // Application describes an application repository internally. Besides the |
| 113 | // public Application interface, it allows adding and removing application |
| 114 | // envelopes, as well as querying for a list of supported profiles. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 115 | type ApplicationServerMethods interface { |
| 116 | // Application provides access to application envelopes. An |
| 117 | // application envelope is identified by an application name and an |
| 118 | // application version, which are specified through the object name, |
| 119 | // and a profile name, which is specified using a method argument. |
| 120 | // |
| 121 | // Example: |
| 122 | // /apps/search/v1.Match([]string{"base", "media"}) |
| 123 | // returns an application envelope that can be used for downloading |
| 124 | // and executing the "search" application, version "v1", runnable |
| 125 | // on either the "base" or "media" profile. |
| 126 | repository.ApplicationServerMethods |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 127 | // Put adds the given application envelope for the given profile and |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 128 | // application version (required, and specified through the object name |
| 129 | // suffix). |
| 130 | // |
| 131 | // An error is returned if an envelope already exists, unless the |
| 132 | // overwrite option is set. |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 133 | Put(ctx *context.T, call rpc.ServerCall, Profile string, Envelope application.Envelope, Overwrite bool) error |
| 134 | // DEPRECATED. Please use Put for new code. |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 135 | PutX(ctx *context.T, call rpc.ServerCall, Profile string, Envelope application.Envelope, Overwrite bool) error |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 136 | // Remove removes the application envelope for the given profile |
| 137 | // name and application version (specified through the object name |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 138 | // suffix). |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 139 | // |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 140 | // If no version is specified as part of the suffix, the method removes |
| 141 | // all versions for the given profile. |
| 142 | // |
| 143 | // If the profile is the string "*", all profiles are removed for the |
| 144 | // given version (or for all versions if the version is not specified). |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 145 | Remove(ctx *context.T, call rpc.ServerCall, Profile string) error |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 146 | // Profiles returns the supported profiles for the application version |
| 147 | // specified through the object name suffix. If the version is not |
| 148 | // specified, Profiles returns the union of profiles across all |
| 149 | // versions. |
| 150 | Profiles(*context.T, rpc.ServerCall) ([]string, error) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | // ApplicationServerStubMethods is the server interface containing |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 154 | // Application methods, as expected by rpc.Server. |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 155 | // There is no difference between this interface and ApplicationServerMethods |
| 156 | // since there are no streaming methods. |
| 157 | type ApplicationServerStubMethods ApplicationServerMethods |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 158 | |
| 159 | // ApplicationServerStub adds universal methods to ApplicationServerStubMethods. |
| 160 | type ApplicationServerStub interface { |
| 161 | ApplicationServerStubMethods |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 162 | // Describe the Application interfaces. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 163 | Describe__() []rpc.InterfaceDesc |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | // ApplicationServer returns a server stub for Application. |
| 167 | // It converts an implementation of ApplicationServerMethods into |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 168 | // an object that may be used by rpc.Server. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 169 | func ApplicationServer(impl ApplicationServerMethods) ApplicationServerStub { |
| 170 | stub := implApplicationServerStub{ |
| 171 | impl: impl, |
| 172 | ApplicationServerStub: repository.ApplicationServer(impl), |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 173 | } |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 174 | // Initialize GlobState; always check the stub itself first, to handle the |
| 175 | // case where the user has the Glob method defined in their VDL source. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 176 | if gs := rpc.NewGlobState(stub); gs != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 177 | stub.gs = gs |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 178 | } else if gs := rpc.NewGlobState(impl); gs != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 179 | stub.gs = gs |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 180 | } |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 181 | return stub |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 182 | } |
| 183 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 184 | type implApplicationServerStub struct { |
| 185 | impl ApplicationServerMethods |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 186 | repository.ApplicationServerStub |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 187 | gs *rpc.GlobState |
Matt Rosencrantz | bf85d54 | 2014-08-22 13:31:14 -0700 | [diff] [blame] | 188 | } |
| 189 | |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 190 | func (s implApplicationServerStub) Put(ctx *context.T, call rpc.ServerCall, i0 string, i1 application.Envelope, i2 bool) error { |
| 191 | return s.impl.Put(ctx, call, i0, i1, i2) |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 192 | } |
| 193 | |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 194 | func (s implApplicationServerStub) PutX(ctx *context.T, call rpc.ServerCall, i0 string, i1 application.Envelope, i2 bool) error { |
| 195 | return s.impl.PutX(ctx, call, i0, i1, i2) |
| 196 | } |
| 197 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 198 | func (s implApplicationServerStub) Remove(ctx *context.T, call rpc.ServerCall, i0 string) error { |
| 199 | return s.impl.Remove(ctx, call, i0) |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 200 | } |
| 201 | |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 202 | func (s implApplicationServerStub) Profiles(ctx *context.T, call rpc.ServerCall) ([]string, error) { |
| 203 | return s.impl.Profiles(ctx, call) |
| 204 | } |
| 205 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 206 | func (s implApplicationServerStub) Globber() *rpc.GlobState { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 207 | return s.gs |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 208 | } |
| 209 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 210 | func (s implApplicationServerStub) Describe__() []rpc.InterfaceDesc { |
Robert Kroeger | 3cd5ed5 | 2015-06-23 14:44:47 -0700 | [diff] [blame] | 211 | return []rpc.InterfaceDesc{ApplicationDesc, repository.ApplicationDesc, permissions.ObjectDesc, tidyable.TidyableDesc} |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | // ApplicationDesc describes the Application interface. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 215 | var ApplicationDesc rpc.InterfaceDesc = descApplication |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 216 | |
| 217 | // descApplication hides the desc to keep godoc clean. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 218 | var descApplication = rpc.InterfaceDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 219 | Name: "Application", |
Todd Wang | 1ea8f19 | 2015-04-03 17:31:51 -0700 | [diff] [blame] | 220 | PkgPath: "v.io/x/ref/services/repository", |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 221 | Doc: "// Application describes an application repository internally. Besides the\n// public Application interface, it allows adding and removing application\n// envelopes, as well as querying for a list of supported profiles.", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 222 | Embeds: []rpc.EmbedDesc{ |
Todd Wang | 94c9d0b | 2015-04-01 14:27:00 -0700 | [diff] [blame] | 223 | {"Application", "v.io/v23/services/repository", "// Application provides access to application envelopes. An\n// application envelope is identified by an application name and an\n// application version, which are specified through the object name,\n// and a profile name, which is specified using a method argument.\n//\n// Example:\n// /apps/search/v1.Match([]string{\"base\", \"media\"})\n// returns an application envelope that can be used for downloading\n// and executing the \"search\" application, version \"v1\", runnable\n// on either the \"base\" or \"media\" profile."}, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 224 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 225 | Methods: []rpc.MethodDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 226 | { |
| 227 | Name: "Put", |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 228 | Doc: "// Put adds the given application envelope for the given profile and\n// application version (required, and specified through the object name\n// suffix).\n//\n// An error is returned if an envelope already exists, unless the\n// overwrite option is set.", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 229 | InArgs: []rpc.ArgDesc{ |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 230 | {"Profile", ``}, // string |
| 231 | {"Envelope", ``}, // application.Envelope |
| 232 | {"Overwrite", ``}, // bool |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 233 | }, |
Todd Wang | b31da59 | 2015-02-20 12:50:39 -0800 | [diff] [blame] | 234 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))}, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 235 | }, |
| 236 | { |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 237 | Name: "PutX", |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 238 | Doc: "// DEPRECATED. Please use Put for new code.", |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 239 | InArgs: []rpc.ArgDesc{ |
| 240 | {"Profile", ``}, // string |
| 241 | {"Envelope", ``}, // application.Envelope |
| 242 | {"Overwrite", ``}, // bool |
| 243 | }, |
| 244 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))}, |
| 245 | }, |
| 246 | { |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 247 | Name: "Remove", |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 248 | Doc: "// Remove removes the application envelope for the given profile\n// name and application version (specified through the object name\n// suffix).\n//\n// If no version is specified as part of the suffix, the method removes\n// all versions for the given profile.\n//\n// If the profile is the string \"*\", all profiles are removed for the\n// given version (or for all versions if the version is not specified).", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 249 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 250 | {"Profile", ``}, // string |
| 251 | }, |
Todd Wang | b31da59 | 2015-02-20 12:50:39 -0800 | [diff] [blame] | 252 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))}, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 253 | }, |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 254 | { |
| 255 | Name: "Profiles", |
| 256 | Doc: "// Profiles returns the supported profiles for the application version\n// specified through the object name suffix. If the version is not\n// specified, Profiles returns the union of profiles across all\n// versions.", |
| 257 | OutArgs: []rpc.ArgDesc{ |
| 258 | {"", ``}, // []string |
| 259 | }, |
| 260 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Read"))}, |
| 261 | }, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 262 | }, |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 263 | } |
| 264 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 265 | // ProfileClientMethods is the client interface |
| 266 | // containing Profile methods. |
| 267 | // |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 268 | // Profile describes a profile internally. Besides the public Profile |
| 269 | // interface, it allows to add and remove profile specifications. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 270 | type ProfileClientMethods interface { |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 271 | // Profile abstracts a device's ability to run binaries, and hides |
| 272 | // specifics such as the operating system, hardware architecture, and |
| 273 | // the set of installed libraries. Profiles describe binaries and |
| 274 | // devices, and are used to match them. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 275 | repository.ProfileClientMethods |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 276 | // Specification returns the profile specification for the profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 277 | // identified through the object name suffix. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 278 | Specification(*context.T, ...rpc.CallOpt) (profile.Specification, error) |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 279 | // Put sets the profile specification for the profile identified |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 280 | // through the object name suffix. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 281 | Put(ctx *context.T, Specification profile.Specification, opts ...rpc.CallOpt) error |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 282 | // Remove removes the profile specification for the profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 283 | // identified through the object name suffix. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 284 | Remove(*context.T, ...rpc.CallOpt) error |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 285 | } |
| 286 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 287 | // ProfileClientStub adds universal methods to ProfileClientMethods. |
| 288 | type ProfileClientStub interface { |
| 289 | ProfileClientMethods |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 290 | rpc.UniversalServiceMethods |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 293 | // ProfileClient returns a client stub for Profile. |
Asim Shankar | 69fa69f | 2015-04-01 11:34:32 -0700 | [diff] [blame] | 294 | func ProfileClient(name string) ProfileClientStub { |
| 295 | return implProfileClientStub{name, repository.ProfileClient(name)} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 296 | } |
| 297 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 298 | type implProfileClientStub struct { |
Asim Shankar | 69fa69f | 2015-04-01 11:34:32 -0700 | [diff] [blame] | 299 | name string |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 300 | |
| 301 | repository.ProfileClientStub |
| 302 | } |
| 303 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 304 | func (c implProfileClientStub) Specification(ctx *context.T, opts ...rpc.CallOpt) (o0 profile.Specification, err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 305 | err = v23.GetClient(ctx).Call(ctx, c.name, "Specification", nil, []interface{}{&o0}, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 306 | return |
| 307 | } |
| 308 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 309 | func (c implProfileClientStub) Put(ctx *context.T, i0 profile.Specification, opts ...rpc.CallOpt) (err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 310 | err = v23.GetClient(ctx).Call(ctx, c.name, "Put", []interface{}{i0}, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 311 | return |
| 312 | } |
| 313 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 314 | func (c implProfileClientStub) Remove(ctx *context.T, opts ...rpc.CallOpt) (err error) { |
Suharsh Sivakumar | df2672a | 2015-04-09 19:26:43 -0700 | [diff] [blame] | 315 | err = v23.GetClient(ctx).Call(ctx, c.name, "Remove", nil, nil, opts...) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 316 | return |
| 317 | } |
| 318 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 319 | // ProfileServerMethods is the interface a server writer |
| 320 | // implements for Profile. |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 321 | // |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 322 | // Profile describes a profile internally. Besides the public Profile |
| 323 | // interface, it allows to add and remove profile specifications. |
| 324 | type ProfileServerMethods interface { |
| 325 | // Profile abstracts a device's ability to run binaries, and hides |
| 326 | // specifics such as the operating system, hardware architecture, and |
| 327 | // the set of installed libraries. Profiles describe binaries and |
| 328 | // devices, and are used to match them. |
| 329 | repository.ProfileServerMethods |
| 330 | // Specification returns the profile specification for the profile |
| 331 | // identified through the object name suffix. |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 332 | Specification(*context.T, rpc.ServerCall) (profile.Specification, error) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 333 | // Put sets the profile specification for the profile identified |
| 334 | // through the object name suffix. |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 335 | Put(ctx *context.T, call rpc.ServerCall, Specification profile.Specification) error |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 336 | // Remove removes the profile specification for the profile |
| 337 | // identified through the object name suffix. |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 338 | Remove(*context.T, rpc.ServerCall) error |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | // ProfileServerStubMethods is the server interface containing |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 342 | // Profile methods, as expected by rpc.Server. |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 343 | // There is no difference between this interface and ProfileServerMethods |
| 344 | // since there are no streaming methods. |
| 345 | type ProfileServerStubMethods ProfileServerMethods |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 346 | |
| 347 | // ProfileServerStub adds universal methods to ProfileServerStubMethods. |
| 348 | type ProfileServerStub interface { |
| 349 | ProfileServerStubMethods |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 350 | // Describe the Profile interfaces. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 351 | Describe__() []rpc.InterfaceDesc |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | // ProfileServer returns a server stub for Profile. |
| 355 | // It converts an implementation of ProfileServerMethods into |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 356 | // an object that may be used by rpc.Server. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 357 | func ProfileServer(impl ProfileServerMethods) ProfileServerStub { |
| 358 | stub := implProfileServerStub{ |
| 359 | impl: impl, |
| 360 | ProfileServerStub: repository.ProfileServer(impl), |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 361 | } |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 362 | // Initialize GlobState; always check the stub itself first, to handle the |
| 363 | // case where the user has the Glob method defined in their VDL source. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 364 | if gs := rpc.NewGlobState(stub); gs != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 365 | stub.gs = gs |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 366 | } else if gs := rpc.NewGlobState(impl); gs != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 367 | stub.gs = gs |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 368 | } |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 369 | return stub |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 370 | } |
| 371 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 372 | type implProfileServerStub struct { |
| 373 | impl ProfileServerMethods |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 374 | repository.ProfileServerStub |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 375 | gs *rpc.GlobState |
Matt Rosencrantz | bf85d54 | 2014-08-22 13:31:14 -0700 | [diff] [blame] | 376 | } |
| 377 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 378 | func (s implProfileServerStub) Specification(ctx *context.T, call rpc.ServerCall) (profile.Specification, error) { |
| 379 | return s.impl.Specification(ctx, call) |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 380 | } |
| 381 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 382 | func (s implProfileServerStub) Put(ctx *context.T, call rpc.ServerCall, i0 profile.Specification) error { |
| 383 | return s.impl.Put(ctx, call, i0) |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 384 | } |
| 385 | |
Todd Wang | 54feabe | 2015-04-15 23:38:26 -0700 | [diff] [blame] | 386 | func (s implProfileServerStub) Remove(ctx *context.T, call rpc.ServerCall) error { |
| 387 | return s.impl.Remove(ctx, call) |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 388 | } |
| 389 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 390 | func (s implProfileServerStub) Globber() *rpc.GlobState { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 391 | return s.gs |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 392 | } |
| 393 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 394 | func (s implProfileServerStub) Describe__() []rpc.InterfaceDesc { |
| 395 | return []rpc.InterfaceDesc{ProfileDesc, repository.ProfileDesc} |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | // ProfileDesc describes the Profile interface. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 399 | var ProfileDesc rpc.InterfaceDesc = descProfile |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 400 | |
| 401 | // descProfile hides the desc to keep godoc clean. |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 402 | var descProfile = rpc.InterfaceDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 403 | Name: "Profile", |
Todd Wang | 1ea8f19 | 2015-04-03 17:31:51 -0700 | [diff] [blame] | 404 | PkgPath: "v.io/x/ref/services/repository", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 405 | Doc: "// Profile describes a profile internally. Besides the public Profile\n// interface, it allows to add and remove profile specifications.", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 406 | Embeds: []rpc.EmbedDesc{ |
Todd Wang | 94c9d0b | 2015-04-01 14:27:00 -0700 | [diff] [blame] | 407 | {"Profile", "v.io/v23/services/repository", "// Profile abstracts a device's ability to run binaries, and hides\n// specifics such as the operating system, hardware architecture, and\n// the set of installed libraries. Profiles describe binaries and\n// devices, and are used to match them."}, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 408 | }, |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 409 | Methods: []rpc.MethodDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 410 | { |
| 411 | Name: "Specification", |
| 412 | Doc: "// Specification returns the profile specification for the profile\n// identified through the object name suffix.", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 413 | OutArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 414 | {"", ``}, // profile.Specification |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 415 | }, |
Todd Wang | b31da59 | 2015-02-20 12:50:39 -0800 | [diff] [blame] | 416 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Read"))}, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 417 | }, |
| 418 | { |
| 419 | Name: "Put", |
| 420 | Doc: "// Put sets the profile specification for the profile identified\n// through the object name suffix.", |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 421 | InArgs: []rpc.ArgDesc{ |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 422 | {"Specification", ``}, // profile.Specification |
| 423 | }, |
Todd Wang | b31da59 | 2015-02-20 12:50:39 -0800 | [diff] [blame] | 424 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))}, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 425 | }, |
| 426 | { |
| 427 | Name: "Remove", |
| 428 | Doc: "// Remove removes the profile specification for the profile\n// identified through the object name suffix.", |
Todd Wang | b31da59 | 2015-02-20 12:50:39 -0800 | [diff] [blame] | 429 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))}, |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 430 | }, |
| 431 | }, |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 432 | } |