summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-02-19 15:52:58 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2021-03-09 20:31:27 +0100
commitc87b1a50d908f0d99622d4c71534d47af1ab9218 (patch)
tree4677d4a808caa42d1179987536dad749041ecc6c /lib
parent5063745cace4a7ccf219a23eb1b7717d06406707 (diff)
downloadnextcloud-server-c87b1a50d908f0d99622d4c71534d47af1ab9218.tar.gz
nextcloud-server-c87b1a50d908f0d99622d4c71534d47af1ab9218.zip
apply object store copy optimization when 'cross storage' copy is within the same object store
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php14
-rw-r--r--lib/private/Files/Storage/Wrapper/Jail.php2
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 3378f00c4dd..23483b3ab21 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -39,6 +39,7 @@ use OCP\Files\Cache\ICacheEntry;
use OCP\Files\FileInfo;
use OCP\Files\NotFoundException;
use OCP\Files\ObjectStore\IObjectStore;
+use OCP\Files\Storage\IStorage;
class ObjectStoreStorage extends \OC\Files\Storage\Common {
use CopyDirectory;
@@ -530,6 +531,19 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
return $this->objectStore;
}
+ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) {
+ if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) {
+ /** @var ObjectStoreStorage $sourceStorage */
+ if ($sourceStorage->getObjectStore()->getStorageId() === $this->getObjectStore()->getStorageId()) {
+ $sourceEntry = $sourceStorage->getCache()->get($sourceInternalPath);
+ $this->copyInner($sourceEntry, $targetInternalPath);
+ return true;
+ }
+ }
+
+ return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
+ }
+
public function copy($path1, $path2) {
$path1 = $this->normalizePath($path1);
$path2 = $this->normalizePath($path2);
diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php
index b7933708da8..276f00af33c 100644
--- a/lib/private/Files/Storage/Wrapper/Jail.php
+++ b/lib/private/Files/Storage/Wrapper/Jail.php
@@ -48,7 +48,7 @@ class Jail extends Wrapper {
protected $rootPath;
/**
- * @param array $arguments ['storage' => $storage, 'mask' => $root]
+ * @param array $arguments ['storage' => $storage, 'root' => $root]
*
* $storage: The storage that will be wrapper
* $root: The folder in the wrapped storage that will become the root folder of the wrapped storage