From dd510dfe70782fba38d068e9180fe95cf9bf5a5a Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 1 Sep 2022 17:28:18 +0200 Subject: Allow to mesure free space in object storages, based on used size and quota If the object storage backend doesn't return quota or used bytes information, use a config override for the quota and count the size used in Nextcloud instead. Signed-off-by: Thomas Citharel --- tests/lib/Files/ObjectStore/FailDeleteObjectStore.php | 9 +++++++++ tests/lib/Files/ObjectStore/FailWriteObjectStore.php | 9 +++++++++ 2 files changed, 18 insertions(+) (limited to 'tests/lib/Files/ObjectStore') diff --git a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php index 5160abe574f..27ef3e6dd88 100644 --- a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php +++ b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace Test\Files\ObjectStore; +use OCP\Files\FileInfo; use OCP\Files\ObjectStore\IObjectStore; class FailDeleteObjectStore implements IObjectStore { @@ -55,4 +56,12 @@ class FailDeleteObjectStore implements IObjectStore { public function copyObject($from, $to) { $this->objectStore->copyObject($from, $to); } + + public function bytesUsed(): int { + return FileInfo::SPACE_UNKNOWN; + } + + public function bytesQuota(): int { + return FileInfo::SPACE_UNLIMITED; + } } diff --git a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php index 559d004cd0c..203333f09e4 100644 --- a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php +++ b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace Test\Files\ObjectStore; +use OCP\Files\FileInfo; use OCP\Files\ObjectStore\IObjectStore; class FailWriteObjectStore implements IObjectStore { @@ -56,4 +57,12 @@ class FailWriteObjectStore implements IObjectStore { public function copyObject($from, $to) { $this->objectStore->copyObject($from, $to); } + + public function bytesUsed(): int { + return FileInfo::SPACE_UNKNOWN; + } + + public function bytesQuota(): int { + return FileInfo::SPACE_UNLIMITED; + } } -- cgit v1.2.3