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.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. *
  7. * @copyright Copyright (c) 2016, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCP\BackgroundJob;
  24. use OCP\ILogger;
  25. /**
  26. * Interface IJob
  27. *
  28. * @package OCP\BackgroundJob
  29. * @since 7.0.0
  30. */
  31. interface IJob {
  32. /**
  33. * Run the background job with the registered argument
  34. *
  35. * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job
  36. * @param ILogger $logger
  37. * @since 7.0.0
  38. */
  39. public function execute($jobList, ILogger $logger = null);
  40. /**
  41. * @param int $id
  42. * @since 7.0.0
  43. */
  44. public function setId($id);
  45. /**
  46. * @param int $lastRun
  47. * @since 7.0.0
  48. */
  49. public function setLastRun($lastRun);
  50. /**
  51. * @param mixed $argument
  52. * @since 7.0.0
  53. */
  54. public function setArgument($argument);
  55. /**
  56. * Get the id of the background job
  57. * This id is determined by the job list when a job is added to the list
  58. *
  59. * @return int
  60. * @since 7.0.0
  61. */
  62. public function getId();
  63. /**
  64. * Get the last time this job was run as unix timestamp
  65. *
  66. * @return int
  67. * @since 7.0.0
  68. */
  69. public function getLastRun();
  70. /**
  71. * Get the argument associated with the background job
  72. * This is the argument that will be passed to the background job
  73. *
  74. * @return mixed
  75. * @since 7.0.0
  76. */
  77. public function getArgument();
  78. }