services/mgmt: moving Application, Content, and Profile into a single
'repository' package
Change-Id: Ief596fb33686cc7e932fc943f553e6b1b56be4c6
diff --git a/services/mgmt/application/application.vdl b/services/mgmt/application/application.vdl
deleted file mode 100644
index 71ebdc7..0000000
--- a/services/mgmt/application/application.vdl
+++ /dev/null
@@ -1,25 +0,0 @@
-// Package application contains implementation of the interface for
-// serving application metadata.
-package application
-
-import "veyron2/security"
-import public "veyron2/services/mgmt/application"
-
-// Repository describes an application repository internally. Besides
-// the public Repository interface, it allows to manage the actual
-// application metadata.
-type Repository interface {
- public.Repository
- // Put adds the given tuple of application version (specified
- // through the veyron name suffix) and application envelope to all
- // of the given application profiles.
- Put(Profiles []string, Envelope public.Envelope) error {security.WriteLabel}
- // Remove removes the application envelope for the given profile
- // name and application version (specified through the veyron name
- // suffix). If no version is specified as part of the suffix, the
- // method removes all versions for the given profile.
- //
- // TODO(jsimsa): Add support for using "*" to specify all profiles
- // when Matt implements Globing (or Ken implements querying).
- Remove(Profile string) error {security.WriteLabel}
-}
diff --git a/services/mgmt/application/application.vdl.go b/services/mgmt/application/application.vdl.go
deleted file mode 100644
index 1be1d59..0000000
--- a/services/mgmt/application/application.vdl.go
+++ /dev/null
@@ -1,337 +0,0 @@
-// This file was auto-generated by the veyron vdl tool.
-// Source: application.vdl
-
-// Package application contains implementation of the interface for
-// serving application metadata.
-package application
-
-import (
- "veyron2/security"
-
- "veyron2/services/mgmt/application"
-
- // The non-user imports are prefixed with "_gen_" to prevent collisions.
- _gen_veyron2 "veyron2"
- _gen_context "veyron2/context"
- _gen_ipc "veyron2/ipc"
- _gen_naming "veyron2/naming"
- _gen_rt "veyron2/rt"
- _gen_vdl "veyron2/vdl"
- _gen_wiretype "veyron2/wiretype"
-)
-
-// Repository describes an application repository internally. Besides
-// the public Repository interface, it allows to manage the actual
-// application metadata.
-// Repository is the interface the client binds and uses.
-// Repository_ExcludingUniversal is the interface without internal framework-added methods
-// to enable embedding without method collisions. Not to be used directly by clients.
-type Repository_ExcludingUniversal interface {
- // Repository provides access to application envelopes. An
- // application envelope is identified by an application name and an
- // application version, which are specified through the veyron name,
- // and a profile name, which is specified using a method argument.
- //
- // Example:
- // /apps/search/v1.Match([]string{"base", "media"})
- // returns an application envelope that can be used for downloading
- // and executing the "search" application, version "v1", runnable
- // on either the "base" or "media" profile.
- //
- // Further, we envision that there will be special "latest" and
- // "release" versions that will be symbolic links whose mapping is
- // maintained by a mount table.
- application.Repository_ExcludingUniversal
- // Put adds the given tuple of application version (specified
- // through the veyron name suffix) and application envelope to all
- // of the given application profiles.
- Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error)
- // Remove removes the application envelope for the given profile
- // name and application version (specified through the veyron name
- // suffix). If no version is specified as part of the suffix, the
- // method removes all versions for the given profile.
- //
- // TODO(jsimsa): Add support for using "*" to specify all profiles
- // when Matt implements Globing (or Ken implements querying).
- Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error)
-}
-type Repository interface {
- _gen_ipc.UniversalServiceMethods
- Repository_ExcludingUniversal
-}
-
-// RepositoryService is the interface the server implements.
-type RepositoryService interface {
-
- // Repository provides access to application envelopes. An
- // application envelope is identified by an application name and an
- // application version, which are specified through the veyron name,
- // and a profile name, which is specified using a method argument.
- //
- // Example:
- // /apps/search/v1.Match([]string{"base", "media"})
- // returns an application envelope that can be used for downloading
- // and executing the "search" application, version "v1", runnable
- // on either the "base" or "media" profile.
- //
- // Further, we envision that there will be special "latest" and
- // "release" versions that will be symbolic links whose mapping is
- // maintained by a mount table.
- application.RepositoryService
- // Put adds the given tuple of application version (specified
- // through the veyron name suffix) and application envelope to all
- // of the given application profiles.
- Put(context _gen_ipc.ServerContext, Profiles []string, Envelope application.Envelope) (err error)
- // Remove removes the application envelope for the given profile
- // name and application version (specified through the veyron name
- // suffix). If no version is specified as part of the suffix, the
- // method removes all versions for the given profile.
- //
- // TODO(jsimsa): Add support for using "*" to specify all profiles
- // when Matt implements Globing (or Ken implements querying).
- Remove(context _gen_ipc.ServerContext, Profile string) (err error)
-}
-
-// BindRepository returns the client stub implementing the Repository
-// interface.
-//
-// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
-// global Runtime is used.
-func BindRepository(name string, opts ..._gen_ipc.BindOpt) (Repository, error) {
- var client _gen_ipc.Client
- switch len(opts) {
- case 0:
- client = _gen_rt.R().Client()
- case 1:
- switch o := opts[0].(type) {
- case _gen_veyron2.Runtime:
- client = o.Client()
- case _gen_ipc.Client:
- client = o
- default:
- return nil, _gen_vdl.ErrUnrecognizedOption
- }
- default:
- return nil, _gen_vdl.ErrTooManyOptionsToBind
- }
- stub := &clientStubRepository{client: client, name: name}
- stub.Repository_ExcludingUniversal, _ = application.BindRepository(name, client)
-
- return stub, nil
-}
-
-// NewServerRepository creates a new server stub.
-//
-// It takes a regular server implementing the RepositoryService
-// interface, and returns a new server stub.
-func NewServerRepository(server RepositoryService) interface{} {
- return &ServerStubRepository{
- ServerStubRepository: *application.NewServerRepository(server).(*application.ServerStubRepository),
- service: server,
- }
-}
-
-// clientStubRepository implements Repository.
-type clientStubRepository struct {
- application.Repository_ExcludingUniversal
-
- client _gen_ipc.Client
- name string
-}
-
-func (__gen_c *clientStubRepository) Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Profiles, Envelope}, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubRepository) Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", []interface{}{Profile}, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubRepository) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubRepository) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubRepository) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-// ServerStubRepository wraps a server that implements
-// RepositoryService and provides an object that satisfies
-// the requirements of veyron2/ipc.ReflectInvoker.
-type ServerStubRepository struct {
- application.ServerStubRepository
-
- service RepositoryService
-}
-
-func (__gen_s *ServerStubRepository) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
- // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
- // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
- // This will change when it is replaced with Signature().
- if resp, err := __gen_s.ServerStubRepository.GetMethodTags(call, method); resp != nil || err != nil {
- return resp, err
- }
- switch method {
- case "Put":
- return []interface{}{security.Label(2)}, nil
- case "Remove":
- return []interface{}{security.Label(2)}, nil
- default:
- return nil, nil
- }
-}
-
-func (__gen_s *ServerStubRepository) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
- result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
- result.Methods["Put"] = _gen_ipc.MethodSignature{
- InArgs: []_gen_ipc.MethodArgument{
- {Name: "Profiles", Type: 61},
- {Name: "Envelope", Type: 65},
- },
- OutArgs: []_gen_ipc.MethodArgument{
- {Name: "", Type: 66},
- },
- }
- result.Methods["Remove"] = _gen_ipc.MethodSignature{
- InArgs: []_gen_ipc.MethodArgument{
- {Name: "Profile", Type: 3},
- },
- OutArgs: []_gen_ipc.MethodArgument{
- {Name: "", Type: 66},
- },
- }
-
- result.TypeDefs = []_gen_vdl.Any{
- _gen_wiretype.StructType{
- []_gen_wiretype.FieldType{
- _gen_wiretype.FieldType{Type: 0x3d, Name: "Args"},
- _gen_wiretype.FieldType{Type: 0x3, Name: "Binary"},
- _gen_wiretype.FieldType{Type: 0x3d, Name: "Env"},
- },
- "veyron2/services/mgmt/application.Envelope", []string(nil)},
- _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
- var ss _gen_ipc.ServiceSignature
- var firstAdded int
- ss, _ = __gen_s.ServerStubRepository.Signature(call)
- firstAdded = len(result.TypeDefs)
- for k, v := range ss.Methods {
- for i, _ := range v.InArgs {
- if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst {
- v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
- }
- }
- for i, _ := range v.OutArgs {
- if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst {
- v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
- }
- }
- if v.InStream >= _gen_wiretype.TypeIDFirst {
- v.InStream += _gen_wiretype.TypeID(firstAdded)
- }
- if v.OutStream >= _gen_wiretype.TypeIDFirst {
- v.OutStream += _gen_wiretype.TypeID(firstAdded)
- }
- result.Methods[k] = v
- }
- //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication.
- for _, d := range ss.TypeDefs {
- switch wt := d.(type) {
- case _gen_wiretype.SliceType:
- if wt.Elem >= _gen_wiretype.TypeIDFirst {
- wt.Elem += _gen_wiretype.TypeID(firstAdded)
- }
- d = wt
- case _gen_wiretype.ArrayType:
- if wt.Elem >= _gen_wiretype.TypeIDFirst {
- wt.Elem += _gen_wiretype.TypeID(firstAdded)
- }
- d = wt
- case _gen_wiretype.MapType:
- if wt.Key >= _gen_wiretype.TypeIDFirst {
- wt.Key += _gen_wiretype.TypeID(firstAdded)
- }
- if wt.Elem >= _gen_wiretype.TypeIDFirst {
- wt.Elem += _gen_wiretype.TypeID(firstAdded)
- }
- d = wt
- case _gen_wiretype.StructType:
- for i, fld := range wt.Fields {
- if fld.Type >= _gen_wiretype.TypeIDFirst {
- wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded)
- }
- }
- d = wt
- // NOTE: other types are missing, but we are upgrading anyways.
- }
- result.TypeDefs = append(result.TypeDefs, d)
- }
-
- return result, nil
-}
-
-func (__gen_s *ServerStubRepository) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
- if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
- return unresolver.UnresolveStep(call)
- }
- if call.Server() == nil {
- return
- }
- var published []string
- if published, err = call.Server().Published(); err != nil || published == nil {
- return
- }
- reply = make([]string, len(published))
- for i, p := range published {
- reply[i] = _gen_naming.Join(p, call.Name())
- }
- return
-}
-
-func (__gen_s *ServerStubRepository) Put(call _gen_ipc.ServerCall, Profiles []string, Envelope application.Envelope) (err error) {
- err = __gen_s.service.Put(call, Profiles, Envelope)
- return
-}
-
-func (__gen_s *ServerStubRepository) Remove(call _gen_ipc.ServerCall, Profile string) (err error) {
- err = __gen_s.service.Remove(call, Profile)
- return
-}
diff --git a/services/mgmt/application/impl/dispatcher.go b/services/mgmt/application/impl/dispatcher.go
index aaaadc6..d438fd2 100644
--- a/services/mgmt/application/impl/dispatcher.go
+++ b/services/mgmt/application/impl/dispatcher.go
@@ -1,7 +1,7 @@
package impl
import (
- "veyron/services/mgmt/application"
+ "veyron/services/mgmt/repository"
"veyron2/ipc"
"veyron2/security"
@@ -9,7 +9,7 @@
"veyron2/storage/vstore"
)
-// dispatcher holds the state of the application manager dispatcher.
+// dispatcher holds the state of the application repository dispatcher.
type dispatcher struct {
store storage.Store
auth security.Authorizer
@@ -27,6 +27,6 @@
// DISPATCHER INTERFACE IMPLEMENTATION
func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
- invoker := ipc.ReflectInvoker(application.NewServerRepository(NewInvoker(d.store, suffix)))
+ invoker := ipc.ReflectInvoker(repository.NewServerApplication(NewInvoker(d.store, suffix)))
return invoker, d.auth, nil
}
diff --git a/services/mgmt/application/impl/impl_test.go b/services/mgmt/application/impl/impl_test.go
index 756a46f..cee0cdb 100644
--- a/services/mgmt/application/impl/impl_test.go
+++ b/services/mgmt/application/impl/impl_test.go
@@ -4,8 +4,8 @@
"reflect"
"testing"
- iapplication "veyron/services/mgmt/application"
- istore "veyron/services/store/testutil"
+ "veyron/services/mgmt/repository"
+ "veyron/services/store/testutil"
"veyron2/naming"
"veyron2/rt"
@@ -19,14 +19,14 @@
ctx := runtime.NewContext()
defer runtime.Shutdown()
- // Setup and start the application manager server.
+ // Setup and start the application repository server.
server, err := runtime.NewServer()
if err != nil {
t.Fatalf("NewServer() failed: %v", err)
}
// Setup and start a store server.
- name, cleanup := istore.NewStore(t, server, runtime.Identity().PublicID())
+ name, cleanup := testutil.NewStore(t, server, runtime.Identity().PublicID())
defer cleanup()
dispatcher, err := NewDispatcher(name, nil)
@@ -44,15 +44,15 @@
}
// Create client stubs for talking to the server.
- stub, err := iapplication.BindRepository(naming.JoinAddressName(endpoint.String(), "//search"))
+ stub, err := repository.BindApplication(naming.JoinAddressName(endpoint.String(), "//search"))
if err != nil {
t.Fatalf("BindRepository() failed: %v", err)
}
- stubV1, err := iapplication.BindRepository(naming.JoinAddressName(endpoint.String(), "//search/v1"))
+ stubV1, err := repository.BindApplication(naming.JoinAddressName(endpoint.String(), "//search/v1"))
if err != nil {
t.Fatalf("BindRepository() failed: %v", err)
}
- stubV2, err := iapplication.BindRepository(naming.JoinAddressName(endpoint.String(), "//search/v2"))
+ stubV2, err := repository.BindApplication(naming.JoinAddressName(endpoint.String(), "//search/v2"))
if err != nil {
t.Fatalf("BindRepository() failed: %v", err)
}
@@ -138,7 +138,7 @@
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
- // Shutdown the application manager server.
+ // Shutdown the application repository server.
if err := server.Stop(); err != nil {
t.Fatalf("Stop() failed: %v", err)
}
diff --git a/services/mgmt/application/impl/invoker.go b/services/mgmt/application/impl/invoker.go
index 4ec02e0..818d053 100644
--- a/services/mgmt/application/impl/invoker.go
+++ b/services/mgmt/application/impl/invoker.go
@@ -12,7 +12,7 @@
"veyron2/vlog"
)
-// invoker holds the state of an application manager invocation.
+// invoker holds the state of an application repository invocation.
type invoker struct {
// store is the storage server used for storing application
// metadata.
diff --git a/services/mgmt/content/impl/dispatcher.go b/services/mgmt/content/impl/dispatcher.go
index 8ba4074..065c101 100644
--- a/services/mgmt/content/impl/dispatcher.go
+++ b/services/mgmt/content/impl/dispatcher.go
@@ -5,10 +5,10 @@
"veyron2/ipc"
"veyron2/security"
- "veyron2/services/mgmt/content"
+ "veyron2/services/mgmt/repository"
)
-// dispatcher holds the state of the content manager dispatcher.
+// dispatcher holds the state of the content repository dispatcher.
type dispatcher struct {
root string
depth int
@@ -24,6 +24,6 @@
// DISPATCHER INTERFACE IMPLEMENTATION
func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
- invoker := ipc.ReflectInvoker(content.NewServerRepository(newInvoker(d.root, d.depth, &d.fs, suffix)))
+ invoker := ipc.ReflectInvoker(repository.NewServerContent(newInvoker(d.root, d.depth, &d.fs, suffix)))
return invoker, d.auth, nil
}
diff --git a/services/mgmt/content/impl/impl_test.go b/services/mgmt/content/impl/impl_test.go
index 997b373..4d04924 100644
--- a/services/mgmt/content/impl/impl_test.go
+++ b/services/mgmt/content/impl/impl_test.go
@@ -11,7 +11,7 @@
"veyron2"
"veyron2/naming"
"veyron2/rt"
- "veyron2/services/mgmt/content"
+ "veyron2/services/mgmt/repository"
)
const (
@@ -25,7 +25,7 @@
// invokeUpload invokes the Upload RPC using the given client stub
// <stub> and streams the given content <content> to it.
-func invokeUpload(t *testing.T, stub content.Repository, content []byte) (string, error) {
+func invokeUpload(t *testing.T, stub repository.Content, content []byte) (string, error) {
stream, err := stub.Upload(rt.R().NewContext())
if err != nil {
return "", err
@@ -47,7 +47,7 @@
// invokeDownload invokes the Download RPC using the given client stub
// <stub> and streams content from to it.
-func invokeDownload(t *testing.T, stub content.Repository) ([]byte, error) {
+func invokeDownload(t *testing.T, stub repository.Content) ([]byte, error) {
stream, err := stub.Download(rt.R().NewContext())
if err != nil {
return nil, err
@@ -62,19 +62,19 @@
// invokeDelete invokes the Delete RPC using the given client stub
// <stub>.
-func invokeDelete(t *testing.T, stub content.Repository) error {
+func invokeDelete(t *testing.T, stub repository.Content) error {
return stub.Delete(rt.R().NewContext())
}
-// testInterface tests the content manager interface using the given
-// depth for hierarchy of content objects.
+// testInterface tests the content repository interface using the
+// given depth for hierarchy of content objects.
func testInterface(t *testing.T, runtime veyron2.Runtime, depth int) {
root, err := ioutil.TempDir("", veyronPrefix)
if err != nil {
t.Fatalf("TempDir() failed: %v", err)
}
- // Setup and start the content manager server.
+ // Setup and start the content repository server.
server, err := runtime.NewServer()
if err != nil {
t.Fatalf("NewServer() failed: %v", err)
@@ -92,7 +92,7 @@
// Create client stubs for talking to the server.
name := naming.JoinAddressName(endpoint.String(), "//")
- stub, err := content.BindRepository(name)
+ stub, err := repository.BindContent(name)
if err != nil {
t.Fatalf("BindRepository() failed: %v", err)
}
@@ -110,7 +110,7 @@
}
// Download
- stub, err = content.BindRepository(naming.Join(name, checksum))
+ stub, err = repository.BindContent(naming.Join(name, checksum))
if err != nil {
t.Fatalf("BindRepository() failed: %v", err)
}
@@ -133,13 +133,13 @@
t.Fatalf("Remove() failed: %v", err)
}
- // Shutdown the content manager server.
+ // Shutdown the content repository server.
if err := server.Stop(); err != nil {
t.Fatalf("Stop() failed: %v", err)
}
}
-// TestHierarchy checks that the content manager works correctly for
+// TestHierarchy checks that the content repository works correctly for
// all possible valid values of the depth used for the directory
// hierarchy that stores content objects in the local file system.
func TestHierarchy(t *testing.T) {
diff --git a/services/mgmt/content/impl/invoker.go b/services/mgmt/content/impl/invoker.go
index 56775e3..2f5509d 100644
--- a/services/mgmt/content/impl/invoker.go
+++ b/services/mgmt/content/impl/invoker.go
@@ -14,17 +14,17 @@
"syscall"
"veyron2/ipc"
- "veyron2/services/mgmt/content"
+ "veyron2/services/mgmt/repository"
"veyron2/vlog"
)
-// invoker holds the state of a content manager invocation.
+// invoker holds the state of a content repository invocation.
type invoker struct {
- // root is the directory at which the content manager namespace is
+ // root is the directory at which the content repository namespace is
// mounted.
root string
// depth determines the depth of the directory hierarchy that the
- // content manager uses to organize the content in the local file
+ // content repository uses to organize the content in the local file
// system. There is a trade-off here: smaller values lead to faster
// access, while higher values allow the performance to scale to
// large content collections. The number should be a value in
@@ -36,7 +36,7 @@
// filesystem limitations), then you should set depth to at least
// log_256(X/Y). For example, using hierarchyDepth = 3 with a local
// filesystem that can handle up to 1,000 entries per directory
- // before its performance degrades allows the content manager to
+ // before its performance degrades allows the content repository to
// store 16B objects.
depth int
// fs is a lock used to atomatically modify the contents of the
@@ -116,7 +116,7 @@
return nil
}
-func (i *invoker) Download(context ipc.ServerContext, stream content.RepositoryServiceDownloadStream) error {
+func (i *invoker) Download(context ipc.ServerContext, stream repository.ContentServiceDownloadStream) error {
vlog.VI(0).Infof("%v.Download()", i.suffix)
if !isValid(i.suffix) {
return errInvalidSuffix
@@ -147,7 +147,7 @@
return nil
}
-func (i *invoker) Upload(context ipc.ServerContext, stream content.RepositoryServiceUploadStream) (string, error) {
+func (i *invoker) Upload(context ipc.ServerContext, stream repository.ContentServiceUploadStream) (string, error) {
vlog.VI(0).Infof("%v.Upload()", i.suffix)
if i.suffix != "" {
return "", errInvalidSuffix
diff --git a/services/mgmt/node/impl/impl_test.go b/services/mgmt/node/impl/impl_test.go
index 9876192..aa43a79 100644
--- a/services/mgmt/node/impl/impl_test.go
+++ b/services/mgmt/node/impl/impl_test.go
@@ -26,7 +26,7 @@
"veyron2/naming"
"veyron2/rt"
"veyron2/services/mgmt/application"
- "veyron2/services/mgmt/content"
+ "veyron2/services/mgmt/repository"
"veyron2/vlog"
)
@@ -66,7 +66,7 @@
return nil
}
-func (i *crInvoker) Download(_ ipc.ServerContext, stream content.RepositoryServiceDownloadStream) error {
+func (i *crInvoker) Download(_ ipc.ServerContext, stream repository.ContentServiceDownloadStream) error {
vlog.VI(0).Infof("Download()")
file, err := os.Open(os.Args[0])
if err != nil {
@@ -93,7 +93,7 @@
}
}
-func (i *crInvoker) Upload(ipc.ServerContext, content.RepositoryServiceUploadStream) (string, error) {
+func (i *crInvoker) Upload(ipc.ServerContext, repository.ContentServiceUploadStream) (string, error) {
vlog.VI(0).Infof("Upload()")
return "", nil
}
@@ -244,7 +244,7 @@
if err != nil {
vlog.Fatalf("NewServer() failed: %v", err)
}
- suffix, dispatcher := "", ipc.SoloDispatcher(application.NewServerRepository(&arInvoker{}), nil)
+ suffix, dispatcher := "", ipc.SoloDispatcher(repository.NewServerApplication(&arInvoker{}), nil)
if err := server.Register(suffix, dispatcher); err != nil {
vlog.Fatalf("Register(%v, %v) failed: %v", suffix, dispatcher, err)
}
@@ -270,7 +270,7 @@
if err != nil {
vlog.Fatalf("NewServer() failed: %v", err)
}
- suffix, dispatcher := "", ipc.SoloDispatcher(content.NewServerRepository(&crInvoker{}), nil)
+ suffix, dispatcher := "", ipc.SoloDispatcher(repository.NewServerContent(&crInvoker{}), nil)
if err := server.Register(suffix, dispatcher); err != nil {
vlog.Fatalf("Register(%v, %v) failed: %v", suffix, dispatcher, err)
}
diff --git a/services/mgmt/node/impl/invoker.go b/services/mgmt/node/impl/invoker.go
index d230ed7..5f68e23 100644
--- a/services/mgmt/node/impl/invoker.go
+++ b/services/mgmt/node/impl/invoker.go
@@ -50,8 +50,8 @@
"veyron2/rt"
"veyron2/services/mgmt/application"
"veyron2/services/mgmt/build"
- "veyron2/services/mgmt/content"
"veyron2/services/mgmt/node"
+ "veyron2/services/mgmt/repository"
"veyron2/vlog"
)
@@ -327,7 +327,7 @@
// APPLICATION INTERFACE IMPLEMENTATION
func downloadBinary(workspace, binary string) error {
- stub, err := content.BindRepository(binary)
+ stub, err := repository.BindContent(binary)
if err != nil {
vlog.Errorf("BindContent(%q) failed: %v", binary, err)
return errOperationFailed
@@ -371,7 +371,7 @@
}
func fetchEnvelope(origin string) (*application.Envelope, error) {
- stub, err := application.BindRepository(origin)
+ stub, err := repository.BindApplication(origin)
if err != nil {
vlog.Errorf("BindRepository(%v) failed: %v", origin, err)
return nil, errOperationFailed
diff --git a/services/mgmt/profile/impl/dispatcher.go b/services/mgmt/profile/impl/dispatcher.go
index ccf5972..fd25fde 100644
--- a/services/mgmt/profile/impl/dispatcher.go
+++ b/services/mgmt/profile/impl/dispatcher.go
@@ -1,7 +1,7 @@
package impl
import (
- "veyron/services/mgmt/profile"
+ "veyron/services/mgmt/repository"
"veyron2/ipc"
"veyron2/security"
@@ -9,7 +9,7 @@
"veyron2/storage/vstore"
)
-// dispatcher holds the state of the profile manager dispatcher.
+// dispatcher holds the state of the profile repository dispatcher.
type dispatcher struct {
store storage.Store
auth security.Authorizer
@@ -27,6 +27,6 @@
// DISPATCHER INTERFACE IMPLEMENTATION
func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
- invoker := ipc.ReflectInvoker(profile.NewServerProfile(NewInvoker(d.store, suffix)))
+ invoker := ipc.ReflectInvoker(repository.NewServerProfile(NewInvoker(d.store, suffix)))
return invoker, d.auth, nil
}
diff --git a/services/mgmt/profile/impl/impl_test.go b/services/mgmt/profile/impl/impl_test.go
index b3d28df..777444c 100644
--- a/services/mgmt/profile/impl/impl_test.go
+++ b/services/mgmt/profile/impl/impl_test.go
@@ -5,7 +5,8 @@
"testing"
"veyron/services/mgmt/profile"
- istore "veyron/services/store/testutil"
+ "veyron/services/mgmt/repository"
+ "veyron/services/store/testutil"
"veyron2/naming"
"veyron2/rt"
@@ -17,7 +18,7 @@
Format: profile.Format{Name: "elf", Attributes: map[string]string{"os": "linux", "arch": "amd64"}},
Libraries: map[profile.Library]struct{}{profile.Library{Name: "foo", MajorVersion: "1", MinorVersion: "0"}: struct{}{}},
Label: "example",
- Description: "Example profile to test the profile manager implementation.",
+ Description: "Example profile to test the profile repository implementation.",
}
)
@@ -29,14 +30,14 @@
ctx := runtime.NewContext()
- // Setup and start the profile manager server.
+ // Setup and start the profile repository server.
server, err := runtime.NewServer()
if err != nil {
t.Fatalf("NewServer() failed: %v", err)
}
// Setup and start a store server.
- mountPoint, cleanup := istore.NewStore(t, server, runtime.Identity().PublicID())
+ mountPoint, cleanup := testutil.NewStore(t, server, runtime.Identity().PublicID())
defer cleanup()
dispatcher, err := NewDispatcher(mountPoint, nil)
@@ -56,10 +57,10 @@
if err := server.Publish(name); err != nil {
t.Fatalf("Publish(%v) failed: %v", name, err)
}
- t.Logf("Profile manager published at %v/%v", endpoint, name)
+ t.Logf("Profile repository published at %v/%v", endpoint, name)
// Create client stubs for talking to the server.
- stub, err := profile.BindProfile(naming.JoinAddressName(endpoint.String(), "//linux/base"))
+ stub, err := repository.BindProfile(naming.JoinAddressName(endpoint.String(), "//linux/base"))
if err != nil {
t.Fatalf("BindApplication() failed: %v", err)
}
diff --git a/services/mgmt/profile/impl/invoker.go b/services/mgmt/profile/impl/invoker.go
index 2e4946c..bb7ad12 100644
--- a/services/mgmt/profile/impl/invoker.go
+++ b/services/mgmt/profile/impl/invoker.go
@@ -12,7 +12,7 @@
"veyron2/vlog"
)
-// invoker holds the profile manager invocation.
+// invoker holds the profile repository invocation.
type invoker struct {
// store is the storage server used for storing profile data.
store storage.Store
diff --git a/services/mgmt/profile/profile.vdl b/services/mgmt/profile/profile.vdl
index 80f3a7b..d37c59b 100644
--- a/services/mgmt/profile/profile.vdl
+++ b/services/mgmt/profile/profile.vdl
@@ -2,11 +2,6 @@
// types used by the implementation of Veyron profiles.
package profile
-import (
- "veyron2/security"
- public "veyron2/services/mgmt/profile"
-)
-
// Format includes a type (e.g. ELF) and each instance of the format
// has some specific attributes. The key attributes are the target
// operating system (e.g. for ELF this could be one of System V,
@@ -14,45 +9,29 @@
// the target instruction set architecture (e.g. for ELF this could be
// one of SPARC, x86, PowerPC, ARM, IA-64, x86-64, and AArch64).
type Format struct {
- Name string
- Attributes map[string]string
+ Name string
+ Attributes map[string]string
}
// Library describes a shared library that applications may use.
type Library struct {
- // Name is the name of the library.
- Name string
- // MajorVersion is the major version of the library.
- MajorVersion string
- // MinorVersion is the minor version of the library.
- MinorVersion string
+ // Name is the name of the library.
+ Name string
+ // MajorVersion is the major version of the library.
+ MajorVersion string
+ // MinorVersion is the minor version of the library.
+ MinorVersion string
}
// Specification is how we represent a profile internally. It should
// provide enough information to allow matching of binaries to nodes.
type Specification struct {
- // Format is the file format of the application binary.
- Format Format
- // Libraries is a set of libraries the application binary depends on.
- Libraries set[Library]
- // A human-friendly concise label for the profile, e.g. "linux-media"
- Label string
- // A human-friendly description of the profile.
- Description string
-}
-
-// Profile describes a profile internally. Besides the public Profile
-// interface, it allows to access and manage the actual profile
-// implementation information.
-type Profile interface {
- public.Profile
- // Specification returns the profile specification for the profile
- // identified through the veyron name suffix.
- Specification() (Specification, error) {security.ReadLabel}
- // Put sets the profile specification for the profile identified
- // through the veyron name suffix.
- Put(Specification Specification) error {security.WriteLabel}
- // Remove removes the profile specification for the profile
- // identified through the veyron name suffix.
- Remove() error {security.WriteLabel}
+ // Format is the file format of the application binary.
+ Format Format
+ // Libraries is a set of libraries the application binary depends on.
+ Libraries set[Library]
+ // A human-friendly concise label for the profile, e.g. "linux-media"
+ Label string
+ // A human-friendly description of the profile.
+ Description string
}
diff --git a/services/mgmt/profile/profile.vdl.go b/services/mgmt/profile/profile.vdl.go
index 8f460f0..c219f26 100644
--- a/services/mgmt/profile/profile.vdl.go
+++ b/services/mgmt/profile/profile.vdl.go
@@ -5,21 +5,6 @@
// types used by the implementation of Veyron profiles.
package profile
-import (
- "veyron2/security"
-
- "veyron2/services/mgmt/profile"
-
- // The non-user imports are prefixed with "_gen_" to prevent collisions.
- _gen_veyron2 "veyron2"
- _gen_context "veyron2/context"
- _gen_ipc "veyron2/ipc"
- _gen_naming "veyron2/naming"
- _gen_rt "veyron2/rt"
- _gen_vdl "veyron2/vdl"
- _gen_wiretype "veyron2/wiretype"
-)
-
// Format includes a type (e.g. ELF) and each instance of the format
// has some specific attributes. The key attributes are the target
// operating system (e.g. for ELF this could be one of System V,
@@ -53,329 +38,3 @@
// A human-friendly description of the profile.
Description string
}
-
-// Profile describes a profile internally. Besides the public Profile
-// interface, it allows to access and manage the actual profile
-// implementation information.
-// Profile is the interface the client binds and uses.
-// Profile_ExcludingUniversal is the interface without internal framework-added methods
-// to enable embedding without method collisions. Not to be used directly by clients.
-type Profile_ExcludingUniversal interface {
- // Profile abstracts a device's ability to run binaries, and hides
- // specifics such as operating system, hardware architecture, and the
- // set of installed libraries. Profiles describe binaries and devices,
- // and are used to match them.
- profile.Profile_ExcludingUniversal
- // Specification returns the profile specification for the profile
- // identified through the veyron name suffix.
- Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply Specification, err error)
- // Put sets the profile specification for the profile identified
- // through the veyron name suffix.
- Put(ctx _gen_context.T, Specification Specification, opts ..._gen_ipc.CallOpt) (err error)
- // Remove removes the profile specification for the profile
- // identified through the veyron name suffix.
- Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error)
-}
-type Profile interface {
- _gen_ipc.UniversalServiceMethods
- Profile_ExcludingUniversal
-}
-
-// ProfileService is the interface the server implements.
-type ProfileService interface {
-
- // Profile abstracts a device's ability to run binaries, and hides
- // specifics such as operating system, hardware architecture, and the
- // set of installed libraries. Profiles describe binaries and devices,
- // and are used to match them.
- profile.ProfileService
- // Specification returns the profile specification for the profile
- // identified through the veyron name suffix.
- Specification(context _gen_ipc.ServerContext) (reply Specification, err error)
- // Put sets the profile specification for the profile identified
- // through the veyron name suffix.
- Put(context _gen_ipc.ServerContext, Specification Specification) (err error)
- // Remove removes the profile specification for the profile
- // identified through the veyron name suffix.
- Remove(context _gen_ipc.ServerContext) (err error)
-}
-
-// BindProfile returns the client stub implementing the Profile
-// interface.
-//
-// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
-// global Runtime is used.
-func BindProfile(name string, opts ..._gen_ipc.BindOpt) (Profile, error) {
- var client _gen_ipc.Client
- switch len(opts) {
- case 0:
- client = _gen_rt.R().Client()
- case 1:
- switch o := opts[0].(type) {
- case _gen_veyron2.Runtime:
- client = o.Client()
- case _gen_ipc.Client:
- client = o
- default:
- return nil, _gen_vdl.ErrUnrecognizedOption
- }
- default:
- return nil, _gen_vdl.ErrTooManyOptionsToBind
- }
- stub := &clientStubProfile{client: client, name: name}
- stub.Profile_ExcludingUniversal, _ = profile.BindProfile(name, client)
-
- return stub, nil
-}
-
-// NewServerProfile creates a new server stub.
-//
-// It takes a regular server implementing the ProfileService
-// interface, and returns a new server stub.
-func NewServerProfile(server ProfileService) interface{} {
- return &ServerStubProfile{
- ServerStubProfile: *profile.NewServerProfile(server).(*profile.ServerStubProfile),
- service: server,
- }
-}
-
-// clientStubProfile implements Profile.
-type clientStubProfile struct {
- profile.Profile_ExcludingUniversal
-
- client _gen_ipc.Client
- name string
-}
-
-func (__gen_c *clientStubProfile) Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply Specification, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Specification", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubProfile) Put(ctx _gen_context.T, Specification Specification, opts ..._gen_ipc.CallOpt) (err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Specification}, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubProfile) Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubProfile) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubProfile) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubProfile) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-// ServerStubProfile wraps a server that implements
-// ProfileService and provides an object that satisfies
-// the requirements of veyron2/ipc.ReflectInvoker.
-type ServerStubProfile struct {
- profile.ServerStubProfile
-
- service ProfileService
-}
-
-func (__gen_s *ServerStubProfile) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
- // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
- // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
- // This will change when it is replaced with Signature().
- if resp, err := __gen_s.ServerStubProfile.GetMethodTags(call, method); resp != nil || err != nil {
- return resp, err
- }
- switch method {
- case "Specification":
- return []interface{}{security.Label(1)}, nil
- case "Put":
- return []interface{}{security.Label(2)}, nil
- case "Remove":
- return []interface{}{security.Label(2)}, nil
- default:
- return nil, nil
- }
-}
-
-func (__gen_s *ServerStubProfile) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
- result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
- result.Methods["Put"] = _gen_ipc.MethodSignature{
- InArgs: []_gen_ipc.MethodArgument{
- {Name: "Specification", Type: 69},
- },
- OutArgs: []_gen_ipc.MethodArgument{
- {Name: "", Type: 70},
- },
- }
- result.Methods["Remove"] = _gen_ipc.MethodSignature{
- InArgs: []_gen_ipc.MethodArgument{},
- OutArgs: []_gen_ipc.MethodArgument{
- {Name: "", Type: 70},
- },
- }
- result.Methods["Specification"] = _gen_ipc.MethodSignature{
- InArgs: []_gen_ipc.MethodArgument{},
- OutArgs: []_gen_ipc.MethodArgument{
- {Name: "", Type: 69},
- {Name: "", Type: 70},
- },
- }
-
- result.TypeDefs = []_gen_vdl.Any{
- _gen_wiretype.MapType{Key: 0x3, Elem: 0x3, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{
- []_gen_wiretype.FieldType{
- _gen_wiretype.FieldType{Type: 0x3, Name: "Name"},
- _gen_wiretype.FieldType{Type: 0x41, Name: "Attributes"},
- },
- "veyron/services/mgmt/profile.Format", []string(nil)},
- _gen_wiretype.StructType{
- []_gen_wiretype.FieldType{
- _gen_wiretype.FieldType{Type: 0x3, Name: "Name"},
- _gen_wiretype.FieldType{Type: 0x3, Name: "MajorVersion"},
- _gen_wiretype.FieldType{Type: 0x3, Name: "MinorVersion"},
- },
- "veyron/services/mgmt/profile.Library", []string(nil)},
- _gen_wiretype.MapType{Key: 0x43, Elem: 0x2, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{
- []_gen_wiretype.FieldType{
- _gen_wiretype.FieldType{Type: 0x42, Name: "Format"},
- _gen_wiretype.FieldType{Type: 0x44, Name: "Libraries"},
- _gen_wiretype.FieldType{Type: 0x3, Name: "Label"},
- _gen_wiretype.FieldType{Type: 0x3, Name: "Description"},
- },
- "veyron/services/mgmt/profile.Specification", []string(nil)},
- _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
- var ss _gen_ipc.ServiceSignature
- var firstAdded int
- ss, _ = __gen_s.ServerStubProfile.Signature(call)
- firstAdded = len(result.TypeDefs)
- for k, v := range ss.Methods {
- for i, _ := range v.InArgs {
- if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst {
- v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
- }
- }
- for i, _ := range v.OutArgs {
- if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst {
- v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
- }
- }
- if v.InStream >= _gen_wiretype.TypeIDFirst {
- v.InStream += _gen_wiretype.TypeID(firstAdded)
- }
- if v.OutStream >= _gen_wiretype.TypeIDFirst {
- v.OutStream += _gen_wiretype.TypeID(firstAdded)
- }
- result.Methods[k] = v
- }
- //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication.
- for _, d := range ss.TypeDefs {
- switch wt := d.(type) {
- case _gen_wiretype.SliceType:
- if wt.Elem >= _gen_wiretype.TypeIDFirst {
- wt.Elem += _gen_wiretype.TypeID(firstAdded)
- }
- d = wt
- case _gen_wiretype.ArrayType:
- if wt.Elem >= _gen_wiretype.TypeIDFirst {
- wt.Elem += _gen_wiretype.TypeID(firstAdded)
- }
- d = wt
- case _gen_wiretype.MapType:
- if wt.Key >= _gen_wiretype.TypeIDFirst {
- wt.Key += _gen_wiretype.TypeID(firstAdded)
- }
- if wt.Elem >= _gen_wiretype.TypeIDFirst {
- wt.Elem += _gen_wiretype.TypeID(firstAdded)
- }
- d = wt
- case _gen_wiretype.StructType:
- for i, fld := range wt.Fields {
- if fld.Type >= _gen_wiretype.TypeIDFirst {
- wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded)
- }
- }
- d = wt
- // NOTE: other types are missing, but we are upgrading anyways.
- }
- result.TypeDefs = append(result.TypeDefs, d)
- }
-
- return result, nil
-}
-
-func (__gen_s *ServerStubProfile) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
- if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
- return unresolver.UnresolveStep(call)
- }
- if call.Server() == nil {
- return
- }
- var published []string
- if published, err = call.Server().Published(); err != nil || published == nil {
- return
- }
- reply = make([]string, len(published))
- for i, p := range published {
- reply[i] = _gen_naming.Join(p, call.Name())
- }
- return
-}
-
-func (__gen_s *ServerStubProfile) Specification(call _gen_ipc.ServerCall) (reply Specification, err error) {
- reply, err = __gen_s.service.Specification(call)
- return
-}
-
-func (__gen_s *ServerStubProfile) Put(call _gen_ipc.ServerCall, Specification Specification) (err error) {
- err = __gen_s.service.Put(call, Specification)
- return
-}
-
-func (__gen_s *ServerStubProfile) Remove(call _gen_ipc.ServerCall) (err error) {
- err = __gen_s.service.Remove(call)
- return
-}
diff --git a/services/mgmt/repository/repository.vdl b/services/mgmt/repository/repository.vdl
new file mode 100644
index 0000000..5ef30d9
--- /dev/null
+++ b/services/mgmt/repository/repository.vdl
@@ -0,0 +1,44 @@
+// Package repository contains implementation of the interface for
+// storing and serving various veyron management objects.
+package repository
+
+import (
+ "veyron/services/mgmt/profile"
+ "veyron2/security"
+ "veyron2/services/mgmt/application"
+ public "veyron2/services/mgmt/repository"
+)
+
+// Application describes an application repository internally. Besides
+// the public Application interface, it allows to add and remove
+// application envelopes.
+type Application interface {
+ public.Application
+ // Put adds the given tuple of application version (specified
+ // through the veyron name suffix) and application envelope to all
+ // of the given application profiles.
+ Put(Profiles []string, Envelope application.Envelope) error {security.WriteLabel}
+ // Remove removes the application envelope for the given profile
+ // name and application version (specified through the veyron name
+ // suffix). If no version is specified as part of the suffix, the
+ // method removes all versions for the given profile.
+ //
+ // TODO(jsimsa): Add support for using "*" to specify all profiles
+ // when Matt implements Globing (or Ken implements querying).
+ Remove(Profile string) error {security.WriteLabel}
+}
+
+// Profile describes a profile internally. Besides the public Profile
+// interface, it allows to add and remove profile specifications.
+type Profile interface {
+ public.Profile
+ // Specification returns the profile specification for the profile
+ // identified through the veyron name suffix.
+ Specification() (profile.Specification, error) {security.ReadLabel}
+ // Put sets the profile specification for the profile identified
+ // through the veyron name suffix.
+ Put(Specification profile.Specification) error {security.WriteLabel}
+ // Remove removes the profile specification for the profile
+ // identified through the veyron name suffix.
+ Remove() error {security.WriteLabel}
+}
diff --git a/services/mgmt/repository/repository.vdl.go b/services/mgmt/repository/repository.vdl.go
new file mode 100644
index 0000000..10a9336
--- /dev/null
+++ b/services/mgmt/repository/repository.vdl.go
@@ -0,0 +1,658 @@
+// This file was auto-generated by the veyron vdl tool.
+// Source: repository.vdl
+
+// Package repository contains implementation of the interface for
+// storing and serving various veyron management objects.
+package repository
+
+import (
+ "veyron/services/mgmt/profile"
+
+ "veyron2/security"
+
+ "veyron2/services/mgmt/application"
+
+ "veyron2/services/mgmt/repository"
+
+ // The non-user imports are prefixed with "_gen_" to prevent collisions.
+ _gen_veyron2 "veyron2"
+ _gen_context "veyron2/context"
+ _gen_ipc "veyron2/ipc"
+ _gen_naming "veyron2/naming"
+ _gen_rt "veyron2/rt"
+ _gen_vdl "veyron2/vdl"
+ _gen_wiretype "veyron2/wiretype"
+)
+
+// Application describes an application repository internally. Besides
+// the public Application interface, it allows to add and remove
+// application envelopes.
+// Application is the interface the client binds and uses.
+// Application_ExcludingUniversal is the interface without internal framework-added methods
+// to enable embedding without method collisions. Not to be used directly by clients.
+type Application_ExcludingUniversal interface {
+ // Application provides access to application envelopes. An
+ // application envelope is identified by an application name and an
+ // application version, which are specified through the veyron name,
+ // and a profile name, which is specified using a method argument.
+ //
+ // Example:
+ // /apps/search/v1.Match([]string{"base", "media"})
+ // returns an application envelope that can be used for downloading
+ // and executing the "search" application, version "v1", runnable
+ // on either the "base" or "media" profile.
+ repository.Application_ExcludingUniversal
+ // Put adds the given tuple of application version (specified
+ // through the veyron name suffix) and application envelope to all
+ // of the given application profiles.
+ Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error)
+ // Remove removes the application envelope for the given profile
+ // name and application version (specified through the veyron name
+ // suffix). If no version is specified as part of the suffix, the
+ // method removes all versions for the given profile.
+ //
+ // TODO(jsimsa): Add support for using "*" to specify all profiles
+ // when Matt implements Globing (or Ken implements querying).
+ Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error)
+}
+type Application interface {
+ _gen_ipc.UniversalServiceMethods
+ Application_ExcludingUniversal
+}
+
+// ApplicationService is the interface the server implements.
+type ApplicationService interface {
+
+ // Application provides access to application envelopes. An
+ // application envelope is identified by an application name and an
+ // application version, which are specified through the veyron name,
+ // and a profile name, which is specified using a method argument.
+ //
+ // Example:
+ // /apps/search/v1.Match([]string{"base", "media"})
+ // returns an application envelope that can be used for downloading
+ // and executing the "search" application, version "v1", runnable
+ // on either the "base" or "media" profile.
+ repository.ApplicationService
+ // Put adds the given tuple of application version (specified
+ // through the veyron name suffix) and application envelope to all
+ // of the given application profiles.
+ Put(context _gen_ipc.ServerContext, Profiles []string, Envelope application.Envelope) (err error)
+ // Remove removes the application envelope for the given profile
+ // name and application version (specified through the veyron name
+ // suffix). If no version is specified as part of the suffix, the
+ // method removes all versions for the given profile.
+ //
+ // TODO(jsimsa): Add support for using "*" to specify all profiles
+ // when Matt implements Globing (or Ken implements querying).
+ Remove(context _gen_ipc.ServerContext, Profile string) (err error)
+}
+
+// BindApplication returns the client stub implementing the Application
+// interface.
+//
+// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
+// global Runtime is used.
+func BindApplication(name string, opts ..._gen_ipc.BindOpt) (Application, error) {
+ var client _gen_ipc.Client
+ switch len(opts) {
+ case 0:
+ client = _gen_rt.R().Client()
+ case 1:
+ switch o := opts[0].(type) {
+ case _gen_veyron2.Runtime:
+ client = o.Client()
+ case _gen_ipc.Client:
+ client = o
+ default:
+ return nil, _gen_vdl.ErrUnrecognizedOption
+ }
+ default:
+ return nil, _gen_vdl.ErrTooManyOptionsToBind
+ }
+ stub := &clientStubApplication{client: client, name: name}
+ stub.Application_ExcludingUniversal, _ = repository.BindApplication(name, client)
+
+ return stub, nil
+}
+
+// NewServerApplication creates a new server stub.
+//
+// It takes a regular server implementing the ApplicationService
+// interface, and returns a new server stub.
+func NewServerApplication(server ApplicationService) interface{} {
+ return &ServerStubApplication{
+ ServerStubApplication: *repository.NewServerApplication(server).(*repository.ServerStubApplication),
+ service: server,
+ }
+}
+
+// clientStubApplication implements Application.
+type clientStubApplication struct {
+ repository.Application_ExcludingUniversal
+
+ client _gen_ipc.Client
+ name string
+}
+
+func (__gen_c *clientStubApplication) Put(ctx _gen_context.T, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Profiles, Envelope}, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubApplication) Remove(ctx _gen_context.T, Profile string, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", []interface{}{Profile}, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubApplication) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&reply, &err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubApplication) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&reply, &err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubApplication) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&reply, &err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+// ServerStubApplication wraps a server that implements
+// ApplicationService and provides an object that satisfies
+// the requirements of veyron2/ipc.ReflectInvoker.
+type ServerStubApplication struct {
+ repository.ServerStubApplication
+
+ service ApplicationService
+}
+
+func (__gen_s *ServerStubApplication) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
+ // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
+ // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
+ // This will change when it is replaced with Signature().
+ if resp, err := __gen_s.ServerStubApplication.GetMethodTags(call, method); resp != nil || err != nil {
+ return resp, err
+ }
+ switch method {
+ case "Put":
+ return []interface{}{security.Label(2)}, nil
+ case "Remove":
+ return []interface{}{security.Label(2)}, nil
+ default:
+ return nil, nil
+ }
+}
+
+func (__gen_s *ServerStubApplication) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
+ result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
+ result.Methods["Put"] = _gen_ipc.MethodSignature{
+ InArgs: []_gen_ipc.MethodArgument{
+ {Name: "Profiles", Type: 61},
+ {Name: "Envelope", Type: 65},
+ },
+ OutArgs: []_gen_ipc.MethodArgument{
+ {Name: "", Type: 66},
+ },
+ }
+ result.Methods["Remove"] = _gen_ipc.MethodSignature{
+ InArgs: []_gen_ipc.MethodArgument{
+ {Name: "Profile", Type: 3},
+ },
+ OutArgs: []_gen_ipc.MethodArgument{
+ {Name: "", Type: 66},
+ },
+ }
+
+ result.TypeDefs = []_gen_vdl.Any{
+ _gen_wiretype.StructType{
+ []_gen_wiretype.FieldType{
+ _gen_wiretype.FieldType{Type: 0x3d, Name: "Args"},
+ _gen_wiretype.FieldType{Type: 0x3, Name: "Binary"},
+ _gen_wiretype.FieldType{Type: 0x3d, Name: "Env"},
+ },
+ "veyron2/services/mgmt/application.Envelope", []string(nil)},
+ _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
+ var ss _gen_ipc.ServiceSignature
+ var firstAdded int
+ ss, _ = __gen_s.ServerStubApplication.Signature(call)
+ firstAdded = len(result.TypeDefs)
+ for k, v := range ss.Methods {
+ for i, _ := range v.InArgs {
+ if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst {
+ v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
+ }
+ }
+ for i, _ := range v.OutArgs {
+ if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst {
+ v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
+ }
+ }
+ if v.InStream >= _gen_wiretype.TypeIDFirst {
+ v.InStream += _gen_wiretype.TypeID(firstAdded)
+ }
+ if v.OutStream >= _gen_wiretype.TypeIDFirst {
+ v.OutStream += _gen_wiretype.TypeID(firstAdded)
+ }
+ result.Methods[k] = v
+ }
+ //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication.
+ for _, d := range ss.TypeDefs {
+ switch wt := d.(type) {
+ case _gen_wiretype.SliceType:
+ if wt.Elem >= _gen_wiretype.TypeIDFirst {
+ wt.Elem += _gen_wiretype.TypeID(firstAdded)
+ }
+ d = wt
+ case _gen_wiretype.ArrayType:
+ if wt.Elem >= _gen_wiretype.TypeIDFirst {
+ wt.Elem += _gen_wiretype.TypeID(firstAdded)
+ }
+ d = wt
+ case _gen_wiretype.MapType:
+ if wt.Key >= _gen_wiretype.TypeIDFirst {
+ wt.Key += _gen_wiretype.TypeID(firstAdded)
+ }
+ if wt.Elem >= _gen_wiretype.TypeIDFirst {
+ wt.Elem += _gen_wiretype.TypeID(firstAdded)
+ }
+ d = wt
+ case _gen_wiretype.StructType:
+ for i, fld := range wt.Fields {
+ if fld.Type >= _gen_wiretype.TypeIDFirst {
+ wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded)
+ }
+ }
+ d = wt
+ // NOTE: other types are missing, but we are upgrading anyways.
+ }
+ result.TypeDefs = append(result.TypeDefs, d)
+ }
+
+ return result, nil
+}
+
+func (__gen_s *ServerStubApplication) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
+ if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
+ return unresolver.UnresolveStep(call)
+ }
+ if call.Server() == nil {
+ return
+ }
+ var published []string
+ if published, err = call.Server().Published(); err != nil || published == nil {
+ return
+ }
+ reply = make([]string, len(published))
+ for i, p := range published {
+ reply[i] = _gen_naming.Join(p, call.Name())
+ }
+ return
+}
+
+func (__gen_s *ServerStubApplication) Put(call _gen_ipc.ServerCall, Profiles []string, Envelope application.Envelope) (err error) {
+ err = __gen_s.service.Put(call, Profiles, Envelope)
+ return
+}
+
+func (__gen_s *ServerStubApplication) Remove(call _gen_ipc.ServerCall, Profile string) (err error) {
+ err = __gen_s.service.Remove(call, Profile)
+ return
+}
+
+// Profile describes a profile internally. Besides the public Profile
+// interface, it allows to add and remove profile specifications.
+// Profile is the interface the client binds and uses.
+// Profile_ExcludingUniversal is the interface without internal framework-added methods
+// to enable embedding without method collisions. Not to be used directly by clients.
+type Profile_ExcludingUniversal interface {
+ // Profile abstracts a device's ability to run binaries, and hides
+ // specifics such as the operating system, hardware architecture, and
+ // the set of installed libraries. Profiles describe binaries and
+ // devices, and are used to match them.
+ repository.Profile_ExcludingUniversal
+ // Specification returns the profile specification for the profile
+ // identified through the veyron name suffix.
+ Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply profile.Specification, err error)
+ // Put sets the profile specification for the profile identified
+ // through the veyron name suffix.
+ Put(ctx _gen_context.T, Specification profile.Specification, opts ..._gen_ipc.CallOpt) (err error)
+ // Remove removes the profile specification for the profile
+ // identified through the veyron name suffix.
+ Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error)
+}
+type Profile interface {
+ _gen_ipc.UniversalServiceMethods
+ Profile_ExcludingUniversal
+}
+
+// ProfileService is the interface the server implements.
+type ProfileService interface {
+
+ // Profile abstracts a device's ability to run binaries, and hides
+ // specifics such as the operating system, hardware architecture, and
+ // the set of installed libraries. Profiles describe binaries and
+ // devices, and are used to match them.
+ repository.ProfileService
+ // Specification returns the profile specification for the profile
+ // identified through the veyron name suffix.
+ Specification(context _gen_ipc.ServerContext) (reply profile.Specification, err error)
+ // Put sets the profile specification for the profile identified
+ // through the veyron name suffix.
+ Put(context _gen_ipc.ServerContext, Specification profile.Specification) (err error)
+ // Remove removes the profile specification for the profile
+ // identified through the veyron name suffix.
+ Remove(context _gen_ipc.ServerContext) (err error)
+}
+
+// BindProfile returns the client stub implementing the Profile
+// interface.
+//
+// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
+// global Runtime is used.
+func BindProfile(name string, opts ..._gen_ipc.BindOpt) (Profile, error) {
+ var client _gen_ipc.Client
+ switch len(opts) {
+ case 0:
+ client = _gen_rt.R().Client()
+ case 1:
+ switch o := opts[0].(type) {
+ case _gen_veyron2.Runtime:
+ client = o.Client()
+ case _gen_ipc.Client:
+ client = o
+ default:
+ return nil, _gen_vdl.ErrUnrecognizedOption
+ }
+ default:
+ return nil, _gen_vdl.ErrTooManyOptionsToBind
+ }
+ stub := &clientStubProfile{client: client, name: name}
+ stub.Profile_ExcludingUniversal, _ = repository.BindProfile(name, client)
+
+ return stub, nil
+}
+
+// NewServerProfile creates a new server stub.
+//
+// It takes a regular server implementing the ProfileService
+// interface, and returns a new server stub.
+func NewServerProfile(server ProfileService) interface{} {
+ return &ServerStubProfile{
+ ServerStubProfile: *repository.NewServerProfile(server).(*repository.ServerStubProfile),
+ service: server,
+ }
+}
+
+// clientStubProfile implements Profile.
+type clientStubProfile struct {
+ repository.Profile_ExcludingUniversal
+
+ client _gen_ipc.Client
+ name string
+}
+
+func (__gen_c *clientStubProfile) Specification(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply profile.Specification, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Specification", nil, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&reply, &err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubProfile) Put(ctx _gen_context.T, Specification profile.Specification, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Specification}, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubProfile) Remove(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", nil, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubProfile) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&reply, &err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubProfile) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&reply, &err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+func (__gen_c *clientStubProfile) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+ return
+ }
+ if ierr := call.Finish(&reply, &err); ierr != nil {
+ err = ierr
+ }
+ return
+}
+
+// ServerStubProfile wraps a server that implements
+// ProfileService and provides an object that satisfies
+// the requirements of veyron2/ipc.ReflectInvoker.
+type ServerStubProfile struct {
+ repository.ServerStubProfile
+
+ service ProfileService
+}
+
+func (__gen_s *ServerStubProfile) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
+ // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
+ // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
+ // This will change when it is replaced with Signature().
+ if resp, err := __gen_s.ServerStubProfile.GetMethodTags(call, method); resp != nil || err != nil {
+ return resp, err
+ }
+ switch method {
+ case "Specification":
+ return []interface{}{security.Label(1)}, nil
+ case "Put":
+ return []interface{}{security.Label(2)}, nil
+ case "Remove":
+ return []interface{}{security.Label(2)}, nil
+ default:
+ return nil, nil
+ }
+}
+
+func (__gen_s *ServerStubProfile) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
+ result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
+ result.Methods["Put"] = _gen_ipc.MethodSignature{
+ InArgs: []_gen_ipc.MethodArgument{
+ {Name: "Specification", Type: 69},
+ },
+ OutArgs: []_gen_ipc.MethodArgument{
+ {Name: "", Type: 70},
+ },
+ }
+ result.Methods["Remove"] = _gen_ipc.MethodSignature{
+ InArgs: []_gen_ipc.MethodArgument{},
+ OutArgs: []_gen_ipc.MethodArgument{
+ {Name: "", Type: 70},
+ },
+ }
+ result.Methods["Specification"] = _gen_ipc.MethodSignature{
+ InArgs: []_gen_ipc.MethodArgument{},
+ OutArgs: []_gen_ipc.MethodArgument{
+ {Name: "", Type: 69},
+ {Name: "", Type: 70},
+ },
+ }
+
+ result.TypeDefs = []_gen_vdl.Any{
+ _gen_wiretype.MapType{Key: 0x3, Elem: 0x3, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{
+ []_gen_wiretype.FieldType{
+ _gen_wiretype.FieldType{Type: 0x3, Name: "Name"},
+ _gen_wiretype.FieldType{Type: 0x41, Name: "Attributes"},
+ },
+ "veyron/services/mgmt/profile.Format", []string(nil)},
+ _gen_wiretype.StructType{
+ []_gen_wiretype.FieldType{
+ _gen_wiretype.FieldType{Type: 0x3, Name: "Name"},
+ _gen_wiretype.FieldType{Type: 0x3, Name: "MajorVersion"},
+ _gen_wiretype.FieldType{Type: 0x3, Name: "MinorVersion"},
+ },
+ "veyron/services/mgmt/profile.Library", []string(nil)},
+ _gen_wiretype.MapType{Key: 0x43, Elem: 0x2, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{
+ []_gen_wiretype.FieldType{
+ _gen_wiretype.FieldType{Type: 0x42, Name: "Format"},
+ _gen_wiretype.FieldType{Type: 0x44, Name: "Libraries"},
+ _gen_wiretype.FieldType{Type: 0x3, Name: "Label"},
+ _gen_wiretype.FieldType{Type: 0x3, Name: "Description"},
+ },
+ "veyron/services/mgmt/profile.Specification", []string(nil)},
+ _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
+ var ss _gen_ipc.ServiceSignature
+ var firstAdded int
+ ss, _ = __gen_s.ServerStubProfile.Signature(call)
+ firstAdded = len(result.TypeDefs)
+ for k, v := range ss.Methods {
+ for i, _ := range v.InArgs {
+ if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst {
+ v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
+ }
+ }
+ for i, _ := range v.OutArgs {
+ if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst {
+ v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
+ }
+ }
+ if v.InStream >= _gen_wiretype.TypeIDFirst {
+ v.InStream += _gen_wiretype.TypeID(firstAdded)
+ }
+ if v.OutStream >= _gen_wiretype.TypeIDFirst {
+ v.OutStream += _gen_wiretype.TypeID(firstAdded)
+ }
+ result.Methods[k] = v
+ }
+ //TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication.
+ for _, d := range ss.TypeDefs {
+ switch wt := d.(type) {
+ case _gen_wiretype.SliceType:
+ if wt.Elem >= _gen_wiretype.TypeIDFirst {
+ wt.Elem += _gen_wiretype.TypeID(firstAdded)
+ }
+ d = wt
+ case _gen_wiretype.ArrayType:
+ if wt.Elem >= _gen_wiretype.TypeIDFirst {
+ wt.Elem += _gen_wiretype.TypeID(firstAdded)
+ }
+ d = wt
+ case _gen_wiretype.MapType:
+ if wt.Key >= _gen_wiretype.TypeIDFirst {
+ wt.Key += _gen_wiretype.TypeID(firstAdded)
+ }
+ if wt.Elem >= _gen_wiretype.TypeIDFirst {
+ wt.Elem += _gen_wiretype.TypeID(firstAdded)
+ }
+ d = wt
+ case _gen_wiretype.StructType:
+ for i, fld := range wt.Fields {
+ if fld.Type >= _gen_wiretype.TypeIDFirst {
+ wt.Fields[i].Type += _gen_wiretype.TypeID(firstAdded)
+ }
+ }
+ d = wt
+ // NOTE: other types are missing, but we are upgrading anyways.
+ }
+ result.TypeDefs = append(result.TypeDefs, d)
+ }
+
+ return result, nil
+}
+
+func (__gen_s *ServerStubProfile) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
+ if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
+ return unresolver.UnresolveStep(call)
+ }
+ if call.Server() == nil {
+ return
+ }
+ var published []string
+ if published, err = call.Server().Published(); err != nil || published == nil {
+ return
+ }
+ reply = make([]string, len(published))
+ for i, p := range published {
+ reply[i] = _gen_naming.Join(p, call.Name())
+ }
+ return
+}
+
+func (__gen_s *ServerStubProfile) Specification(call _gen_ipc.ServerCall) (reply profile.Specification, err error) {
+ reply, err = __gen_s.service.Specification(call)
+ return
+}
+
+func (__gen_s *ServerStubProfile) Put(call _gen_ipc.ServerCall, Specification profile.Specification) (err error) {
+ err = __gen_s.service.Put(call, Specification)
+ return
+}
+
+func (__gen_s *ServerStubProfile) Remove(call _gen_ipc.ServerCall) (err error) {
+ err = __gen_s.service.Remove(call)
+ return
+}
diff --git a/tools/application/impl/impl.go b/tools/application/impl/impl.go
index b6248b0..81be26f 100644
--- a/tools/application/impl/impl.go
+++ b/tools/application/impl/impl.go
@@ -11,13 +11,13 @@
"strings"
"veyron/lib/cmdline"
- iapp "veyron/services/mgmt/application"
+ "veyron/services/mgmt/repository"
"veyron2/rt"
"veyron2/services/mgmt/application"
)
-func getEnvelopeJSON(app iapp.Repository, profiles string) ([]byte, error) {
+func getEnvelopeJSON(app repository.Application, profiles string) ([]byte, error) {
env, err := app.Match(rt.R().NewContext(), strings.Split(profiles, ","))
if err != nil {
env = application.Envelope{}
@@ -29,7 +29,7 @@
return j, nil
}
-func putEnvelopeJSON(app iapp.Repository, profiles string, j []byte) error {
+func putEnvelopeJSON(app repository.Application, profiles string, j []byte) error {
var env application.Envelope
if err := json.Unmarshal(j, &env); err != nil {
return fmt.Errorf("json: %v", err)
@@ -64,7 +64,7 @@
if expected, got := 2, len(args); expected != got {
return cmd.Errorf("match: incorrect number of arguments, expected %d, got %d", expected, got)
}
- app, err := iapp.BindRepository(args[0])
+ app, err := repository.BindApplication(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -92,7 +92,7 @@
if expected, got := 3, len(args); expected != got {
return cmd.Errorf("put: incorrect number of arguments, expected %d, got %d", expected, got)
}
- app, err := iapp.BindRepository(args[0])
+ app, err := repository.BindApplication(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -122,7 +122,7 @@
if expected, got := 2, len(args); expected != got {
return cmd.Errorf("remove: incorrect number of arguments, expected %d, got %d", expected, got)
}
- app, err := iapp.BindRepository(args[0])
+ app, err := repository.BindApplication(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -148,7 +148,7 @@
if expected, got := 2, len(args); expected != got {
return cmd.Errorf("edit: incorrect number of arguments, expected %d, got %d", expected, got)
}
- app, err := iapp.BindRepository(args[0])
+ app, err := repository.BindApplication(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -207,8 +207,8 @@
func Root() *cmdline.Command {
return &cmdline.Command{
Name: "application",
- Short: "Command-line tool for interacting with the Veyron application manager",
- Long: "Command-line tool for interacting with the Veyron application manager",
+ Short: "Command-line tool for interacting with the veyron application repository",
+ Long: "Command-line tool for interacting with the veyron application repository",
Children: []*cmdline.Command{cmdMatch, cmdPut, cmdRemove, cmdEdit},
}
}
diff --git a/tools/application/impl/impl_test.go b/tools/application/impl/impl_test.go
index 8829f13..64b3f91 100644
--- a/tools/application/impl/impl_test.go
+++ b/tools/application/impl/impl_test.go
@@ -7,7 +7,7 @@
"strings"
"testing"
- iapp "veyron/services/mgmt/application"
+ "veyron/services/mgmt/repository"
"veyron/tools/application/impl"
"veyron2"
@@ -67,7 +67,7 @@
}
func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
- invoker := ipc.ReflectInvoker(iapp.NewServerRepository(&server{suffix: suffix}))
+ invoker := ipc.ReflectInvoker(repository.NewServerApplication(&server{suffix: suffix}))
return invoker, nil, nil
}
diff --git a/tools/content/impl/impl.go b/tools/content/impl/impl.go
index f9fd170..970de79 100644
--- a/tools/content/impl/impl.go
+++ b/tools/content/impl/impl.go
@@ -8,14 +8,14 @@
"veyron/lib/cmdline"
"veyron2/rt"
- "veyron2/services/mgmt/content"
+ "veyron2/services/mgmt/repository"
)
var cmdDelete = &cmdline.Command{
Run: runDelete,
Name: "delete",
Short: "Delete content",
- Long: "Delete connects to the content server and deletes the specified content",
+ Long: "Delete connects to the content repository and deletes the specified content",
ArgsName: "<content>",
ArgsLong: "<content> is the full name of the content to delete.",
}
@@ -24,7 +24,7 @@
if expected, got := 1, len(args); expected != got {
return cmd.Errorf("delete: incorrect number of arguments, expected %d, got %d", expected, got)
}
- c, err := content.BindRepository(args[0])
+ c, err := repository.BindContent(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -40,7 +40,7 @@
Name: "download",
Short: "Download content",
Long: `
-Download connects to the content server, downloads the specified content, and
+Download connects to the content repository, downloads the specified content, and
writes it to a file.
`,
ArgsName: "<content> <filename>",
@@ -61,7 +61,7 @@
}
defer f.Close()
- c, err := content.BindRepository(args[0])
+ c, err := repository.BindContent(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -98,12 +98,12 @@
Name: "upload",
Short: "Upload content",
Long: `
-Upload connects to the content server and uploads the content of the specified
+Upload connects to the content repository and uploads the content of the specified
file. When successful, it writes the name of the new content to stdout.
`,
ArgsName: "<server> <filename>",
ArgsLong: `
-<server> is the veyron name or endpoint of the content server.
+<server> is the veyron name or endpoint of the content repository.
<filename> is the name of the file to upload.
`,
}
@@ -119,7 +119,7 @@
}
defer f.Close()
- c, err := content.BindRepository(args[0])
+ c, err := repository.BindContent(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -158,8 +158,8 @@
func Root() *cmdline.Command {
return &cmdline.Command{
Name: "content",
- Short: "Command-line tool for interacting with the Veyron content server",
- Long: "Command-line tool for interacting with the Veyron content server",
+ Short: "Command-line tool for interacting with the veyron content repository",
+ Long: "Command-line tool for interacting with the veyron content repository",
Children: []*cmdline.Command{cmdDelete, cmdDownload, cmdUpload},
}
}
diff --git a/tools/content/impl/impl_test.go b/tools/content/impl/impl_test.go
index efd7f0d..ed3f5a5 100644
--- a/tools/content/impl/impl_test.go
+++ b/tools/content/impl/impl_test.go
@@ -16,7 +16,7 @@
"veyron2/naming"
"veyron2/rt"
"veyron2/security"
- "veyron2/services/mgmt/content"
+ "veyron2/services/mgmt/repository"
"veyron2/vlog"
)
@@ -32,14 +32,14 @@
return nil
}
-func (s *server) Download(_ ipc.ServerContext, stream content.RepositoryServiceDownloadStream) error {
+func (s *server) Download(_ ipc.ServerContext, stream repository.ContentServiceDownloadStream) error {
vlog.VI(2).Infof("Download() was called. suffix=%v", s.suffix)
stream.Send([]byte("Hello"))
stream.Send([]byte("World"))
return nil
}
-func (s *server) Upload(_ ipc.ServerContext, stream content.RepositoryServiceUploadStream) (string, error) {
+func (s *server) Upload(_ ipc.ServerContext, stream repository.ContentServiceUploadStream) (string, error) {
vlog.VI(2).Infof("Upload() was called. suffix=%v", s.suffix)
for {
if _, err := stream.Recv(); err != nil {
@@ -57,7 +57,7 @@
}
func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
- invoker := ipc.ReflectInvoker(content.NewServerRepository(&server{suffix: suffix}))
+ invoker := ipc.ReflectInvoker(repository.NewServerContent(&server{suffix: suffix}))
return invoker, nil, nil
}
diff --git a/tools/profile/impl/impl.go b/tools/profile/impl/impl.go
index 0d3b745..cef78c8 100644
--- a/tools/profile/impl/impl.go
+++ b/tools/profile/impl/impl.go
@@ -5,6 +5,7 @@
"veyron/lib/cmdline"
"veyron/services/mgmt/profile"
+ "veyron/services/mgmt/repository"
"veyron2/rt"
)
@@ -22,7 +23,7 @@
if expected, got := 1, len(args); expected != got {
return cmd.Errorf("label: incorrect number of arguments, expected %d, got %d", expected, got)
}
- p, err := profile.BindProfile(args[0])
+ p, err := repository.BindProfile(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -47,7 +48,7 @@
if expected, got := 1, len(args); expected != got {
return cmd.Errorf("description: incorrect number of arguments, expected %d, got %d", expected, got)
}
- p, err := profile.BindProfile(args[0])
+ p, err := repository.BindProfile(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -72,7 +73,7 @@
if expected, got := 1, len(args); expected != got {
return cmd.Errorf("spec: incorrect number of arguments, expected %d, got %d", expected, got)
}
- p, err := profile.BindProfile(args[0])
+ p, err := repository.BindProfile(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -97,7 +98,7 @@
if expected, got := 1, len(args); expected != got {
return cmd.Errorf("put: incorrect number of arguments, expected %d, got %d", expected, got)
}
- p, err := profile.BindProfile(args[0])
+ p, err := repository.BindProfile(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -129,7 +130,7 @@
if expected, got := 1, len(args); expected != got {
return cmd.Errorf("remove: incorrect number of arguments, expected %d, got %d", expected, got)
}
- p, err := profile.BindProfile(args[0])
+ p, err := repository.BindProfile(args[0])
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
@@ -143,8 +144,8 @@
func Root() *cmdline.Command {
return &cmdline.Command{
Name: "profile",
- Short: "Command-line tool for interacting with the Veyron profile manager",
- Long: "Command-line tool for interacting with the Veyron profile manager",
+ Short: "Command-line tool for interacting with the veyron profile repository",
+ Long: "Command-line tool for interacting with the veyron profile repository",
Children: []*cmdline.Command{cmdLabel, cmdDescription, cmdSpec, cmdPut, cmdRemove},
}
}
diff --git a/tools/profile/impl/impl_test.go b/tools/profile/impl/impl_test.go
index 8e6deba..e0d179a 100644
--- a/tools/profile/impl/impl_test.go
+++ b/tools/profile/impl/impl_test.go
@@ -7,6 +7,7 @@
"testing"
"veyron/services/mgmt/profile"
+ "veyron/services/mgmt/repository"
"veyron/tools/profile/impl"
"veyron2"
@@ -23,7 +24,7 @@
Format: profile.Format{Name: "elf", Attributes: map[string]string{"os": "linux"}},
Libraries: map[profile.Library]struct{}{profile.Library{Name: "foo", MajorVersion: "1", MinorVersion: "0"}: struct{}{}},
Label: "example",
- Description: "Example profile to test the profile manager implementation.",
+ Description: "Example profile to test the profile repository implementation.",
}
)
@@ -76,7 +77,7 @@
}
func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
- invoker := ipc.ReflectInvoker(profile.NewServerProfile(&server{suffix: suffix}))
+ invoker := ipc.ReflectInvoker(repository.NewServerProfile(&server{suffix: suffix}))
return invoker, nil, nil
}