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

Method List

plugins/services/namespaces/local.go:96–121  ·  view source on GitHub ↗
(ctx context.Context, req *api.ListNamespacesRequest, _ ...grpc.CallOption)

Source from the content-addressed store, hash-verified

94}
95
96func (l *local) List(ctx context.Context, req *api.ListNamespacesRequest, _ ...grpc.CallOption) (*api.ListNamespacesResponse, error) {
97 var resp api.ListNamespacesResponse
98
99 return &resp, l.withStoreView(ctx, func(ctx context.Context, store namespaces.Store) error {
100 namespaces, err := store.List(ctx)
101 if err != nil {
102 return err
103 }
104
105 for _, namespace := range namespaces {
106 labels, err := store.Labels(ctx, namespace)
107 if err != nil {
108 // In general, this should be unlikely, since we are holding a
109 // transaction to service this request.
110 return errgrpc.ToGRPC(err)
111 }
112
113 resp.Namespaces = append(resp.Namespaces, &api.Namespace{
114 Name: namespace,
115 Labels: labels,
116 })
117 }
118
119 return nil
120 })
121}
122
123func (l *local) Create(ctx context.Context, req *api.CreateNamespaceRequest, _ ...grpc.CallOption) (*api.CreateNamespaceResponse, error) {
124 var resp api.CreateNamespaceResponse

Callers

nothing calls this directly

Calls 3

withStoreViewMethod · 0.95
ListMethod · 0.65
LabelsMethod · 0.65

Tested by

no test coverage detected