Skip to content

feat(sharing): look up the shares of many files at once - #65497

Draft
skjnldsv wants to merge 2 commits into
feature/node-attribute-sharesfrom
feature/share-lookup-by-file-ids
Draft

skjnldsv wants to merge 2 commits into
feature/node-attribute-sharesfrom
feature/share-lookup-by-file-ids

Conversation

@skjnldsv

Copy link
Copy Markdown
Member

Summary

IManager::getSharesByNodes() and getSharedWithByNodes() return the shares of a list of nodes, the same as calling getSharesBy() and getSharedWith() for each node. Share providers implementing the new IShareProviderSupportsFileIds answer with one query for all the files: the default, mail and federated providers do. Other providers (Talk, Circles, Deck) are still asked file by file until they implement it.

SharesProvider from #65400 uses it, so share-types and sharees cost 13 queries on the share table for any number of nodes instead of 13 per node. Folder listings keep getSharesInFolder().

Measured on an account with 70k files and 5,500 received shares, median of 5 rounds:

  • nodes API, 20 files: 372 ms → 193 ms, 286 → 96 queries
  • Recent view (100 files): 5.8 s → 4.8 s, 993 → 13 queries on the share table
  • sidebar, folder listings, Favorites: unchanged

The answers are the same as before for all 31 Files app properties, compared on Recent, Favorites, listings and single files. A DB test checks the bulk lookup against the per-file calls.

ManagerTest, DefaultShareProviderTest, sharebymail, federatedfilesharing, dav and files_sharing Controller tests pass locally. Psalm not run locally.

TODO

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

@skjnldsv skjnldsv added this to the Nextcloud 36 milestone Oct 14, 2026
@skjnldsv skjnldsv self-assigned this Oct 14, 2026
@skjnldsv
skjnldsv force-pushed the feature/share-lookup-by-file-ids branch from 07e5260 to 6588755 Compare October 15, 2026 07:17
IManager::getSharesByNodes() and getSharedWithByNodes() return the
shares of a list of nodes, the same as calling getSharesBy() and
getSharedWith() for each node. Share providers implementing
IShareProviderSupportsFileIds answer with one query for all the files,
the default, mail and federated providers do. Other providers are still
asked file by file.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv
skjnldsv force-pushed the feature/node-attribute-shares branch from 6b20b0a to 36ce3a2 Compare October 16, 2026 16:15
@skjnldsv
skjnldsv force-pushed the feature/share-lookup-by-file-ids branch from 6588755 to d33c068 Compare October 16, 2026 16:15

This branch has not been deployed

No deployments
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.

1 participant