diff options
-rw-r--r-- | lib/private/backgroundjob/joblist.php | 6 | ||||
-rw-r--r-- | lib/public/backgroundjob/ijob.php | 21 | ||||
-rw-r--r-- | lib/public/backgroundjob/ijoblist.php | 10 |
3 files changed, 31 insertions, 6 deletions
diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index 6b0df9e0d63..5ec81dc3fc6 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com> + * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -8,7 +8,9 @@ namespace OC\BackgroundJob; -class JobList { +use OCP\BackgroundJob\IJobList; + +class JobList implements IJobList { /** * @var \OCP\IDBConnection */ diff --git a/lib/public/backgroundjob/ijob.php b/lib/public/backgroundjob/ijob.php index 5bf815ef8e0..5231e9537a9 100644 --- a/lib/public/backgroundjob/ijob.php +++ b/lib/public/backgroundjob/ijob.php @@ -10,14 +10,33 @@ namespace OCP\BackgroundJob; interface IJob { /** - * @param \OCP\BackgroundJob\IJobList $jobList + * Run the background job with the registered argument + * + * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job * @param \OC\Log $logger */ public function execute($jobList, $logger = null); + /** + * Get the id of the background job + * This id is determined by the job list when a job is added to the list + * + * @return int + */ public function getId(); + /** + * Get the last time this job was run as unix timestamp + * + * @return int + */ public function getLastRun(); + /** + * Get the argument associated with the background job + * This is the argument that will be passed to the background job + * + * @return mixed + */ public function getArgument(); } diff --git a/lib/public/backgroundjob/ijoblist.php b/lib/public/backgroundjob/ijoblist.php index 7e80d51755b..72f3fe863da 100644 --- a/lib/public/backgroundjob/ijoblist.php +++ b/lib/public/backgroundjob/ijoblist.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com> + * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -10,12 +10,16 @@ namespace OCP\BackgroundJob; interface IJobList { /** + * Add a job to the list + * * @param \OCP\BackgroundJob\IJob |string $job - * @param mixed $argument + * @param mixed $argument The argument to be passed to $job->run() when the job is exectured */ public function add($job, $argument = null); /** + * Remove a job from the list + * * @param \OCP\BackgroundJob\IJob|string $job * @param mixed $argument */ @@ -51,7 +55,7 @@ interface IJobList { public function getById($id); /** - * set the job that was last ran + * set the job that was last ran to the current time * * @param \OCP\BackgroundJob\IJob $job */ |