MediaWiki  REL1_22
JobQueueDB Class Reference

Class to handle job queues stored in the DB. More...

Inheritance diagram for JobQueueDB:
Collaboration diagram for JobQueueDB:

List of all members.

Public Member Functions

 doBatchPushInternal (IDatabase $dbw, array $jobs, $flags, $method)
 This function should *not* be called outside of JobQueueDB.
 getAllQueuedJobs ()
 getCoalesceLocationInternal ()
 Do not use this function outside of JobQueue/JobQueueGroup.
 recycleAndDeleteStaleJobs ()
 Recycle or destroy any jobs that have been claimed for too long.

Public Attributes

const CACHE_TTL_LONG = 300
const CACHE_TTL_SHORT = 30
const MAX_AGE_PRUNE = 604800
const MAX_JOB_RANDOM = 2147483647
const MAX_OFFSET = 255

Protected Member Functions

 __construct (array $params)
 Additional parameters include:
 claimOldest ($uuid)
 Reserve a row with a single UPDATE without holding row locks over RTTs...
 claimRandom ($uuid, $rand, $gte)
 Reserve a row with a single UPDATE without holding row locks over RTTs...
 doAck (Job $job)
 doBatchPush (array $jobs, $flags)
 doDeduplicateRootJob (Job $job)
 doDelete ()
 doFlushCaches ()
 doGetAbandonedCount ()
 doGetAcquiredCount ()
 doGetPeriodicTasks ()
 doGetSiblingQueueSizes (array $types)
 doGetSiblingQueuesWithJobs (array $types)
 doGetSize ()
 doIsEmpty ()
 doPop ()
 doWaitForBackups ()
 getDB ($index)
 getMasterDB ()
 getSlaveDB ()
 insertFields (Job $job)
 optimalOrder ()
 Get the default queue order to use if configuration does not specify one.
 supportedOrders ()
 Get the allowed queue orders for configuration validation.
 throwDBException (DBError $e)

Static Protected Member Functions

static extractBlob ($blob)
static makeBlob ($params)

Protected Attributes

BagOStuff $cache
 *
 $cluster = false

Private Member Functions

 getCacheKey ($property)

Detailed Description

Class to handle job queues stored in the DB.

Since:
1.21

Definition at line 30 of file JobQueueDB.php.


Constructor & Destructor Documentation

JobQueueDB::__construct ( array params) [protected]

Additional parameters include:

  • cluster : The name of an external cluster registered via LBFactory. If not specified, the primary DB cluster for the wiki will be used. This can be overridden with a custom cluster so that DB handles will be retrieved via LBFactory::getExternalLB() and getConnection().
    Parameters:
    $paramsarray

Reimplemented from JobQueue.

Definition at line 49 of file JobQueueDB.php.


Member Function Documentation

JobQueueDB::claimOldest ( uuid) [protected]

Reserve a row with a single UPDATE without holding row locks over RTTs...

Parameters:
string$uuid32 char hex string
Returns:
Row|false

Definition at line 416 of file JobQueueDB.php.

JobQueueDB::claimRandom ( uuid,
rand,
gte 
) [protected]

Reserve a row with a single UPDATE without holding row locks over RTTs...

Parameters:
string$uuid32 char hex string
$randinteger Random unsigned integer (31 bits)
bool$gteSearch for job_random >= $random (otherwise job_random <= $random)
Returns:
Row|false

Definition at line 340 of file JobQueueDB.php.

JobQueueDB::doAck ( Job job) [protected]
See also:
JobQueue::doAck()
Parameters:
Job$job
Exceptions:
MWException
Returns:
Job|bool

Reimplemented from JobQueue.

Definition at line 477 of file JobQueueDB.php.

JobQueueDB::doBatchPush ( array jobs,
flags 
) [protected]
See also:
JobQueue::doBatchPush()
Parameters:
array$jobs
$flags
Exceptions:
DBError|Exception
Returns:
bool

Reimplemented from JobQueue.

Definition at line 194 of file JobQueueDB.php.

JobQueueDB::doBatchPushInternal ( IDatabase dbw,
array jobs,
flags,
method 
)

This function should *not* be called outside of JobQueueDB.

Parameters:
DatabaseBase$dbw
array$jobs
int$flags
string$method
Returns:
boolean
Exceptions:
type

Definition at line 218 of file JobQueueDB.php.

JobQueueDB::doDeduplicateRootJob ( Job job) [protected]
See also:
JobQueue::doDeduplicateRootJob()
Parameters:
Job$job
Exceptions:
MWException
Returns:
bool

Reimplemented from JobQueue.

Definition at line 507 of file JobQueueDB.php.

JobQueueDB::doDelete ( ) [protected]
See also:
JobQueue::doDelete()
Returns:
bool

Reimplemented from JobQueue.

Definition at line 539 of file JobQueueDB.php.

JobQueueDB::doFlushCaches ( ) [protected]
Returns:
void

Reimplemented from JobQueue.

Definition at line 572 of file JobQueueDB.php.

