Jiri Simsa | 756772c | 2015-03-25 15:40:54 -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 | |
Todd Wang | 8c4e5cc | 2015-04-09 11:30:52 -0700 | [diff] [blame] | 5 | // Package repository augments the v.io/v23/services/repository interfaces with |
| 6 | // implementation-specific configuration methods. |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 7 | package repository |
| 8 | |
| 9 | import ( |
Todd Wang | 387d8a4 | 2015-03-30 17:09:05 -0700 | [diff] [blame] | 10 | "v.io/v23/security/access" |
Todd Wang | 94c9d0b | 2015-04-01 14:27:00 -0700 | [diff] [blame] | 11 | "v.io/v23/services/application" |
Todd Wang | 159f6ee | 2015-04-02 18:57:46 -0700 | [diff] [blame] | 12 | "v.io/x/ref/services/profile" |
Todd Wang | 94c9d0b | 2015-04-01 14:27:00 -0700 | [diff] [blame] | 13 | public "v.io/v23/services/repository" |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 14 | ) |
| 15 | |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 16 | // Application describes an application repository internally. Besides the |
| 17 | // public Application interface, it allows adding and removing application |
| 18 | // envelopes, as well as querying for a list of supported profiles. |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 19 | type Application interface { |
| 20 | public.Application |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 21 | // Put adds the given application envelope for the given profile and |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 22 | // application version (required, and specified through the object name |
| 23 | // suffix). |
| 24 | // |
| 25 | // An error is returned if an envelope already exists, unless the |
| 26 | // overwrite option is set. |
Bogdan Caprita | 661c19a | 2015-09-04 09:36:58 -0700 | [diff] [blame] | 27 | Put(Profile string, Envelope application.Envelope, Overwrite bool) error {access.Write} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 28 | // Remove removes the application envelope for the given profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 29 | // name and application version (specified through the object name |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 30 | // suffix). |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 31 | // |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 32 | // If no version is specified as part of the suffix, the method removes |
| 33 | // all versions for the given profile. |
| 34 | // |
| 35 | // If the profile is the string "*", all profiles are removed for the |
| 36 | // given version (or for all versions if the version is not specified). |
Asim Shankar | 6888519 | 2014-11-26 12:48:35 -0800 | [diff] [blame] | 37 | Remove(Profile string) error {access.Write} |
Bogdan Caprita | edf6d2b | 2015-09-02 16:09:03 -0700 | [diff] [blame] | 38 | // Profiles returns the supported profiles for the application version |
| 39 | // specified through the object name suffix. If the version is not |
| 40 | // specified, Profiles returns the union of profiles across all |
| 41 | // versions. |
| 42 | Profiles() ([]string | error) {access.Read} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | // Profile describes a profile internally. Besides the public Profile |
| 46 | // interface, it allows to add and remove profile specifications. |
| 47 | type Profile interface { |
| 48 | public.Profile |
| 49 | // Specification returns the profile specification for the profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 50 | // identified through the object name suffix. |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 51 | Specification() (profile.Specification | error) {access.Read} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 52 | // Put sets the profile specification for the profile identified |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 53 | // through the object name suffix. |
Asim Shankar | 6888519 | 2014-11-26 12:48:35 -0800 | [diff] [blame] | 54 | Put(Specification profile.Specification) error {access.Write} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 55 | // Remove removes the profile specification for the profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 56 | // identified through the object name suffix. |
Asim Shankar | 6888519 | 2014-11-26 12:48:35 -0800 | [diff] [blame] | 57 | Remove() error {access.Write} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 58 | } |