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

Method ListStatuses

core/metadata/content.go:245–292  ·  view source on GitHub ↗
(ctx context.Context, fs ...string)

Source from the content-addressed store, hash-verified

243}
244
245func (cs *contentStore) ListStatuses(ctx context.Context, fs ...string) ([]content.Status, error) {
246 ns, err := namespaces.NamespaceRequired(ctx)
247 if err != nil {
248 return nil, err
249 }
250
251 filter, err := filters.ParseAll(fs...)
252 if err != nil {
253 return nil, err
254 }
255
256 brefs := map[string]string{}
257 if err := view(ctx, cs.db, func(tx *bolt.Tx) error {
258 bkt := getIngestsBucket(tx, ns)
259 if bkt == nil {
260 return nil
261 }
262
263 return bkt.ForEach(func(k, v []byte) error {
264 if v == nil {
265 // TODO(dmcgowan): match name and potentially labels here
266 brefs[string(k)] = string(bkt.Bucket(k).Get(bucketKeyRef))
267 }
268 return nil
269 })
270 }); err != nil {
271 return nil, err
272 }
273
274 statuses := make([]content.Status, 0, len(brefs))
275 for k, bref := range brefs {
276 status, err := cs.Store.Status(ctx, bref)
277 if err != nil {
278 if errdefs.IsNotFound(err) {
279 continue
280 }
281 return nil, err
282 }
283 status.Ref = k
284
285 if filter.Match(adaptContentStatus(status)) {
286 statuses = append(statuses, status)
287 }
288 }
289
290 return statuses, nil
291
292}
293
294func getRef(tx *bolt.Tx, ns, ref string) string {
295 bkt := getIngestBucket(tx, ns, ref)

Callers

nothing calls this directly

Calls 8

NamespaceRequiredFunction · 0.92
ParseAllFunction · 0.92
getIngestsBucketFunction · 0.85
adaptContentStatusFunction · 0.85
viewFunction · 0.70
GetMethod · 0.65
StatusMethod · 0.65
MatchMethod · 0.65

Tested by

no test coverage detected