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