(ctx context.Context, dgst digest.Digest)
| 202 | } |
| 203 | |
| 204 | func (cs *contentStore) Delete(ctx context.Context, dgst digest.Digest) error { |
| 205 | ns, err := namespaces.NamespaceRequired(ctx) |
| 206 | if err != nil { |
| 207 | return err |
| 208 | } |
| 209 | |
| 210 | cs.l.RLock() |
| 211 | defer cs.l.RUnlock() |
| 212 | |
| 213 | if err := update(ctx, cs.db, func(tx *bolt.Tx) error { |
| 214 | bkt := getBlobBucket(tx, ns, dgst) |
| 215 | if bkt == nil { |
| 216 | return fmt.Errorf("content digest %v: %w", dgst, errdefs.ErrNotFound) |
| 217 | } |
| 218 | |
| 219 | if err := getBlobsBucket(tx, ns).DeleteBucket([]byte(dgst.String())); err != nil { |
| 220 | return err |
| 221 | } |
| 222 | if err := removeContentLease(ctx, tx, dgst); err != nil { |
| 223 | return err |
| 224 | } |
| 225 | |
| 226 | // Mark content store as dirty for triggering garbage collection |
| 227 | cs.db.dirty.Add(1) |
| 228 | cs.db.dirtyCS = true |
| 229 | |
| 230 | return nil |
| 231 | }); err != nil { |
| 232 | return err |
| 233 | } |
| 234 | |
| 235 | if publisher := cs.db.Publisher(ctx); publisher != nil { |
| 236 | if err := publisher.Publish(ctx, "/content/delete", &eventstypes.ContentDelete{ |
| 237 | Digest: dgst.String(), |
| 238 | }); err != nil { |
| 239 | return err |
| 240 | } |
| 241 | } |
| 242 | return nil |
| 243 | } |
| 244 | |
| 245 | func (cs *contentStore) ListStatuses(ctx context.Context, fs ...string) ([]content.Status, error) { |
| 246 | ns, err := namespaces.NamespaceRequired(ctx) |
nothing calls this directly
no test coverage detected