RemoveObjectsWithIter bulk deletes multiple objects from a bucket. Objects (with optional versions) to be removed must be provided with an iterator. Objects are removed asynchronously and results must be consumed. If the returned result iterator is stopped, the context is canceled, or a remote call
(ctx context.Context, bucketName string, objectsIter iter.Seq[ObjectInfo], opts RemoveObjectsOptions)
| 349 | // canceled, or a remote call failed, the provided iterator will no |
| 350 | // longer accept more objects. |
| 351 | func (c *Client) RemoveObjectsWithIter(ctx context.Context, bucketName string, objectsIter iter.Seq[ObjectInfo], opts RemoveObjectsOptions) (iter.Seq[RemoveObjectResult], error) { |
| 352 | // Validate if bucket name is valid. |
| 353 | if err := s3utils.CheckValidBucketName(bucketName); err != nil { |
| 354 | return nil, err |
| 355 | } |
| 356 | // Validate objects channel to be properly allocated. |
| 357 | if objectsIter == nil { |
| 358 | return nil, errInvalidArgument("Objects iter can never by nil") |
| 359 | } |
| 360 | |
| 361 | return func(yield func(RemoveObjectResult) bool) { |
| 362 | select { |
| 363 | case <-ctx.Done(): |
| 364 | return |
| 365 | default: |
| 366 | } |
| 367 | |
| 368 | c.removeObjectsIter(ctx, bucketName, objectsIter, yield, opts) |
| 369 | }, nil |
| 370 | } |
| 371 | |
| 372 | // RemoveObjectsWithResult removes multiple objects from a bucket while |
| 373 | // it is possible to specify objects versions which are received from |
no test coverage detected