client: move namespaces client to containerd package

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo 2017-11-16 17:47:38 -08:00
parent 5b64f7030d
commit 6cd9962c7f
2 changed files with 11 additions and 12 deletions

View File

@ -36,7 +36,6 @@ import (
contentservice "github.com/containerd/containerd/services/content"
diffservice "github.com/containerd/containerd/services/diff"
imagesservice "github.com/containerd/containerd/services/images"
namespacesservice "github.com/containerd/containerd/services/namespaces"
"github.com/containerd/containerd/snapshot"
"github.com/containerd/typeurl"
ptypes "github.com/gogo/protobuf/types"
@ -425,7 +424,7 @@ func (c *Client) Close() error {
// NamespaceService returns the underlying Namespaces Store
func (c *Client) NamespaceService() namespaces.Store {
return namespacesservice.NewStoreFromClient(namespacesapi.NewNamespacesClient(c.conn))
return NewNamespaceStoreFromClient(namespacesapi.NewNamespacesClient(c.conn))
}
// ContainerService returns the underlying container Store

View File

@ -1,4 +1,4 @@
package namespaces
package containerd
import (
"context"
@ -10,16 +10,16 @@ import (
"github.com/gogo/protobuf/types"
)
// NewStoreFromClient returns a new namespace store
func NewStoreFromClient(client api.NamespacesClient) namespaces.Store {
return &remote{client: client}
// NewNamespaceStoreFromClient returns a new namespace store
func NewNamespaceStoreFromClient(client api.NamespacesClient) namespaces.Store {
return &remoteNamespaces{client: client}
}
type remote struct {
type remoteNamespaces struct {
client api.NamespacesClient
}
func (r *remote) Create(ctx context.Context, namespace string, labels map[string]string) error {
func (r *remoteNamespaces) Create(ctx context.Context, namespace string, labels map[string]string) error {
var req api.CreateNamespaceRequest
req.Namespace = api.Namespace{
@ -35,7 +35,7 @@ func (r *remote) Create(ctx context.Context, namespace string, labels map[string
return nil
}
func (r *remote) Labels(ctx context.Context, namespace string) (map[string]string, error) {
func (r *remoteNamespaces) Labels(ctx context.Context, namespace string) (map[string]string, error) {
var req api.GetNamespaceRequest
req.Name = namespace
@ -47,7 +47,7 @@ func (r *remote) Labels(ctx context.Context, namespace string) (map[string]strin
return resp.Namespace.Labels, nil
}
func (r *remote) SetLabel(ctx context.Context, namespace, key, value string) error {
func (r *remoteNamespaces) SetLabel(ctx context.Context, namespace, key, value string) error {
var req api.UpdateNamespaceRequest
req.Namespace = api.Namespace{
@ -67,7 +67,7 @@ func (r *remote) SetLabel(ctx context.Context, namespace, key, value string) err
return nil
}
func (r *remote) List(ctx context.Context) ([]string, error) {
func (r *remoteNamespaces) List(ctx context.Context) ([]string, error) {
var req api.ListNamespacesRequest
resp, err := r.client.List(ctx, &req)
@ -84,7 +84,7 @@ func (r *remote) List(ctx context.Context) ([]string, error) {
return namespaces, nil
}
func (r *remote) Delete(ctx context.Context, namespace string) error {
func (r *remoteNamespaces) Delete(ctx context.Context, namespace string) error {
var req api.DeleteNamespaceRequest
req.Name = namespace