MCPcopy Index your code
hub / github.com/containerd/containerd / SetLabel

Method SetLabel

core/metadata/namespaces.go:99–112  ·  view source on GitHub ↗
(ctx context.Context, namespace, key, value string)

Source from the content-addressed store, hash-verified

97}
98
99func (s *namespaceStore) SetLabel(ctx context.Context, namespace, key, value string) error {
100 if err := l.Validate(key, value); err != nil {
101 return fmt.Errorf("namespace.Labels: %w", err)
102 }
103
104 return withNamespacesLabelsBucket(s.tx, namespace, func(bkt *bolt.Bucket) error {
105 if value == "" {
106 return bkt.Delete([]byte(key))
107 }
108
109 return bkt.Put([]byte(key), []byte(value))
110 })
111
112}
113
114func (s *namespaceStore) List(ctx context.Context) ([]string, error) {
115 bkt := getBucket(s.tx, bucketKeyVersion)

Callers

nothing calls this directly

Calls 4

PutMethod · 0.80
DeleteMethod · 0.65
ValidateMethod · 0.45

Tested by

no test coverage detected