Skip to content

Refactor share backend to be more efficient#58365

Closed
CarlSchwan wants to merge 2 commits intomasterfrom
carl/refactor-share
Closed

Refactor share backend to be more efficient#58365
CarlSchwan wants to merge 2 commits intomasterfrom
carl/refactor-share

Conversation

@CarlSchwan
Copy link
Member

@CarlSchwan CarlSchwan commented Feb 16, 2026

Summary

Instead of making queries in each providers, do it once in the manager depending on the providers enabled and then only create the share objects in the share providers.

Additionally introduce a new API for iterating not based on offset but on max_id, min_id

TODO

  • Make it work xD

Checklist

First check which users have a shares and for which providers and then
only load these shares.

Avoid doing at most 5 SQL queries for each users a share was shared with if
there are no shares.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
- Fetch share from various providers at once by providing a new
  interface for providers to create their share based on raw data from
  the database
- Use more efficient key-based pagination instead of offset-based
  pagination

Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan changed the title Carl/refactor share Refactor share backend to be more efficient Feb 25, 2026
@icewind1991
Copy link
Member

For dealing with provider specific logic, such as the per-user child shares for groups/teams/etc. It might be worth looking at how the filecache search does it.

It allows the cache instance to customize the filtering by overriding Cache::getQueryFilterForStorage.

So instead of implementing the various share filtering options in the share manager, we could have something like IShareProvider::getSharedWithFilter(IUser $user, IQueryBuilder $builder) etc.
The provider can then do all the custom logic it needs (like figure out the groups for a user) and build the query part.
The share manager then combines all the query parts in an orX to fetch everything at once.

@CarlSchwan
Copy link
Member Author

Internal discussion: This is helpful but we are planing to overhaul/rewrite sharing for 34 and the new implementation will be build from the ground up without this limitation

@CarlSchwan CarlSchwan closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants