$this->cluster = isset( $params['cluster'] ) ? $params['cluster'] : false;
}
+ protected function supportedOrders() {
+ return array( 'random', 'timestamp', 'fifo' );
+ }
+
+ protected function optimalOrder() {
+ return 'random';
+ }
+
/**
* @see JobQueue::doIsEmpty()
* @return bool
/**
* Reserve a row with a single UPDATE without holding row locks over RTTs...
*
- * @param $uuid string 32 char hex string
+ * @param string $uuid 32 char hex string
* @param $rand integer Random unsigned integer (31 bits)
- * @param $gte bool Search for job_random >= $random (otherwise job_random <= $random)
+ * @param bool $gte Search for job_random >= $random (otherwise job_random <= $random)
* @return Row|false
*/
protected function claimRandom( $uuid, $rand, $gte ) {
/**
* Reserve a row with a single UPDATE without holding row locks over RTTs...
*
- * @param $uuid string 32 char hex string
+ * @param string $uuid 32 char hex string
* @return Row|false
*/
protected function claimOldest( $uuid ) {
}
}
+ /**
+ * @see JobQueue::getAllQueuedJobs()
+ * @return Iterator
+ */
+ public function getAllQueuedJobs() {
+ list( $dbr, $scope ) = $this->getSlaveDB();
+ return new MappedIterator(
+ $dbr->select( 'job', '*', array( 'job_cmd' => $this->getType(), 'job_token' => '' ) ),
+ function( $row ) use ( $scope ) {
+ $job = Job::factory(
+ $row->job_cmd,
+ Title::makeTitle( $row->job_namespace, $row->job_title ),
+ strlen( $row->job_params ) ? unserialize( $row->job_params ) : false,
+ $row->job_id
+ );
+ $job->id = $row->job_id; // XXX: work around broken subclasses
+ return $job;
+ }
+ );
+ }
+
/**
* @return Array (DatabaseBase, ScopedCallback)
*/