MediaWiki  master
JobQueueMemory Class Reference

Class to handle job queues stored in PHP memory for testing. More...

Inheritance diagram for JobQueueMemory:
Collaboration diagram for JobQueueMemory:

Public Member Functions

 __construct (array $params)
 
 getAllAcquiredJobs ()
 
 getAllQueuedJobs ()
 
 jobFromSpecInternal (IJobSpecification $spec)
 
- Public Member Functions inherited from JobQueue
 ack (RunnableJob $job)
 Acknowledge that a job was completed. More...
 
 batchPush (array $jobs, $flags=0)
 Push a batch of jobs into the queue. More...
 
 deduplicateRootJob (IJobSpecification $job)
 Register the "root job" of a given job into the queue for de-duplication. More...
 
 delayedJobsEnabled ()
 
 delete ()
 Delete all unclaimed and delayed jobs from the queue. More...
 
 flushCaches ()
 Clear any process and persistent caches. More...
 
 getAbandonedCount ()
 Get the number of acquired jobs that can no longer be attempted. More...
 
 getAcquiredCount ()
 Get the number of acquired jobs (these are temporarily out of the queue). More...
 
 getAllAbandonedJobs ()
 Get an iterator to traverse over all abandoned jobs in this queue. More...
 
 getAllDelayedJobs ()
 Get an iterator to traverse over all delayed jobs in this queue. More...
 
 getCoalesceLocationInternal ()
 Do not use this function outside of JobQueue/JobQueueGroup. More...
 
 getDelayedCount ()
 Get the number of delayed jobs (these are temporarily out of the queue). More...
 
 getDomain ()
 
 getOrder ()
 
 getReadOnlyReason ()
 
 getSiblingQueueSizes (array $types)
 Check the size of each of the given queues. More...
 
 getSiblingQueuesWithJobs (array $types)
 Check whether each of the given queues are empty. More...
 
 getSize ()
 Get the number of available (unacquired, non-delayed) jobs in the queue. More...
 
 getType ()
 
 getWiki ()
 
 isEmpty ()
 Quickly check if the queue has no available (unacquired, non-delayed) jobs. More...
 
 pop ()
 Pop a job off of the queue. More...
 
 push ( $jobs, $flags=0)
 Push one or more jobs into the queue. More...
 
 waitForBackups ()
 Wait for any replica DBs or backup servers to catch up. More...
 

Protected Member Functions

 doAck (RunnableJob $job)
 
 doBatchPush (array $jobs, $flags)
 
 doDelete ()
 
Stability: stable
to override
See also
JobQueue::delete()
Exceptions
JobQueueError
More...
 
 doGetAcquiredCount ()
 
 doGetSize ()
 
 doIsEmpty ()
 
 doPop ()
 
 optimalOrder ()
 
 supportedOrders ()
 
- Protected Member Functions inherited from JobQueue
 assertNotReadOnly ()
 
 doDeduplicateRootJob (IJobSpecification $job)
 
 doFlushCaches ()
 
 doGetAbandonedCount ()
 
 doGetDelayedCount ()
 
 doGetSiblingQueueSizes (array $types)
 
 doGetSiblingQueuesWithJobs (array $types)
 
 doIsRootJobOldDuplicate (IJobSpecification $job)
 
 doWaitForBackups ()
 
 factoryJob ( $command, $params)
 
 getRootJobCacheKey ( $signature, $type)
 
 incrStats ( $key, $type, $delta=1)
 Call StatsdDataFactoryInterface::updateCount() for the queue overall and for the queue type. More...
 
 isRootJobOldDuplicate (IJobSpecification $job)
 Check if the "root" job of a given job has been superseded by a newer one. More...
 
 supportsDelayedJobs ()
 Find out if delayed jobs are supported for configuration validation. More...
 
 supportsTypeAgnostic ()
 Subclasses should set this to true if they support type agnostic queues. More...
 

Static Protected Attributes

static array[] $data = []
 

Additional Inherited Members

- Static Public Member Functions inherited from JobQueue
static factory (array $params)
 Get a job queue object of the specified type. More...
 
- Protected Attributes inherited from JobQueue
int $claimTTL
 Time to live in seconds. More...
 
string $domain
 DB domain ID. More...
 
GlobalIdGenerator $idGenerator
 
int $maxTries
 Maximum number of times to try a job. More...
 
string $order
 Job priority for pop() More...
 
string bool $readOnlyReason
 Read only rationale (or false if r/w) More...
 
StatsdDataFactoryInterface $stats
 
string $type
 Job type. More...
 
bool $typeAgnostic
 
WANObjectCache $wanCache
 
