ijoblist.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Robin McCorkell <robin@mccorkell.me.uk>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\BackgroundJob;
  26. /**
  27. * Interface IJobList
  28. *
  29. * @package OCP\BackgroundJob
  30. * @since 7.0.0
  31. */
  32. interface IJobList {
  33. /**
  34. * Add a job to the list
  35. *
  36. * @param \OCP\BackgroundJob\IJob|string $job
  37. * @param mixed $argument The argument to be passed to $job->run() when the job is exectured
  38. * @since 7.0.0
  39. */
  40. public function add($job, $argument = null);
  41. /**
  42. * Remove a job from the list
  43. *
  44. * @param \OCP\BackgroundJob\IJob|string $job
  45. * @param mixed $argument
  46. * @since 7.0.0
  47. */
  48. public function remove($job, $argument = null);
  49. /**
  50. * check if a job is in the list
  51. *
  52. * @param \OCP\BackgroundJob\IJob|string $job
  53. * @param mixed $argument
  54. * @return bool
  55. * @since 7.0.0
  56. */
  57. public function has($job, $argument);
  58. /**
  59. * get all jobs in the list
  60. *
  61. * @return \OCP\BackgroundJob\IJob[]
  62. * @since 7.0.0
  63. * @deprecated 9.0.0 - This method is dangerous since it can cause load and
  64. * memory problems when creating too many instances.
  65. */
  66. public function getAll();
  67. /**
  68. * get the next job in the list
  69. *
  70. * @return \OCP\BackgroundJob\IJob|null
  71. * @since 7.0.0
  72. */
  73. public function getNext();
  74. /**
  75. * @param int $id
  76. * @return \OCP\BackgroundJob\IJob|null
  77. * @since 7.0.0
  78. */
  79. public function getById($id);
  80. /**
  81. * set the job that was last ran to the current time
  82. *
  83. * @param \OCP\BackgroundJob\IJob $job
  84. * @since 7.0.0
  85. */
  86. public function setLastJob($job);
  87. /**
  88. * get the id of the last ran job
  89. *
  90. * @return int
  91. * @since 7.0.0
  92. */
  93. public function getLastJob();
  94. /**
  95. * set the lastRun of $job to now
  96. *
  97. * @param \OCP\BackgroundJob\IJob $job
  98. * @since 7.0.0
  99. */
  100. public function setLastRun($job);
  101. }