AtomicThumbnailStream
class AtomicThumbnailStream implements IteratorAggregate (View source)
Class AtomicThumbnailStream Outputs a stream of thumbnails in an atomic way. This ensures a thumbnail will only be built on a single thread at a time
Properties
protected DatabaseManager | $manager | ||
protected string | $table | ||
protected string | $lockColumn | ||
protected string | $lockTimeoutColumn | ||
protected string | $isBuiltColumn | ||
protected int | $timeout | ||
protected string | $lockID |
Methods
Get an iterator that outputs locked thumbnail rows
Get the next matching thumbnail path row
Find the row matching the passed criteria This is used to verify that we've successfully locked a row in the database.
Check if the required lock columns have been added to the database.
Set the timeout for the table lock in seconds
No description
Get and memoize the current lock ID
Details
__construct(DatabaseManager $manager)
No description
Generator|void
getIterator()
Get an iterator that outputs locked thumbnail rows
private mixed
next(QueryBuilder $nextQuery)
Get the next matching thumbnail path row
private bool
reserveNext(array $next, Connection $db)
Mark the next item as reserved
private bool|mixed
matchingLock($lockID, array $next, Connection $db)
Find the row matching the passed criteria This is used to verify that we've successfully locked a row in the database.
private bool
lockColumnsExist(Connection $db)
Check if the required lock columns have been added to the database.
This prevents people upgrading from seeing 500 errors in their logs.
setTimeout(string $timeout)
Set the timeout for the table lock in seconds
protected QueryBuilder
getNextQuery(QueryBuilder $qb)
No description
private string
getLockID()
Get and memoize the current lock ID