-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[wip] Filecache chunking #43576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wip] Filecache chunking #43576
Conversation
928fe31 to
367ba8b
Compare
367ba8b to
c77f583
Compare
| * @return $this This QueryBuilder instance. | ||
| */ | ||
| public function from($from, $alias = null) { | ||
| $this->checkTableAccess($from); |
Check failure
Code scanning / Psalm
ImplicitToStringCast
| } | ||
|
|
||
| /** | ||
| * @param List<int> $storages |
Check failure
Code scanning / Psalm
UndefinedDocblockClass
| } | ||
|
|
||
| /** | ||
| * @param List<int> $storages |
Check failure
Code scanning / Psalm
MismatchingDocblockParamType
|
|
||
| /** | ||
| * @param List<int> $storages | ||
| * @return array<int, List<int>> |
Check failure
Code scanning / Psalm
UndefinedDocblockClass
| * The results from the callback will be combined and returned | ||
| * | ||
| * @template T | ||
| * @param List<int> $storages |
Check failure
Code scanning / Psalm
UndefinedDocblockClass
| if (in_array('owner', $requestedFields) || in_array('share_with', $requestedFields) || in_array('share_type', $requestedFields)) { | ||
| $this->equipQueryForShares($query); | ||
| } | ||
| $rawEntries = $this->cacheDatabase->queryStorages($storageIds, function(CacheQueryBuilder $builder, $storages) use ($requestedFields, $searchQuery, $cachesByStorage) { |
Check failure
Code scanning / Psalm
InvalidArgument
| $this->equipQueryForShares($query); | ||
| } | ||
| $rawEntries = $this->cacheDatabase->queryStorages($storageIds, function(CacheQueryBuilder $builder, $storages) use ($requestedFields, $searchQuery, $cachesByStorage) { | ||
| $cachesForShard = array_map(fn (int $storage) => $cachesByStorage[$storage], $storages); |
Check failure
Code scanning / Psalm
InvalidArgument
| $result->closeCursor(); | ||
|
|
||
| return $list; | ||
| return $this->cacheDatabase->queryStorages($storageIds, function(CacheQueryBuilder $qb, array $storages) use ($fileIdsByStorage) { |
Check failure
Code scanning / Psalm
InvalidArgument
| return $this->cacheDatabase->queryStorages($storageIds, function(CacheQueryBuilder $qb, array $storages) use ($fileIdsByStorage) { | ||
| $fileIds = []; | ||
| foreach ($storages as $storage) { | ||
| $fileIds += $fileIdsByStorage[$storage]; | ||
| } | ||
|
|
||
| $qb->select('file_id', 'json', 'sync_token')->from(self::TABLE_METADATA); | ||
| $qb->where( | ||
| $qb->expr()->in('file_id', $qb->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY)) | ||
| ); | ||
|
|
||
| $list = []; | ||
| $result = $qb->executeQuery(); | ||
| while ($data = $result->fetch()) { | ||
| $fileId = (int) $data['file_id']; | ||
| $metadata = new FilesMetadata($fileId); | ||
| try { | ||
| $metadata->importFromDatabase($data); | ||
| } catch (FilesMetadataNotFoundException) { | ||
| continue; | ||
| } | ||
| $list[$fileId] = $metadata; | ||
| } | ||
| return $list; | ||
| }); |
Check failure
Code scanning / Psalm
InvalidArgument
f06b5b8 to
6d4e9c0
Compare
| */ | ||
| public function store(IFilesMetadata $filesMetadata): void { | ||
| $qb = $this->dbConnection->getQueryBuilder(); | ||
| $file = $this->cacheDatabase->getByFileId($filesMetadata->getFileId()); |
Check failure
Code scanning / Psalm
UndefinedMethod
| public function getMetadataFromFileId(int $fileId): IFilesMetadata { | ||
| try { | ||
| $qb = $this->dbConnection->getQueryBuilder(); | ||
| $file = $this->cacheDatabase->getByFileId($fileId); |
Check failure
Code scanning / Psalm
UndefinedMethod
| $list[$fileId] = $metadata; | ||
| public function getMetadataFromFileIds(array $fileIds, array $storageIds = []): array { | ||
| if (!$storageIds) { | ||
| $files = $this->cacheDatabase->getByFileIds($fileIds); |
Check failure
Code scanning / Psalm
UndefinedMethod
| $qb->delete(self::TABLE_METADATA) | ||
| ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); | ||
| $qb->executeStatement(); | ||
| $file = $this->cacheDatabase->getByFileId($fileId); |
Check failure
Code scanning / Psalm
UndefinedMethod
| */ | ||
| public function updateMetadata(IFilesMetadata $filesMetadata): int { | ||
| $qb = $this->dbConnection->getQueryBuilder(); | ||
| $file = $this->cacheDatabase->getByFileId($filesMetadata->getFileId()); |
Check failure
Code scanning / Psalm
UndefinedMethod
6d4e9c0 to
a5d7410
Compare
Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
8aa41af to
adc3d9c
Compare
Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
not as performant but compatible with sharding Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
adc3d9c to
4c6aabf
Compare
| for ($i = 1; $i <= $retryLimit; $i++) { | ||
| try { | ||
| $this->connection->beginTransaction(); | ||
| $this->cacheDb->beginTransaction(); |
Check failure
Code scanning / Psalm
TooFewArguments
| for ($i = 1; $i <= $retryLimit; $i++) { | ||
| try { | ||
| $this->connection->beginTransaction(); | ||
| $this->cacheDb->beginTransaction(); |
Check failure
Code scanning / Psalm
TooFewArguments
| } | ||
|
|
||
| $this->connection->rollBack(); | ||
| $this->cacheDb->rollBack(); |
Check failure
Code scanning / Psalm
TooFewArguments
| } | ||
|
|
||
| $this->connection->rollBack(); | ||
| $this->cacheDb->rollBack(); |
Check failure
Code scanning / Psalm
TooFewArguments
| } | ||
| } else { | ||
| $this->connection->beginTransaction(); | ||
| $this->cacheDb->beginTransaction(); |
Check failure
Code scanning / Psalm
TooFewArguments
| } | ||
| } else { | ||
| $this->connection->beginTransaction(); | ||
| $this->cacheDb->beginTransaction(); |
Check failure
Code scanning / Psalm
TooFewArguments
| foreach ($shares as $share) { | ||
| if (isset($files[$share->getNodeId()])) { | ||
| $cacheItem = $files[$share->getNodeId()]; | ||
| if ($this->isAccessibleResult($cacheItem->getData())) { |
Check failure
Code scanning / Psalm
UndefinedInterfaceMethod
Uh oh!
There was an error while loading. Please reload this page.