diff options
author | Thomas Citharel <tcit@tcit.fr> | 2022-09-01 17:28:18 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-01-18 12:34:30 +0100 |
commit | dd510dfe70782fba38d068e9180fe95cf9bf5a5a (patch) | |
tree | 0949769a9b5a111373a03022984ad07c1f415966 /lib/private/Files/ObjectStore/Swift.php | |
parent | 1334055ab8d07f2a02806dc68235413b72903218 (diff) | |
download | nextcloud-server-instance-quota.tar.gz nextcloud-server-instance-quota.zip |
Allow to mesure free space in object storages, based on used size and quotainstance-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 <tcit@tcit.fr>
Diffstat (limited to 'lib/private/Files/ObjectStore/Swift.php')
-rw-r--r-- | lib/private/Files/ObjectStore/Swift.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php index b463cb9d44d..5a8860a6d51 100644 --- a/lib/private/Files/ObjectStore/Swift.php +++ b/lib/private/Files/ObjectStore/Swift.php @@ -29,6 +29,7 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\BadResponseException; use GuzzleHttp\Psr7\Utils; use Icewind\Streams\RetryWrapper; +use OCP\Files\FileInfo; use OCP\Files\NotFoundException; use OCP\Files\ObjectStore\IObjectStore; use OCP\Files\StorageAuthException; @@ -152,4 +153,12 @@ class Swift implements IObjectStore { 'destination' => $this->getContainer()->name . '/' . $to ]); } + + public function bytesUsed(): int { + return $this->getContainer()->bytesUsed; + } + + public function bytesQuota(): int { + return $this->getContainer()->getMetadata()['Quota-Bytes'] ?? FileInfo::SPACE_UNLIMITED; + } } |