github.com/lalkh/containerd@v1.4.3/namespaces/store.go (about) 1 /* 2 Copyright The containerd Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package namespaces 18 19 import "context" 20 21 // Store provides introspection about namespaces. 22 // 23 // Note that these are slightly different than other objects, which are record 24 // oriented. A namespace is really just a name and a set of labels. Objects 25 // that belong to a namespace are returned when the namespace is assigned to a 26 // given context. 27 // 28 // 29 type Store interface { 30 Create(ctx context.Context, namespace string, labels map[string]string) error 31 Labels(ctx context.Context, namespace string) (map[string]string, error) 32 SetLabel(ctx context.Context, namespace, key, value string) error 33 List(ctx context.Context) ([]string, error) 34 35 // Delete removes the namespace. The namespace must be empty to be deleted. 36 Delete(ctx context.Context, namespace string, opts ...DeleteOpts) error 37 } 38 39 // DeleteInfo specifies information for the deletion of a namespace 40 type DeleteInfo struct { 41 // Name of the namespace 42 Name string 43 } 44 45 // DeleteOpts allows the caller to set options for namespace deletion 46 type DeleteOpts func(context.Context, *DeleteInfo) error