diff options
author | Robin Appelman <robin@icewind.nl> | 2020-03-27 19:47:20 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-04-20 16:45:04 +0300 |
commit | 9735b5d61f8577fea01810b5de3e1dab2ec6c77e (patch) | |
tree | c4e9d71dae03a4d49eec41fe09ec07243e355e83 /apps/files_sharing/lib | |
parent | b1a90da34730a6c119df4cb5b992177d8dbedeca (diff) |
Add method to storage backends to get directory content with metadata
Currently you need to use `opendir` and then call `getMetadata` for
every file, which adds overhead because most storage backends already
get the metadata when doing the `opendir`.
While storagebackends can (and do) use caching to relief this problem,
this adds cache invalidation dificulties and only a limited number of
items are generally cached (to prevent memory usage exploding when
scanning large storages)
With this new methods storage backends can use the child metadata they
got from listing the folder to return metadata without having to keep
seperate caches.
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/External/Scanner.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/Scanner.php | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/External/Scanner.php b/apps/files_sharing/lib/External/Scanner.php index 8962bb68c07..ebe0361c989 100644 --- a/apps/files_sharing/lib/External/Scanner.php +++ b/apps/files_sharing/lib/External/Scanner.php @@ -57,7 +57,7 @@ class Scanner extends \OC\Files\Cache\Scanner { * @param bool $lock set to false to disable getting an additional read lock during scanning * @return array an array of metadata of the scanned file */ - public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) { + public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { try { return parent::scanFile($file, $reuseExisting); } catch (ForbiddenException $e) { diff --git a/apps/files_sharing/lib/Scanner.php b/apps/files_sharing/lib/Scanner.php index 7115b602aed..36a412800e5 100644 --- a/apps/files_sharing/lib/Scanner.php +++ b/apps/files_sharing/lib/Scanner.php @@ -71,7 +71,7 @@ class Scanner extends \OC\Files\Cache\Scanner { } } - public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) { + public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { $sourceScanner = $this->getSourceScanner(); if ($sourceScanner instanceof NoopScanner) { return []; |