mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-09 15:28:37 -05:00
Bump reva
This commit is contained in:
23
vendor/github.com/cs3org/reva/v2/pkg/share/manager/jsoncs3/jsoncs3.go
generated
vendored
23
vendor/github.com/cs3org/reva/v2/pkg/share/manager/jsoncs3/jsoncs3.go
generated
vendored
@@ -805,19 +805,18 @@ func (m *Manager) ListReceivedShares(ctx context.Context, filters []*collaborati
|
||||
}
|
||||
|
||||
// add all spaces the user has receved shares for, this includes mount points and share state for groups
|
||||
// TODO: rewrite this code to not use the internal strucs anymore (e.g. by adding a List method). Sync can then be made private.
|
||||
_ = m.UserReceivedStates.Sync(ctx, user.Id.OpaqueId) // ignore error, cache will be updated on next read
|
||||
|
||||
if m.UserReceivedStates.ReceivedSpaces[user.Id.OpaqueId] != nil {
|
||||
for ssid, rspace := range m.UserReceivedStates.ReceivedSpaces[user.Id.OpaqueId].Spaces {
|
||||
if rs, ok := ssids[ssid]; ok {
|
||||
for shareid, state := range rspace.States {
|
||||
// overwrite state
|
||||
rs.States[shareid] = state
|
||||
}
|
||||
} else {
|
||||
ssids[ssid] = rspace
|
||||
spaces, err := m.UserReceivedStates.List(ctx, user.Id.OpaqueId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for ssid, rspace := range spaces {
|
||||
if rs, ok := ssids[ssid]; ok {
|
||||
for shareid, state := range rspace.States {
|
||||
// overwrite state
|
||||
rs.States[shareid] = state
|
||||
}
|
||||
} else {
|
||||
ssids[ssid] = rspace
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,15 +177,35 @@ func (c *Cache) Get(ctx context.Context, userID, spaceID, shareID string) (*Stat
|
||||
return c.ReceivedSpaces[userID].Spaces[spaceID].States[shareID], nil
|
||||
}
|
||||
|
||||
// Sync updates the in-memory data with the data from the storage if it is outdated
|
||||
func (c *Cache) Sync(ctx context.Context, userID string) error {
|
||||
// List returns a list of received shares for a given user
|
||||
// The return list is guaranteed to be thread-safe
|
||||
func (c *Cache) List(ctx context.Context, userID string) (map[string]*Space, error) {
|
||||
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Grab lock")
|
||||
unlock := c.lockUser(userID)
|
||||
span.End()
|
||||
span.SetAttributes(attribute.String("cs3.userid", userID))
|
||||
defer unlock()
|
||||
|
||||
return c.syncWithLock(ctx, userID)
|
||||
err := c.syncWithLock(ctx, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spaces := map[string]*Space{}
|
||||
for spaceID, space := range c.ReceivedSpaces[userID].Spaces {
|
||||
spaceCopy := &Space{
|
||||
States: map[string]*State{},
|
||||
}
|
||||
for shareID, state := range space.States {
|
||||
spaceCopy.States[shareID] = &State{
|
||||
State: state.State,
|
||||
MountPoint: state.MountPoint,
|
||||
Hide: state.Hide,
|
||||
}
|
||||
}
|
||||
spaces[spaceID] = spaceCopy
|
||||
}
|
||||
return spaces, nil
|
||||
}
|
||||
|
||||
func (c *Cache) syncWithLock(ctx context.Context, userID string) error {
|
||||
|
||||
Reference in New Issue
Block a user