blob: a9f62872a1e88175c22af46c594fa474f1e113da [file] [log] [blame]
Jiri Simsa756772c2015-03-25 15:40:54 -07001// 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 Wang8c4e5cc2015-04-09 11:30:52 -07005// Package repository augments the v.io/v23/services/repository interfaces with
6// implementation-specific configuration methods.
Jiri Simsaddbfebb2014-06-20 15:56:06 -07007package repository
8
9import (
Todd Wang387d8a42015-03-30 17:09:05 -070010 "v.io/v23/security/access"
Todd Wang94c9d0b2015-04-01 14:27:00 -070011 "v.io/v23/services/application"
Todd Wang159f6ee2015-04-02 18:57:46 -070012 "v.io/x/ref/services/profile"
Todd Wang94c9d0b2015-04-01 14:27:00 -070013 public "v.io/v23/services/repository"
Jiri Simsaddbfebb2014-06-20 15:56:06 -070014)
15
Bogdan Capritaedf6d2b2015-09-02 16:09:03 -070016// 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 Simsaddbfebb2014-06-20 15:56:06 -070019type Application interface {
20 public.Application
Bogdan Caprita661c19a2015-09-04 09:36:58 -070021 // Put adds the given application envelope for the given profile and
Bogdan Capritaedf6d2b2015-09-02 16:09:03 -070022 // 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 Caprita661c19a2015-09-04 09:36:58 -070027 Put(Profile string, Envelope application.Envelope, Overwrite bool) error {access.Write}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070028 // Remove removes the application envelope for the given profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070029 // name and application version (specified through the object name
Bogdan Capritaedf6d2b2015-09-02 16:09:03 -070030 // suffix).
Jiri Simsaddbfebb2014-06-20 15:56:06 -070031 //
Bogdan Capritaedf6d2b2015-09-02 16:09:03 -070032 // 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 Shankar68885192014-11-26 12:48:35 -080037 Remove(Profile string) error {access.Write}
Bogdan Capritaedf6d2b2015-09-02 16:09:03 -070038 // 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 Simsaddbfebb2014-06-20 15:56:06 -070043}
44
45// Profile describes a profile internally. Besides the public Profile
46// interface, it allows to add and remove profile specifications.
47type Profile interface {
48 public.Profile
49 // Specification returns the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070050 // identified through the object name suffix.
Todd Wang383e88c2014-12-18 01:52:34 -080051 Specification() (profile.Specification | error) {access.Read}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070052 // Put sets the profile specification for the profile identified
Bogdan Capritad9281a32014-07-02 14:40:39 -070053 // through the object name suffix.
Asim Shankar68885192014-11-26 12:48:35 -080054 Put(Specification profile.Specification) error {access.Write}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070055 // Remove removes the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070056 // identified through the object name suffix.
Asim Shankar68885192014-11-26 12:48:35 -080057 Remove() error {access.Write}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070058}