const QOS_ATOMIC = 1
 
const ROOTJOB_TTL = 2419200
 

Detailed Description

Class to handle job queues stored in PHP memory for testing.

JobQueueGroup does not remember every queue instance, so statically track it here

Since
1.27

Definition at line 31 of file JobQueueMemory.php.

Constructor & Destructor Documentation

◆ __construct()

JobQueueMemory::__construct ( array  $params)
Stability: stable
to call
Parameters
array$params
  • type : A job type, 'default' if typeAgnostic is set
  • domain : A DB domain ID
  • idGenerator : A GlobalIdGenerator instance.
  • wanCache : An instance of WANObjectCache to use for caching [default: none]
  • stats : An instance of StatsdDataFactoryInterface [default: none]
  • claimTTL : Seconds a job can be claimed for exclusive execution [default: forever]
  • maxTries : Total times a job can be tried, assuming claims expire [default: 3]
  • order : Queue order, one of ("fifo", "timestamp", "random") [default: variable]
  • readOnlyReason : Mark the queue as read-only with this reason [default: false]
  • typeAgnostic : If the jobqueue should operate agnostic to the job types
    Exceptions
    JobQueueError

Reimplemented from JobQueue.

Definition at line 35 of file JobQueueMemory.php.

Member Function Documentation

◆ doAck()

JobQueueMemory::doAck ( RunnableJob  $job)
protected
See also
JobQueue::doAck
Parameters
RunnableJob$job

Reimplemented from JobQueue.

Definition at line 148 of file JobQueueMemory.php.

References $job, and JobQueue\getAcquiredCount().

◆ doBatchPush()

JobQueueMemory::doBatchPush ( array  $jobs,
  $flags 
)
protected
See also
JobQueue::doBatchPush
Parameters
IJobSpecification[]$jobs
int$flags

Reimplemented from JobQueue.

Definition at line 47 of file JobQueueMemory.php.

References $job, and serialize().

◆ doDelete()

JobQueueMemory::doDelete ( )
protected

Stability: stable
to override
See also
JobQueue::delete()
Exceptions
JobQueueError

Reimplemented from JobQueue.

Definition at line 160 of file JobQueueMemory.php.

◆ doGetAcquiredCount()

JobQueueMemory::doGetAcquiredCount ( )
protected
See also
JobQueue::doGetAcquiredCount
Returns
int

Reimplemented from JobQueue.

Definition at line 105 of file JobQueueMemory.php.

◆ doGetSize()

JobQueueMemory::doGetSize ( )
protected
See also
JobQueue::doGetSize
Returns
int

Reimplemented from JobQueue.

Definition at line 94 of file JobQueueMemory.php.

Referenced by doIsEmpty(), and doPop().

◆ doIsEmpty()

JobQueueMemory::doIsEmpty ( )
protected
See also
JobQueue::doIsEmpty
Returns
bool

Reimplemented from JobQueue.

Definition at line 85 of file JobQueueMemory.php.

References doGetSize().

◆ doPop()

JobQueueMemory::doPop ( )
protected
See also
JobQueue::doPop
Returns
RunnableJob|bool

Reimplemented from JobQueue.

Definition at line 116 of file JobQueueMemory.php.

References $job, doGetSize(), and jobFromSpecInternal().

◆ getAllAcquiredJobs()

JobQueueMemory::getAllAcquiredJobs ( )
See also
JobQueue::getAllAcquiredJobs
Returns
Iterator of Job objects.

Reimplemented from JobQueue.

Definition at line 193 of file JobQueueMemory.php.

References jobFromSpecInternal().

◆ getAllQueuedJobs()

JobQueueMemory::getAllQueuedJobs ( )
See also
JobQueue::getAllQueuedJobs
Returns
Iterator of Job objects.

Reimplemented from JobQueue.

Definition at line 174 of file JobQueueMemory.php.

References jobFromSpecInternal().

◆ jobFromSpecInternal()

JobQueueMemory::jobFromSpecInternal ( IJobSpecification  $spec)

◆ optimalOrder()

JobQueueMemory::optimalOrder ( )
protected
See also
JobQueue::optimalOrder
Returns
string

Reimplemented from JobQueue.

Definition at line 76 of file JobQueueMemory.php.

◆ supportedOrders()

JobQueueMemory::supportedOrders ( )
protected
See also
JobQueue::supportedOrders
Returns
string[]

Reimplemented from JobQueue.

Definition at line 67 of file JobQueueMemory.php.

Member Data Documentation

◆ $data

array [] JobQueueMemory::$data = []
staticprotected

Definition at line 33 of file JobQueueMemory.php.


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