Merge "Prepare for REL1_33 cut, labelling master as 1.34-alpha"
[lhc/web/wiklou.git] / includes / jobqueue / IJobSpecification.php
1 <?php
2 /**
3 * Job queue task description interface
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 * Interface for serializable objects that describe a job queue task
25 *
26 * A job specification can be inserted into a queue via JobQueue::push().
27 * The specification parameters should be JSON serializable (e.g. no PHP classes).
28 * Whatever queue the job specification is pushed into is assumed to have job runners
29 * that will eventually pop the job specification from the queue, construct a RunnableJob
30 * instance from the specification, and then execute that instance via RunnableJob::run().
31 *
32 * @ingroup JobQueue
33 * @since 1.23
34 */
35 interface IJobSpecification {
36 /**
37 * @return string Job type that defines what sort of changes this job makes
38 */
39 public function getType();
40
41 /**
42 * @return array Parameters that specify sources, targets, and options for execution
43 */
44 public function getParams();
45
46 /**
47 * @return int|null UNIX timestamp to delay running this job until, otherwise null
48 */
49 public function getReleaseTimestamp();
50
51 /**
52 * @return bool Whether only one of each identical set of jobs should be run
53 */
54 public function ignoreDuplicates();
55
56 /**
57 * Subclasses may need to override this to make duplication detection work.
58 * The resulting map conveys everything that makes the job unique. This is
59 * only checked if ignoreDuplicates() returns true, meaning that duplicate
60 * jobs are supposed to be ignored.
61 *
62 * @return array Map of key/values
63 */
64 public function getDeduplicationInfo();
65
66 /**
67 * @see JobQueue::deduplicateRootJob()
68 * @return array
69 * @since 1.26
70 */
71 public function getRootJobParams();
72
73 /**
74 * @see JobQueue::deduplicateRootJob()
75 * @return bool
76 * @since 1.22
77 */
78 public function hasRootJobParams();
79
80 /**
81 * @see JobQueue::deduplicateRootJob()
82 * @return bool Whether this is job is a root job
83 */
84 public function isRootJob();
85 }