class DynamoBatchRepository implements BatchRepository (View source)

Properties

protected BatchFactory $factory

The batch factory instance.

protected DynamoDbClient $dynamoDbClient

The database connection instance.

protected string $applicationName

The application name.

protected string $table

The table to use to store batch information.

protected int $ttl

The time-to-live value for batch records.

protected string $ttlAttribute

The name of the time-to-live attribute for batch records.

protected Marshaler $marshaler

The DynamoDB marshaler instance.

Methods

__construct(BatchFactory $factory, DynamoDbClient $dynamoDbClient, string $applicationName, string $table, int|null $ttl, string|null $ttlAttribute)

Create a new batch repository instance.

Batch[]
get(int $limit = 50, mixed $before = null)

Retrieve a list of batches.

Batch|null
find(string $batchId)

Retrieve information about an existing batch.

store(PendingBatch $batch)

Store a new pending batch.

void
incrementTotalJobs(string $batchId, int $amount)

Increment the total number of jobs within the batch.

decrementPendingJobs(string $batchId, string $jobId)

Decrement the total number of pending jobs for the batch.

incrementFailedJobs(string $batchId, string $jobId)

Increment the total number of failed jobs for the batch.

void
markAsFinished(string $batchId)

Mark the batch that has the given ID as finished.

void
cancel(string $batchId)

Cancel the batch that has the given ID.

void
delete(string $batchId)

Delete the batch that has the given ID.

mixed
transaction(Closure $callback)

Execute the given Closure within a storage specific transaction.

void
rollBack()

Rollback the last database transaction for the connection.

toBatch(object $batch)

Convert the given raw batch to a Batch object.

void
createAwsDynamoTable()

Create the underlying DynamoDB table.

void
deleteAwsDynamoTable()

Delete the underlying DynamoDB table.

string|null
getExpiryTime()

Get the expiry time based on the configured time-to-live.

array
ttlExpressionAttributeName()

Get the expression attribute name for the time-to-live attribute.

string
serialize(mixed $value)

Serialize the given value.

mixed
unserialize(string $serialized)

Unserialize the given value.

DynamoDbClient
getDynamoClient()

Get the underlying DynamoDB client instance.

string
getTable()

The name of the table that contains the batch records.

Details

__construct(BatchFactory $factory, DynamoDbClient $dynamoDbClient, string $applicationName, string $table, int|null $ttl, string|null $ttlAttribute)

Create a new batch repository instance.

Parameters

BatchFactory $factory
DynamoDbClient $dynamoDbClient
string $applicationName
string $table
int|null $ttl
string|null $ttlAttribute

Batch[] get(int $limit = 50, mixed $before = null)

Retrieve a list of batches.

Parameters

int $limit
mixed $before

Return Value

Batch[]

Batch|null find(string $batchId)

Retrieve information about an existing batch.

Parameters

string $batchId

Return Value

Batch|null

Batch store(PendingBatch $batch)

Store a new pending batch.

Parameters

PendingBatch $batch

Return Value

Batch

void incrementTotalJobs(string $batchId, int $amount)

Increment the total number of jobs within the batch.

Parameters

string $batchId
int $amount

Return Value

void

UpdatedBatchJobCounts decrementPendingJobs(string $batchId, string $jobId)

Decrement the total number of pending jobs for the batch.

Parameters

string $batchId
string $jobId

Return Value

UpdatedBatchJobCounts

UpdatedBatchJobCounts incrementFailedJobs(string $batchId, string $jobId)

Increment the total number of failed jobs for the batch.

Parameters

string $batchId
string $jobId

Return Value

UpdatedBatchJobCounts

void markAsFinished(string $batchId)

Mark the batch that has the given ID as finished.

Parameters

string $batchId

Return Value

void

void cancel(string $batchId)

Cancel the batch that has the given ID.

Parameters

string $batchId

Return Value

void

void delete(string $batchId)

Delete the batch that has the given ID.

Parameters

string $batchId

Return Value

void

mixed transaction(Closure $callback)

Execute the given Closure within a storage specific transaction.

Parameters

Closure $callback

Return Value

mixed

void rollBack()

Rollback the last database transaction for the connection.

Return Value

void

protected Batch toBatch(object $batch)

Convert the given raw batch to a Batch object.

Parameters

object $batch

Return Value

Batch

void createAwsDynamoTable()

Create the underlying DynamoDB table.

Return Value

void

void deleteAwsDynamoTable()

Delete the underlying DynamoDB table.

Return Value

void

protected string|null getExpiryTime()

Get the expiry time based on the configured time-to-live.

Return Value

string|null

protected array ttlExpressionAttributeName()

Get the expression attribute name for the time-to-live attribute.

Return Value

array

protected string serialize(mixed $value)

Serialize the given value.

Parameters

mixed $value

Return Value

string

protected mixed unserialize(string $serialized)

Unserialize the given value.

Parameters

string $serialized

Return Value

mixed

DynamoDbClient getDynamoClient()

Get the underlying DynamoDB client instance.

Return Value

DynamoDbClient

string getTable()

The name of the table that contains the batch records.

Return Value

string