summaryrefslogtreecommitdiff
path: root/src/classes/Job.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-05-07 23:39:20 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-05-07 23:39:30 +0300
commit9a98ac50ff50dda2f2eed1ea825352c50c64440e (patch)
treecc5c7d36eee1ec934f8728e7f9104a9d2d760856 /src/classes/Job.php
initial
Diffstat (limited to 'src/classes/Job.php')
-rw-r--r--src/classes/Job.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/classes/Job.php b/src/classes/Job.php
new file mode 100644
index 0000000..4ecbf6c
--- /dev/null
+++ b/src/classes/Job.php
@@ -0,0 +1,51 @@
+<?php
+
+abstract class Job extends model {
+
+ // ENUM status
+ const STATUS_WAITING = 'waiting';
+ const STATUS_MANUAL = 'manual';
+ const STATUS_ACCEPTED = 'accepted';
+ const STATUS_IGNORED = 'ignored';
+ const STATUS_RUNNING = 'running';
+ const STATUS_DONE = 'done';
+
+ // ENUM result
+ const RESULT_OK = 'ok';
+ const RESULT_FAIL = 'fail';
+
+ const DB_TABLE = 'jobs';
+
+ protected static $Fields = [
+ 'id' => model::INTEGER,
+ 'target' => model::STRING,
+ 'name' => model::STRING,
+ 'time_created' => model::INTEGER,
+ 'time_started' => model::INTEGER,
+ 'time_finished' => model::INTEGER,
+ 'status' => model::STRING, // ENUM
+ 'result' => model::STRING, // ENUM
+ 'return_code' => model::INTEGER,
+ 'sig' => model::STRING,
+ 'stdout' => model::STRING,
+ 'stderr' => model::STRING,
+ 'input' => model::SERIALIZED,
+ ];
+
+ public $id;
+ public $target;
+ public $name;
+ public $timeCreated;
+ public $timeStarted;
+ public $timeFinished;
+ public $status;
+ public $result;
+ public $returnCode;
+ public $sig;
+ public $stdout;
+ public $stderr;
+ public $input;
+
+ abstract public function run();
+
+} \ No newline at end of file