Documentation

BatchDelete
in package
implements PromisorInterface

Efficiently deletes many objects from a single Amazon S3 bucket using an iterator that yields keys. Deletes are made using the DeleteObjects API operation.

$s3 = new Aws\S3\Client([ 'region' => 'us-west-2', 'version' => 'latest' ]);

$listObjectsParams = ['Bucket' => 'foo', 'Prefix' => 'starts/with/'];
$delete = Aws\S3\BatchDelete::fromListObjects($s3, $listObjectsParams);
// Asynchronously delete
$promise = $delete->promise();
// Force synchronous completion
$delete->delete();

When using one of the batch delete creational static methods, you can supply an associative array of options:

  • before: Function invoked before executing a command. The function is passed the command that is about to be executed. This can be useful for logging, adding custom request headers, etc.
  • batch_size: The size of each delete batch. Defaults to 1000.
Tags
link
http://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html

Interfaces, Classes and Traits

PromisorInterface
Interface used with classes that return a promise.

Table of Contents

$batchSize  : mixed
$before  : callable
$bucket  : mixed
$cachedPromise  : PromiseInterface
$client  : AwsClientInterface
$promiseCreator  : callable
$queue  : mixed
delete()  : mixed
Synchronously deletes all of the objects.
fromIterator()  : BatchDelete
Creates a BatchDelete object from an iterator that yields results.
fromListObjects()  : BatchDelete
Creates a BatchDelete object from all of the paginated results of a ListObjects operation. Each result that is returned by the ListObjects operation will be deleted.
promise()  : PromiseInterface
Returns a promise.
__construct()  : mixed
createPromise()  : PromiseInterface
Returns a promise that will clean up any references when it completes.
enqueue()  : mixed
flushQueue()  : mixed

Properties

Methods

fromIterator()

Creates a BatchDelete object from an iterator that yields results.

public static fromIterator(AwsClientInterface $client, string $bucket, Iterator $iter[, array<string|int, mixed> $options = [] ]) : BatchDelete
Parameters
$client : AwsClientInterface

AWS Client to use to execute commands

$bucket : string

Bucket where the objects are stored

$iter : Iterator

Iterator that yields assoc arrays

$options : array<string|int, mixed> = []

BatchDelete options

Return values
BatchDelete

fromListObjects()

Creates a BatchDelete object from all of the paginated results of a ListObjects operation. Each result that is returned by the ListObjects operation will be deleted.

public static fromListObjects(AwsClientInterface $client, array<string|int, mixed> $listObjectsParams[, array<string|int, mixed> $options = [] ]) : BatchDelete
Parameters
$client : AwsClientInterface

AWS Client to use.

$listObjectsParams : array<string|int, mixed>

ListObjects API parameters

$options : array<string|int, mixed> = []

BatchDelete options.

Return values
BatchDelete

__construct()

private __construct(AwsClientInterface $client, string $bucket, callable $promiseFn[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$client : AwsClientInterface

Client used to transfer the requests

$bucket : string

Bucket to delete from.

$promiseFn : callable

Creates a promise.

$options : array<string|int, mixed> = []

Hash of options used with the batch

Tags
throws
InvalidArgumentException

if the provided batch_size is <= 0

Return values
mixed

enqueue()

private enqueue(array<string|int, mixed> $obj) : mixed
Parameters
$obj : array<string|int, mixed>
Return values
mixed

flushQueue()

private flushQueue() : mixed
Return values
mixed

Search results