blob: 4f6f1b3cf46a6905ffe084e44ce538555c2d1df4 [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
Jiri Simsaddbfebb2014-06-20 15:56:06 -07005// Package repository contains implementation of the interface for
Suharsh Sivakumard1cc6e02015-03-16 13:58:49 -07006// storing and serving various vanadium management objects.
Jiri Simsaddbfebb2014-06-20 15:56:06 -07007package repository
8
9import (
Todd Wang387d8a42015-03-30 17:09:05 -070010 "v.io/v23/security/access"
Jiri Simsa6ac95222015-02-23 16:11:49 -080011 "v.io/v23/services/mgmt/application"
Todd Wang387d8a42015-03-30 17:09:05 -070012 "v.io/x/ref/services/mgmt/profile"
Jiri Simsa6ac95222015-02-23 16:11:49 -080013 public "v.io/v23/services/mgmt/repository"
Jiri Simsaddbfebb2014-06-20 15:56:06 -070014)
15
16// Application describes an application repository internally. Besides
17// the public Application interface, it allows to add and remove
18// application envelopes.
19type Application interface {
20 public.Application
21 // Put adds the given tuple of application version (specified
Bogdan Capritad9281a32014-07-02 14:40:39 -070022 // through the object name suffix) and application envelope to all
Jiri Simsaddbfebb2014-06-20 15:56:06 -070023 // of the given application profiles.
Asim Shankar68885192014-11-26 12:48:35 -080024 Put(Profiles []string, Envelope application.Envelope) error {access.Write}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070025 // Remove removes the application envelope for the given profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070026 // name and application version (specified through the object name
Jiri Simsaddbfebb2014-06-20 15:56:06 -070027 // suffix). If no version is specified as part of the suffix, the
28 // method removes all versions for the given profile.
29 //
30 // TODO(jsimsa): Add support for using "*" to specify all profiles
31 // when Matt implements Globing (or Ken implements querying).
Asim Shankar68885192014-11-26 12:48:35 -080032 Remove(Profile string) error {access.Write}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070033}
34
35// Profile describes a profile internally. Besides the public Profile
36// interface, it allows to add and remove profile specifications.
37type Profile interface {
38 public.Profile
39 // Specification returns the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070040 // identified through the object name suffix.
Todd Wang383e88c2014-12-18 01:52:34 -080041 Specification() (profile.Specification | error) {access.Read}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070042 // Put sets the profile specification for the profile identified
Bogdan Capritad9281a32014-07-02 14:40:39 -070043 // through the object name suffix.
Asim Shankar68885192014-11-26 12:48:35 -080044 Put(Specification profile.Specification) error {access.Write}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070045 // Remove removes the profile specification for the profile
Bogdan Capritad9281a32014-07-02 14:40:39 -070046 // identified through the object name suffix.
Asim Shankar68885192014-11-26 12:48:35 -080047 Remove() error {access.Write}
Jiri Simsaddbfebb2014-06-20 15:56:06 -070048}