X Tutup
Skip to content

Commit 6cd9962

Browse files
committed
client: move namespaces client to containerd package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
1 parent 5b64f70 commit 6cd9962

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
contentservice "github.com/containerd/containerd/services/content"
3737
diffservice "github.com/containerd/containerd/services/diff"
3838
imagesservice "github.com/containerd/containerd/services/images"
39-
namespacesservice "github.com/containerd/containerd/services/namespaces"
4039
"github.com/containerd/containerd/snapshot"
4140
"github.com/containerd/typeurl"
4241
ptypes "github.com/gogo/protobuf/types"
@@ -425,7 +424,7 @@ func (c *Client) Close() error {
425424

426425
// NamespaceService returns the underlying Namespaces Store
427426
func (c *Client) NamespaceService() namespaces.Store {
428-
return namespacesservice.NewStoreFromClient(namespacesapi.NewNamespacesClient(c.conn))
427+
return NewNamespaceStoreFromClient(namespacesapi.NewNamespacesClient(c.conn))
429428
}
430429

431430
// ContainerService returns the underlying container Store
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package namespaces
1+
package containerd
22

33
import (
44
"context"
@@ -10,16 +10,16 @@ import (
1010
"github.com/gogo/protobuf/types"
1111
)
1212

13-
// NewStoreFromClient returns a new namespace store
14-
func NewStoreFromClient(client api.NamespacesClient) namespaces.Store {
15-
return &remote{client: client}
13+
// NewNamespaceStoreFromClient returns a new namespace store
14+
func NewNamespaceStoreFromClient(client api.NamespacesClient) namespaces.Store {
15+
return &remoteNamespaces{client: client}
1616
}
1717

18-
type remote struct {
18+
type remoteNamespaces struct {
1919
client api.NamespacesClient
2020
}
2121

22-
func (r *remote) Create(ctx context.Context, namespace string, labels map[string]string) error {
22+
func (r *remoteNamespaces) Create(ctx context.Context, namespace string, labels map[string]string) error {
2323
var req api.CreateNamespaceRequest
2424

2525
req.Namespace = api.Namespace{
@@ -35,7 +35,7 @@ func (r *remote) Create(ctx context.Context, namespace string, labels map[string
3535
return nil
3636
}
3737

38-
func (r *remote) Labels(ctx context.Context, namespace string) (map[string]string, error) {
38+
func (r *remoteNamespaces) Labels(ctx context.Context, namespace string) (map[string]string, error) {
3939
var req api.GetNamespaceRequest
4040
req.Name = namespace
4141

@@ -47,7 +47,7 @@ func (r *remote) Labels(ctx context.Context, namespace string) (map[string]strin
4747
return resp.Namespace.Labels, nil
4848
}
4949

50-
func (r *remote) SetLabel(ctx context.Context, namespace, key, value string) error {
50+
func (r *remoteNamespaces) SetLabel(ctx context.Context, namespace, key, value string) error {
5151
var req api.UpdateNamespaceRequest
5252

5353
req.Namespace = api.Namespace{
@@ -67,7 +67,7 @@ func (r *remote) SetLabel(ctx context.Context, namespace, key, value string) err
6767
return nil
6868
}
6969

70-
func (r *remote) List(ctx context.Context) ([]string, error) {
70+
func (r *remoteNamespaces) List(ctx context.Context) ([]string, error) {
7171
var req api.ListNamespacesRequest
7272

7373
resp, err := r.client.List(ctx, &req)
@@ -84,7 +84,7 @@ func (r *remote) List(ctx context.Context) ([]string, error) {
8484
return namespaces, nil
8585
}
8686

87-
func (r *remote) Delete(ctx context.Context, namespace string) error {
87+
func (r *remoteNamespaces) Delete(ctx context.Context, namespace string) error {
8888
var req api.DeleteNamespaceRequest
8989

9090
req.Name = namespace

0 commit comments

Comments
 (0)
X Tutup