(ctx context.Context, ref string)
| 330 | } |
| 331 | |
| 332 | func (cs *contentStore) Abort(ctx context.Context, ref string) error { |
| 333 | ns, err := namespaces.NamespaceRequired(ctx) |
| 334 | if err != nil { |
| 335 | return err |
| 336 | } |
| 337 | |
| 338 | cs.l.RLock() |
| 339 | defer cs.l.RUnlock() |
| 340 | |
| 341 | return update(ctx, cs.db, func(tx *bolt.Tx) error { |
| 342 | ibkt := getIngestsBucket(tx, ns) |
| 343 | if ibkt == nil { |
| 344 | return fmt.Errorf("reference %v: %w", ref, errdefs.ErrNotFound) |
| 345 | } |
| 346 | bkt := ibkt.Bucket([]byte(ref)) |
| 347 | if bkt == nil { |
| 348 | return fmt.Errorf("reference %v: %w", ref, errdefs.ErrNotFound) |
| 349 | } |
| 350 | bref := string(bkt.Get(bucketKeyRef)) |
| 351 | if bref == "" { |
| 352 | return fmt.Errorf("reference %v: %w", ref, errdefs.ErrNotFound) |
| 353 | } |
| 354 | expected := string(bkt.Get(bucketKeyExpected)) |
| 355 | if err := ibkt.DeleteBucket([]byte(ref)); err != nil { |
| 356 | return err |
| 357 | } |
| 358 | |
| 359 | if err := removeIngestLease(ctx, tx, ref); err != nil { |
| 360 | return err |
| 361 | } |
| 362 | |
| 363 | // if not shared content, delete active ingest on backend |
| 364 | if expected == "" { |
| 365 | return cs.Store.Abort(ctx, bref) |
| 366 | } |
| 367 | |
| 368 | return nil |
| 369 | }) |
| 370 | |
| 371 | } |
| 372 | |
| 373 | func (cs *contentStore) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { |
| 374 | var wOpts content.WriterOpts |
nothing calls this directly
no test coverage detected