See also:
JobQueue::doGetAbandonedCount()
Returns:
integer
Exceptions:
MWException

Reimplemented from JobQueue.

Definition at line 155 of file JobQueueDB.php.

See also:
JobQueue::doGetAcquiredCount()
Returns:
integer

Reimplemented from JobQueue.

Definition at line 124 of file JobQueueDB.php.

Returns:
Array

Reimplemented from JobQueue.

Definition at line 560 of file JobQueueDB.php.

JobQueueDB::doGetSiblingQueueSizes ( array types) [protected]
See also:
JobQueue::getSiblingQueuesSize()
Parameters:
array$typesList of queues types
Returns:
array|null (list of queue types) or null if unsupported

Reimplemented from JobQueue.

Definition at line 623 of file JobQueueDB.php.

References $dbr, $res, array(), as, and getSlaveDB().

See also:
JobQueue::getSiblingQueuesWithJobs()
Parameters:
array$typesList of queues types
Returns:
array|null (list of queue types) or null if unsupported

Reimplemented from JobQueue.

Definition at line 611 of file JobQueueDB.php.

References $dbr, $res, array(), as, and getSlaveDB().

JobQueueDB::doGetSize ( ) [protected]
See also:
JobQueue::doGetSize()
Returns:
integer

Reimplemented from JobQueue.

Definition at line 98 of file JobQueueDB.php.

JobQueueDB::doIsEmpty ( ) [protected]
See also:
JobQueue::doIsEmpty()
Returns:
bool

Reimplemented from JobQueue.

Definition at line 71 of file JobQueueDB.php.

JobQueueDB::doPop ( ) [protected]
See also:
JobQueue::doPop()
Returns:
Job|bool

Reimplemented from JobQueue.

Definition at line 281 of file JobQueueDB.php.

See also:
JobQueue::doWaitForBackups()
Returns:
void

Reimplemented from JobQueue.

Definition at line 553 of file JobQueueDB.php.

static JobQueueDB::extractBlob ( blob) [static, protected]
Parameters:
$blob
Returns:
bool|mixed

Definition at line 800 of file JobQueueDB.php.

See also:
JobQueue::getAllQueuedJobs()
Returns:
Iterator

Reimplemented from JobQueue.

Definition at line 582 of file JobQueueDB.php.

JobQueueDB::getCacheKey ( property) [private]
Returns:
string

Definition at line 778 of file JobQueueDB.php.

Do not use this function outside of JobQueue/JobQueueGroup.

Returns:
string
Since:
1.22

Reimplemented from JobQueue.

Definition at line 605 of file JobQueueDB.php.

JobQueueDB::getDB ( index) [protected]
Parameters:
$indexinteger (DB_SLAVE/DB_MASTER)
Returns:
DBConnRef

Definition at line 768 of file JobQueueDB.php.

JobQueueDB::getMasterDB ( ) [protected]
Returns:
DBConnRef

Definition at line 756 of file JobQueueDB.php.

JobQueueDB::getSlaveDB ( ) [protected]
Returns:
DBConnRef

Definition at line 745 of file JobQueueDB.php.

Referenced by doGetSiblingQueueSizes(), and doGetSiblingQueuesWithJobs().

JobQueueDB::insertFields ( Job job) [protected]
Parameters:
$jobJob
Returns:
array

Definition at line 723 of file JobQueueDB.php.

static JobQueueDB::makeBlob ( params) [static, protected]
Parameters:
$params
Returns:
string

Definition at line 788 of file JobQueueDB.php.

JobQueueDB::optimalOrder ( ) [protected]

Get the default queue order to use if configuration does not specify one.

Returns:
string One of (random, timestamp, fifo, undefined)

Reimplemented from JobQueue.

Definition at line 63 of file JobQueueDB.php.

Recycle or destroy any jobs that have been claimed for too long.

Returns:
integer Number of jobs recycled/deleted

Definition at line 640 of file JobQueueDB.php.

JobQueueDB::supportedOrders ( ) [protected]

Get the allowed queue orders for configuration validation.

Returns:
Array Subset of (random, timestamp, fifo, undefined)

Reimplemented from JobQueue.

Definition at line 59 of file JobQueueDB.php.

References array().

JobQueueDB::throwDBException ( DBError e) [protected]
Parameters:
DBError$e
Exceptions:
JobQueueError

Definition at line 812 of file JobQueueDB.php.


Member Data Documentation

BagOStuff JobQueueDB::$cache [protected]

*

Definition at line 37 of file JobQueueDB.php.

JobQueueDB::$cluster = false [protected]

Definition at line 39 of file JobQueueDB.php.

Definition at line 32 of file JobQueueDB.php.

Definition at line 31 of file JobQueueDB.php.

const JobQueueDB::MAX_AGE_PRUNE = 604800

Definition at line 33 of file JobQueueDB.php.

const JobQueueDB::MAX_JOB_RANDOM = 2147483647

Definition at line 34 of file JobQueueDB.php.

Definition at line 35 of file JobQueueDB.php.


The documentation for this class was generated from the following file: