IJobSpecification.php 2.6 KB

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