aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files/ObjectStore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Files/ObjectStore')
-rw-r--r--lib/public/Files/ObjectStore/IObjectStore.php27
-rw-r--r--lib/public/Files/ObjectStore/IObjectStoreMetaData.php47
-rw-r--r--lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php40
3 files changed, 92 insertions, 22 deletions
diff --git a/lib/public/Files/ObjectStore/IObjectStore.php b/lib/public/Files/ObjectStore/IObjectStore.php
index a202ef7c0c2..35099ef8ba8 100644
--- a/lib/public/Files/ObjectStore/IObjectStore.php
+++ b/lib/public/Files/ObjectStore/IObjectStore.php
@@ -1,26 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCP\Files\ObjectStore;
@@ -54,7 +37,7 @@ interface IObjectStore {
* @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0
*/
- public function writeObject($urn, $stream, string $mimetype = null);
+ public function writeObject($urn, $stream, ?string $mimetype = null);
/**
* @param string $urn the unified resource name used to identify the object
diff --git a/lib/public/Files/ObjectStore/IObjectStoreMetaData.php b/lib/public/Files/ObjectStore/IObjectStoreMetaData.php
new file mode 100644
index 00000000000..9683873be36
--- /dev/null
+++ b/lib/public/Files/ObjectStore/IObjectStoreMetaData.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+namespace OCP\Files\ObjectStore;
+
+/**
+ * Interface IObjectStoreMetaData
+ *
+ * @psalm-type ObjectMetaData = array{mtime?: \DateTime, etag?: string, size?: int, mimetype?: string, filename?: string, original-path?: string, original-storage?: string}
+ *
+ * @since 32.0.0
+ */
+interface IObjectStoreMetaData {
+ /**
+ * Get metadata for an object.
+ *
+ * @param string $urn
+ * @return ObjectMetaData
+ *
+ * @since 32.0.0
+ */
+ public function getObjectMetaData(string $urn): array;
+
+ /**
+ * List all objects in the object store.
+ *
+ * If the object store implementation can do it efficiently, the metadata for each object is also included.
+ *
+ * @param string $prefix
+ * @return \Iterator<array{urn: string, metadata: ?ObjectMetaData}>
+ *
+ * @since 32.0.0
+ */
+ public function listObjects(string $prefix = ''): \Iterator;
+
+ /**
+ * @param string $urn the unified resource name used to identify the object
+ * @param resource $stream stream with the data to write
+ * @param ObjectMetaData $metaData the metadata to set for the object
+ * @throws \Exception when something goes wrong, message will be logged
+ * @since 32.0.0
+ */
+ public function writeObjectWithMetaData(string $urn, $stream, array $metaData): void;
+}
diff --git a/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php b/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php
new file mode 100644
index 00000000000..7989e27dfc8
--- /dev/null
+++ b/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php
@@ -0,0 +1,40 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\ObjectStore;
+
+use Aws\Result;
+
+/**
+ * @since 26.0.0
+ */
+interface IObjectStoreMultiPartUpload {
+ /**
+ * @since 26.0.0
+ */
+ public function initiateMultipartUpload(string $urn): string;
+
+ /**
+ * @since 26.0.0
+ */
+ public function uploadMultipartPart(string $urn, string $uploadId, int $partId, $stream, $size): Result;
+
+ /**
+ * @since 26.0.0
+ */
+ public function completeMultipartUpload(string $urn, string $uploadId, array $result): int;
+
+ /**
+ * @since 26.0.0
+ */
+ public function abortMultipartUpload(string $urn, string $uploadId): void;
+
+ /**
+ * @since 26.0.0
+ */
+ public function getMultipartUploads(string $urn, string $uploadId): array;
+}