IChunkedFileWrite.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. declare(strict_types=1);
  7. namespace OCP\Files\Storage;
  8. use OCP\Files\GenericFileException;
  9. /**
  10. * @since 26.0.0
  11. */
  12. interface IChunkedFileWrite extends IStorage {
  13. /**
  14. * @param string $targetPath Relative target path in the storage
  15. * @return string writeToken to be used with the other methods to uniquely identify the file write operation
  16. * @throws GenericFileException
  17. * @since 26.0.0
  18. */
  19. public function startChunkedWrite(string $targetPath): string;
  20. /**
  21. * @param resource $data
  22. * @throws GenericFileException
  23. * @since 26.0.0
  24. */
  25. public function putChunkedWritePart(string $targetPath, string $writeToken, string $chunkId, $data, ?int $size = null): ?array;
  26. /**
  27. * @throws GenericFileException
  28. * @since 26.0.0
  29. */
  30. public function completeChunkedWrite(string $targetPath, string $writeToken): int;
  31. /**
  32. * @throws GenericFileException
  33. * @since 26.0.0
  34. */
  35. public function cancelChunkedWrite(string $targetPath, string $writeToken): void;
  36. }