removeObjectsSingle deletes objects one by one using single DELETE requests. This is used for endpoints that do not support multi-object delete (e.g., GCS).
(ctx context.Context, bucketName string, objectsCh <-chan ObjectInfo, resultCh chan<- RemoveObjectResult, opts RemoveObjectsOptions)
| 663 | // removeObjectsSingle deletes objects one by one using single DELETE requests. |
| 664 | // This is used for endpoints that do not support multi-object delete (e.g., GCS). |
| 665 | func (c *Client) removeObjectsSingle(ctx context.Context, bucketName string, objectsCh <-chan ObjectInfo, resultCh chan<- RemoveObjectResult, opts RemoveObjectsOptions) { |
| 666 | for { |
| 667 | select { |
| 668 | case <-ctx.Done(): |
| 669 | return |
| 670 | case object, ok := <-objectsCh: |
| 671 | if !ok { |
| 672 | return |
| 673 | } |
| 674 | removeResult := c.removeObject(ctx, bucketName, object.Key, RemoveObjectOptions{ |
| 675 | VersionID: object.VersionID, |
| 676 | GovernanceBypass: opts.GovernanceBypass, |
| 677 | }) |
| 678 | if err := removeResult.Err; err != nil { |
| 679 | // Version/object does not exist is not an error, ignore and continue. |
| 680 | switch ToErrorResponse(err).Code { |
| 681 | case NoSuchVersion, NoSuchKey: |
| 682 | continue |
| 683 | } |
| 684 | } |
| 685 | select { |
| 686 | case <-ctx.Done(): |
| 687 | return |
| 688 | case resultCh <- removeResult: |
| 689 | } |
| 690 | } |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // removeObjectsSingleIter deletes objects one by one using single DELETE requests. |
| 695 | // This is used for endpoints that do not support multi-object delete (e.g., GCS). |
no test coverage detected