You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.1 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Daniel Kesselberg <mail@danielkesselberg.de>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Lukas Reschke <lukas@statuscode.ch>
  9. * @author Morris Jobke <hey@morrisjobke.de>
  10. * @author Robin Appelman <robin@icewind.nl>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCP\BackgroundJob;
  28. use OCP\ILogger;
  29. /**
  30. * Interface IJob
  31. *
  32. * @since 7.0.0
  33. */
  34. interface IJob {
  35. /**
  36. * Run the background job with the registered argument
  37. *
  38. * @param IJobList $jobList The job list that manages the state of this job
  39. * @param ILogger|null $logger
  40. * @since 7.0.0
  41. */
  42. public function execute(IJobList $jobList, ILogger $logger = null);
  43. /**
  44. * @since 7.0.0
  45. */
  46. public function setId(int $id);
  47. /**
  48. * @since 7.0.0
  49. */
  50. public function setLastRun(int $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. }