cs3org / reva

WebDAV/gRPC/HTTP high performance server to link high level clients to storage backends
https://reva.link
Apache License 2.0
167 stars 113 forks source link

make share manager single source of truth #2001

Open butonic opened 3 years ago

butonic commented 3 years ago

Sharing

This document proposes changes on managing and accessing shares in reva. The goal is to streamline the information and make the process more robust.

Summary

Current implementation

Basic information about shares - i.e. who shared what with whom - are currently managed by the share manager. Additional information such as the names and the mountpoints of the shares are physically kept on the storage as references in the according locations and those references are being maintained by the storage providers.

This split of information makes it difficult to gather the mountpoints of all shares of user and is prone to inconcistencies between the data in the share manager and on the storage.

Proposed change

With this proposal shares will no longer be "mounted" on the storage. Instead the names and mountpoints move into the share manager alongside the basic share information and all references disappear from the storage (they can optionally be sent there as well and the storage driver can decide how to represent them, eg. as symlinks).

A SharesStorageProvider provides a file tree of all shares the currently logged in user has received and that tree can be mounted by the gateway at an appropriate location, eg.: /shares or /home/shares. In addition the SharesStorageProvider also takes care of exposing received shares as spaces.

With this change the manager becomes the single source of truth regarding shares. It can thus answer both:

The storage providers and drivers no longer have to keep track of shares, in fact they do not have to know shares exist in the first place.

This becomes optional, as was intended from the beginning, by configuring the gateway to (not) forward grant requests and create reference requests to the storage providers. See commit_share_to_storage_grant and commit_share_to_storage_ref. Administrators can still configure the gateway to forward grants to storage providers and they can still apply acls to share a resource on the os layer. The source of truth however is the share manager (think of it as periodically setting the ACLs on the storage, overwriting existing ACLs).

Expected Results

The SharesStorageProvider reads all metadate from the share manager and can provide access to all received shares by returning CS3 references.

FaQ

Share indicators require asking the share manager

To render a PROPFIND result for public and authenticated listings of folders, we need to know if a resource has been shared or not. If we are not persisting any share information in the storage provider we need to query the share manager for every PROPFIND. We can optimize this case when listing folders, but an overhead for merging two potenitially large lists remains.

Alternate solution: treat the storage provider like a cache for share properties. We could forward share requests to the storage providers and they could persist the data on the owners side, but only as a cache. The cache invalidation must happen when a share is being accessed (the share manager has to be checked, to verify the share still exists) and it should happen when a share is updated/removed.

Related Pull Requests

Remaining tasks

Difference to a owncloud10homestorageprovider

The SharesStorageProvider jails all accepted shares of a user in a single directory. In contrast to the owncloud 10 home it does not allow arbitrary mount points. When listing shares from an existing oc10 database the file_target column might contain a deep path like /some/deep/moint/point/for/received/share/foo. It will only be listed by the basename. Multiple received shares with the same base name are deduplicated by appending the shareid in brackets. This workaround will go away with spaces concept.

butonic commented 3 years ago
butonic commented 3 years ago

blocked by https://github.com/cs3org/cs3apis-build/pull/14