3 * Job queue task description interface
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.
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.
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
24 * Interface for serializable objects that describe a job queue task
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().
35 interface IJobSpecification
{
37 * @return string Job type that defines what sort of changes this job makes
39 public function getType();
42 * @return array Parameters that specify sources, targets, and options for execution
44 public function getParams();
47 * @return int|null UNIX timestamp to delay running this job until, otherwise null
49 public function getReleaseTimestamp();
52 * @return bool Whether only one of each identical set of jobs should be run
54 public function ignoreDuplicates();
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.
62 * @return array Map of key/values
64 public function getDeduplicationInfo();
67 * @see JobQueue::deduplicateRootJob()
71 public function getRootJobParams();
74 * @see JobQueue::deduplicateRootJob()
78 public function hasRootJobParams();
81 * @see JobQueue::deduplicateRootJob()
82 * @return bool Whether this is job is a root job
84 public function isRootJob();