nextcloud/lib/public/TaskProcessing/ISynchronousProgressiveProvider.php
Julien Veyssier 172423f3d6
feat(task-streaming): allow the Php providers to set intermediate results with a callback in process
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2026-06-05 15:17:12 +02:00

36 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\TaskProcessing;
use OCP\Files\File;
use OCP\TaskProcessing\Exception\ProcessingException;
/**
* This is the interface that is implemented by apps that
* implement a task processing provider that supports updating the output during processing
* @since 34.0.0
*/
interface ISynchronousProgressiveProvider extends ISynchronousProvider {
/**
* Returns the shape of optional output parameters
*
* @param null|string $userId The user that created the current task
* @param array<string, list<numeric|string|File>|numeric|string|File> $input The task input
* @param callable(float):bool $reportProgress Report the task progress. If this returns false, that means the task was cancelled and processing should be stopped.
* @param null|callable(array):bool $reportOutput Set the task intermediate output
* @psalm-return array<string, list<numeric|string>|numeric|string>
* @throws ProcessingException
* @since 33.0.0
*/
#[\Override]
public function process(?string $userId, array $input, callable $reportProgress, ?callable $reportOutput = null): array;
}