ijoblist.php 2.3 KB

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