Merge "Document $rows on hook ChangesListInitRows as IResultWrapper"
[lhc/web/wiklou.git] / includes / jobqueue / RunnableJob.php
1 <?php
2 /**
3 * Job queue task instance that can be executed via a run() method
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 */
22
23 /**
24 * Job that has a run() method and metadata accessors for JobQueue::pop() and JobQueue::ack()
25 *
26 * Instances are not only enqueueable via JobQueue::push(), but they can also be executed by
27 * by calling their run() method. When constructing a job to be enqueued via JobQueue::push(),
28 * it will not be possible to construct a RunnableJob instance if the class for that job is not
29 * loaded by the application for the local DB domain. In that case, the general-purpose
30 * JobSpecification class can be used instead.
31 *
32 * @ingroup JobQueue
33 * @since 1.33
34 */
35 interface RunnableJob extends IJobSpecification {
36 /**
37 * Run the job
38 * @return bool Success
39 */
40 public function run();
41
42 /**
43 * @param string|null $field Metadata field or null to get all the metadata
44 * @return mixed|null Value; null if missing
45 */
46 public function getMetadata( $field = null );
47
48 /**
49 * @param string $field Key name to set the value for
50 * @param mixed $value The value to set the field for
51 * @return mixed|null The prior field value; null if missing
52 */
53 public function setMetadata( $field, $value );
54 }