-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add support for Spaces #4404
base: master
Are you sure you want to change the base?
Add support for Spaces #4404
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went for a full review of this branch. Some new code chunks implement the logic required by the LibreGraph API and I considered them "good", trusting the tests we're doing with the web UI. There are a few trivial fixes (already merged) and some other larger changes to be done/discussed.
pkg/projects/manager/sql/sql.go
Outdated
|
||
func (m *mgr) ListProjects(ctx context.Context, user *userpb.User) ([]*provider.StorageSpace, error) { | ||
// TODO: for the time being we load everything in memory. We may find a better | ||
// solution in future when the number of projects will grow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading in memory is not a big issue per se, but how are we refreshing this cache as new project spaces get created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the impact that great to keep getting the data from the DB instead of loading it? Can't we put a cache in front?
Jesse (because for some reason I cannot comment): I created a cache in a new PR: #5094
drive, err := s.cs3ReceivedShareToDriveItem(ctx, share) | ||
if err != nil { | ||
log.Error().Err(err).Msg("error getting received shares") | ||
w.WriteHeader(http.StatusInternalServerError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not accumulate further technical debt with those HTTP 500:
- On a loop, we should skip and return the rest
- In the other cases, we should return something relevant for the frontend to show (and help us in debugging afterwards)
Co-authored-by: Jesse Geens <[email protected]>
Co-authored-by: Jesse Geens <[email protected]>
…5053) Bumps google.golang.org/protobuf from 1.36.1 to 1.36.4. --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#5049) Bumps [github.com/coreos/go-oidc/v3](https://github.com/coreos/go-oidc) from 3.11.0 to 3.12.0. - [Release notes](https://github.com/coreos/go-oidc/releases) - [Commits](coreos/go-oidc@v3.11.0...v3.12.0) --- updated-dependencies: - dependency-name: github.com/coreos/go-oidc/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [go.step.sm/crypto](https://github.com/smallstep/crypto) from 0.55.0 to 0.57.0. - [Release notes](https://github.com/smallstep/crypto/releases) - [Commits](smallstep/crypto@v0.55.0...v0.57.0) --- updated-dependencies: - dependency-name: go.step.sm/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code could still benefit from (much) more detailed documentation.....
And some functions could be unified in a single place (e.g. things related to converting IDs to strings and reverse).
I would also take the time to go full orm with it.
pkg/projects/manager/sql/sql.go
Outdated
|
||
func (m *mgr) ListProjects(ctx context.Context, user *userpb.User) ([]*provider.StorageSpace, error) { | ||
// TODO: for the time being we load everything in memory. We may find a better | ||
// solution in future when the number of projects will grow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the impact that great to keep getting the data from the DB instead of loading it? Can't we put a cache in front?
Jesse (because for some reason I cannot comment): I created a cache in a new PR: #5094
|
||
spacesRes := make([]*libregraph.Drive, 0, len(res.ShareInfos)) | ||
for _, share := range res.ShareInfos { | ||
spacesRes = append(spacesRes, s.convertShareToSpace(share)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ListExistingReceivedShares
checks if a share is valid (by doing a stat), right? I wonder if we find performance issues if that is necessary. After all, the real shares listing are requested separately, so even if we sent data that is no longer accessible, it wouldn't be a problem.
Either way, to me these mountpoint spaces don't make much sense. It should be 1 space per person that shared, and not by share (since we consider the users' homes the sole spaces). But alas, this would need changes from web.
|
||
// For the moment, not supported | ||
func isShareJail(spaceID string) bool { | ||
return false // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the hardcoded share jail id we set above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it would, but afaik we decided not to support sharejails for now
|
||
d := &libregraph.DriveItem{ | ||
UIHidden: libregraph.PtrBool(rsi.ReceivedShare.Hidden), | ||
ClientSynchronize: libregraph.PtrBool(true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this what we now added in the new share schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and this gets propagated now to the ReceivedShare.Hidden
field :)
|
||
func groupByResourceID(shares []*gateway.ShareResourceInfo, publicShares []*gateway.PublicShareResourceInfo) (map[string][]*share, map[string]*provider.ResourceInfo) { | ||
grouped := make(map[string][]*share, len(shares)+len(publicShares)) // at most we have the sum of both lists | ||
infos := make(map[string]*provider.ResourceInfo, len(shares)+len(publicShares)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it for performance reasons that we are allocating the space now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess yes, otherwise you get a backing array with a small capacity and have to continually increase the backing array capacity as the map fills up. So if you know the size beforehand it's better to already pass it
…lls to the database
All credits to @gmgigi96, I reopened this PR so we can keep working on it.
Missing parts:
A way to enable/disable this format by config, such that we can have the functionality in the code and enable it once readyAnd from the last merge:
replace
s in go.mod, in particular for the cs3apis