(ctx context.Context, fs ...string)
| 243 | } |
| 244 | |
| 245 | func (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 | |
| 294 | func getRef(tx *bolt.Tx, ns, ref string) string { |
| 295 | bkt := getIngestBucket(tx, ns, ref) |
nothing calls this directly
no test coverage detected