Skip to content

Conversation

@CarlSchwan
Copy link
Member

@CarlSchwan CarlSchwan commented Aug 7, 2025

Summary

CustomPropertiesBackend is already able to cache the custom properties of a folder content. But the trash root is not a Directory but instead just a ICollection, so extend CacheEntry to also handle a TrashEntry.

DB queries before (with around 30 entries in trash, around half from a groupfolder):

image

DB queries after:

image

TODO

Checklist

@CarlSchwan CarlSchwan requested a review from a team as a code owner August 7, 2025 10:53
@CarlSchwan CarlSchwan requested review from come-nc, icewind1991 and nfebe and removed request for a team August 7, 2025 10:53
use OCA\DAV\CalDAV\DefaultCalendarValidator;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\Files_Trashbin\Sabre\TrashRoot;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like depending on Files_Trashbin in the dav app, maybe worth creating a new interface that both TrashRoot and Directory inherit? Any name suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ICachableCollection?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMergedCollection? since it is about a dav collection that is created from merging multiple collections

@CarlSchwan CarlSchwan added the 2. developing Work in progress label Aug 7, 2025
@CarlSchwan
Copy link
Member Author

This doesn't work with the group folder app as the content of the trash is stored in __groupfolders/trash/<group-folder-id>/

use OCA\DAV\CalDAV\DefaultCalendarValidator;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\Files_Trashbin\Sabre\TrashRoot;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ICachableCollection?

@come-nc
Copy link
Contributor

come-nc commented Aug 7, 2025

This doesn't work with the group folder app as the content of the trash is stored in __groupfolders/trash/<group-folder-id>/

So it breaks stuff with groupfolders?

@CarlSchwan
Copy link
Member Author

This doesn't work with the group folder app as the content of the trash is stored in __groupfolders/trash/<group-folder-id>/

So it breaks stuff with groupfolders?

doesn't break it but also doesn't fix the similar issue there...

I'm trying to rethink a bit how to do it so that it works for every trash backend

@CarlSchwan CarlSchwan marked this pull request as draft August 7, 2025 13:35
@CarlSchwan CarlSchwan force-pushed the scale-propfind-trash branch from e574092 to 9df9b4a Compare August 8, 2025 08:43
@CarlSchwan CarlSchwan added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 8, 2025
@CarlSchwan CarlSchwan marked this pull request as ready for review August 8, 2025 08:48
@CarlSchwan
Copy link
Member Author

This doesn't work with the group folder app as the content of the trash is stored in __groupfolders/trash/<group-folder-id>/

So it breaks stuff with groupfolders?

doesn't break it but also doesn't fix the similar issue there...

I'm trying to rethink a bit how to do it so that it works for every trash backend

Found a solution, this adds a method to the ITrashBackend branch. I'm not sure it is allowed as it is an API break but then it's also in OCA and not OCP and we release the groupfolder app at the same time as server. Worst case, I can just add an interface :)

@CarlSchwan CarlSchwan force-pushed the scale-propfind-trash branch 2 times, most recently from 9c07e5a to 0d37a55 Compare August 11, 2025 08:41
* @return Folder[]
* @since 32.0.0
*/
public function getTrashRootsForUser(IUser $user): array;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would encode further assumptions about how trash items are stored. If we ever want to expose "deleted but versioned" s3 objects or deleted items from filesystem snapshots this could be problematic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I wonder if there is a better way to do it. the list of Folder is really only used for pre-caching them and does not necessarily need to be exhaustive for this usecase

@github-actions

This comment was marked as off-topic.

@CarlSchwan CarlSchwan force-pushed the scale-propfind-trash branch 2 times, most recently from 3938b32 to 684df76 Compare August 22, 2025 10:10
Carl Schwan added 3 commits September 12, 2025 16:16
CustomPropertiesBackend is already able to cache the custom properties
of a folder content. But the trash root is not a Directory but instead
just a ICollection, so extend CacheEntry to also handle a TrashEntry.

Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
That interface can be implemented by any ICollection that is based on
one or multiple \OCP\Files\Folder to pre-fetch the custom properties.

Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
Introduze a LazyMountPoint which is similar to LazyFile/LazyFolder and
allow to avoid doing DB request when we just want the storage id and we
already have it.

Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants