3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
22 * Interface for serializable objects that describe a job queue task
24 * A job specification can be inserted into a queue via JobQueue::push().
25 * The specification parameters should be JSON serializable (e.g. no PHP classes).
26 * Whatever queue the job specification is pushed into is assumed to have job runners
27 * that will eventually pop the job specification from the queue, construct a RunnableJob
28 * instance from the specification, and then execute that instance via RunnableJob::run().
30 * Job classes must have a constructor that takes a Title and a parameter array, except
31 * when they also implement GenericParameterJob in which case they must only take an array.
32 * When reconstructing the job from the job queue, the value returned from getParams() will
33 * be passed in as the constructor's array parameter; the title will be constructed from
34 * the parameter array's `namespace` and `title` fields (when these are omitted, some
35 * fallback title will be used).
40 interface IJobSpecification
{
42 * @return string Job type that defines what sort of changes this job makes
44 public function getType();
47 * @return array Parameters that specify sources, targets, and options for execution
49 public function getParams();
52 * @return int|null UNIX timestamp to delay running this job until, otherwise null
54 public function getReleaseTimestamp();
57 * @return bool Whether only one of each identical set of jobs should be run
59 public function ignoreDuplicates();
62 * Subclasses may need to override this to make duplication detection work.
63 * The resulting map conveys everything that makes the job unique. This is
64 * only checked if ignoreDuplicates() returns true, meaning that duplicate
65 * jobs are supposed to be ignored.
67 * @return array Map of key/values
69 public function getDeduplicationInfo();
72 * @see JobQueue::deduplicateRootJob()
76 public function getRootJobParams();
79 * @see JobQueue::deduplicateRootJob()
83 public function hasRootJobParams();
86 * @see JobQueue::deduplicateRootJob()
87 * @return bool Whether this is job is a root job
89 public function isRootJob();