Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/ObjectStore/Swift.php')
-rw-r--r--lib/private/Files/ObjectStore/Swift.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php
index 1ce4312af2b..87347c3f71b 100644
--- a/lib/private/Files/ObjectStore/Swift.php
+++ b/lib/private/Files/ObjectStore/Swift.php
@@ -33,6 +33,8 @@ use OCP\Files\NotFoundException;
use OCP\Files\ObjectStore\IObjectStore;
use OCP\Files\StorageAuthException;
+const SWIFT_SEGMENT_SIZE = 1073741824; // 1GB
+
class Swift implements IObjectStore {
/**
* @var array
@@ -81,10 +83,18 @@ class Swift implements IObjectStore {
file_put_contents($tmpFile, $stream);
$handle = fopen($tmpFile, 'rb');
- $this->getContainer()->createObject([
- 'name' => $urn,
- 'stream' => stream_for($handle)
- ]);
+ if (filesize($tmpFile) < SWIFT_SEGMENT_SIZE) {
+ $this->getContainer()->createObject([
+ 'name' => $urn,
+ 'stream' => stream_for($handle)
+ ]);
+ } else {
+ $this->getContainer()->createLargeObject([
+ 'name' => $urn,
+ 'stream' => stream_for($handle),
+ 'segmentSize' => SWIFT_SEGMENT_SIZE
+ ]);
+ }
}
/**