Skip to content

Commit

Permalink
fix stat cache for space shares (#2689)
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar authored Mar 28, 2022
1 parent 96279f2 commit f9fa084
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/unreleased/use-share-api-spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ We now use the cs3 share Api to manage the space roles. We do not send the reque

https://github.com/cs3org/reva/pull/2600
https://github.com/cs3org/reva/pull/2620
https://github.com/cs3org/reva/pull/2687
2 changes: 1 addition & 1 deletion internal/grpc/services/gateway/storageprovidercache.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func statKey(user *userpb.User, ref *provider.Reference, metaDataKeys []string)
return ""
}

key := "uid" + user.Id.OpaqueId + "!sid:" + ref.ResourceId.StorageId + "!oid:" + ref.ResourceId.OpaqueId + "!path:" + ref.Path
key := "uid:" + user.Id.OpaqueId + "!sid:" + ref.ResourceId.StorageId + "!oid:" + ref.ResourceId.OpaqueId + "!path:" + ref.Path
for _, k := range metaDataKeys {
key += "!mdk:" + k
}
Expand Down
2 changes: 2 additions & 0 deletions internal/grpc/services/gateway/usershareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ func (s *svc) addSpaceShare(ctx context.Context, req *collaboration.CreateShareR
switch st.Code {
case rpc.Code_CODE_OK:
s.cache.RemoveStat(ctxpkg.ContextMustGetUser(ctx), req.ResourceInfo.Id)
s.cache.RemoveListStorageProviders(req.ResourceInfo.Id)
case rpc.Code_CODE_UNIMPLEMENTED:
appctx.GetLogger(ctx).Debug().Interface("status", st).Interface("req", req).Msg("storing grants not supported, ignoring")
default:
Expand Down Expand Up @@ -764,6 +765,7 @@ func (s *svc) removeSpaceShare(ctx context.Context, ref *provider.ResourceId, gr
}, err
}
s.cache.RemoveStat(ctxpkg.ContextMustGetUser(ctx), ref)
s.cache.RemoveListStorageProviders(ref)
return &collaboration.RemoveShareResponse{Status: status.NewOK(ctx)}, nil
}

Expand Down

0 comments on commit f9fa084

Please sign in to comment.