IJob.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <robin@icewind.nl>
  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. use OCP\ILogger;
  27. /**
  28. * Interface IJob
  29. *
  30. * @package OCP\BackgroundJob
  31. * @since 7.0.0
  32. */
  33. interface IJob {
  34. /**
  35. * Run the background job with the registered argument
  36. *
  37. * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job
  38. * @param ILogger|null $logger
  39. * @since 7.0.0
  40. */
  41. public function execute($jobList, ILogger $logger = null);
  42. /**
  43. * @param int $id
  44. * @since 7.0.0
  45. */
  46. public function setId($id);
  47. /**
  48. * @param int $lastRun
  49. * @since 7.0.0
  50. */
  51. public function setLastRun($lastRun);
  52. /**
  53. * @param mixed $argument
  54. * @since 7.0.0
  55. */
  56. public function setArgument($argument);
  57. /**
  58. * Get the id of the background job
  59. * This id is determined by the job list when a job is added to the list
  60. *
  61. * @return int
  62. * @since 7.0.0
  63. */
  64. public function getId();
  65. /**
  66. * Get the last time this job was run as unix timestamp
  67. *
  68. * @return int
  69. * @since 7.0.0
  70. */
  71. public function getLastRun();
  72. /**
  73. * Get the argument associated with the background job
  74. * This is the argument that will be passed to the background job
  75. *
  76. * @return mixed
  77. * @since 7.0.0
  78. */
  79. public function getArgument();
  80. }