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.

IJob.php 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. * @since 24.0.0
  37. */
  38. public const TIME_INSENSITIVE = 0;
  39. /**
  40. * @since 24.0.0
  41. */
  42. public const TIME_SENSITIVE = 1;
  43. /**
  44. * Run the background job with the registered argument
  45. *
  46. * @param IJobList $jobList The job list that manages the state of this job
  47. * @param ILogger|null $logger
  48. * @since 7.0.0
  49. */
  50. public function execute(IJobList $jobList, ILogger $logger = null);
  51. /**
  52. * @since 7.0.0
  53. */
  54. public function setId(int $id);
  55. /**
  56. * @since 7.0.0
  57. */
  58. public function setLastRun(int $lastRun);
  59. /**
  60. * @param mixed $argument
  61. * @since 7.0.0
  62. */
  63. public function setArgument($argument);
  64. /**
  65. * Get the id of the background job
  66. * This id is determined by the job list when a job is added to the list
  67. *
  68. * @return int
  69. * @since 7.0.0
  70. */
  71. public function getId();
  72. /**
  73. * Get the last time this job was run as unix timestamp
  74. *
  75. * @return int
  76. * @since 7.0.0
  77. */
  78. public function getLastRun();
  79. /**
  80. * Get the argument associated with the background job
  81. * This is the argument that will be passed to the background job
  82. *
  83. * @return mixed
  84. * @since 7.0.0
  85. */
  86. public function getArgument();
  87. }