IChunkedFileWrite.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 string $targetPath
  22. * @param string $writeToken
  23. * @param string $chunkId
  24. * @param resource $data
  25. * @param int|null $size
  26. * @throws GenericFileException
  27. * @since 26.0.0
  28. */
  29. public function putChunkedWritePart(string $targetPath, string $writeToken, string $chunkId, $data, ?int $size = null): ?array;
  30. /**
  31. * @param string $targetPath
  32. * @param string $writeToken
  33. * @return int
  34. * @throws GenericFileException
  35. * @since 26.0.0
  36. */
  37. public function completeChunkedWrite(string $targetPath, string $writeToken): int;
  38. /**
  39. * @param string $targetPath
  40. * @param string $writeToken
  41. * @throws GenericFileException
  42. * @since 26.0.0
  43. */
  44. public function cancelChunkedWrite(string $targetPath, string $writeToken): void;
  45. }