getRetries(). If 0, it is the initial attempt. If > 0, it seeks a retry output. * * @param Task $task * @param string $output * @param string $errors * @param int $statusCode * @return bool * @throws TasksException */ public function writeTaskOutput(Task $task, string $output, string $errors, int $statusCode): bool; /** * Write the output of the postHandler into TaskStorage * * $attempt refers to $task->getRetries(). If 0, it is the initial attempt. If > 0, it seeks a retry output. * * @param Task $task * @param string $output * @param string $errors * @param int $statusCode * @return bool * @throws TasksException */ public function writePostOutput(Task $task, string $output, string $errors, int $statusCode): bool; /** * Read the task output from taskStorage. * * The following output is expected: * array('output' => string $output, 'errors' => string $errors, 'status' => $code) * OR null if not found (yet) * * Attempt refers to the attempt that the task has ran and that individual output. * If > 0, the output as mentioned above will be returned. If = 0, an array of such outputs will be returned. * * Returns null because that is a very valid response. Oftentimes output will need to be checked and its undesirable * to always throw an exception for expected behaviour. * * @param Task $task * @param int $attempt * @return array|null */ public function readTaskOutput(Task $task, int $attempt = 0): ?array; /** * Read the output from the postHandler * * The following output is expected: * array('output' => string $output, 'errors' => string $errors, 'status' => $code) * OR null if not found (yet) * * Attempt refers to the attempt that the task has ran and that individual output. * If > 0, the output as mentioned above will be returned. If = 0, an array of such outputs will be returned. * * Returns null because that is a very valid response. Oftentimes output will need to be checked and its undesirable * to always throw an exception for expected behaviour. * * @param Task $task * @param int $attempt * @return array|null */ public function readPostOutput(Task $task, int $attempt = 0): ?array; /** * Reset the TaskStorage. * * Remove all tasks and their output from the storage so the TaskStorage begins anew. * * @return bool */ public function reset(): bool; }