Skip to content
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

use key to get specific trash item #9879

Merged
merged 2 commits into from
Aug 23, 2024
Merged

Conversation

butonic
Copy link
Member

@butonic butonic commented Aug 21, 2024

The activitylog and clientlog services now only fetch the specific trash item instead of getting all items in trash and filtering them on their side. This reduces the load on the storage users service because it no longer has to assemble a full trash listing.

related #9866

@butonic butonic requested a review from kobergj August 21, 2024 09:01
@butonic
Copy link
Member Author

butonic commented Aug 21, 2024

the test fails because decomposedfs is implemented in a way that when the resource identified by the key is a folder it will list the children of that folder. When it is a file it will return only that file:

	nodeType := fs.lu.TypeFromPath(ctx, originalPath)
	if nodeType != provider.ResourceType_RESOURCE_TYPE_CONTAINER {
		// this is the case when we want to directly list a file in the trashbin
		blobsize, err := strconv.ParseInt(string(attrs[prefixes.BlobsizeAttr]), 10, 64)
		if err != nil {
			return items, err
		}
		item := &provider.RecycleItem{
			Type:         nodeType,
			Size:         uint64(blobsize),
			Key:          filepath.Join(key, relativePath),
			DeletionTime: deletionTime,
			Ref: &provider.Reference{
				Path: filepath.Join(origin, relativePath),
			},
		}
		items = append(items, item)
		return items, err
	}

        // ... goes on to list all children. the directory is not added

I need to doube check how the key and path are used ...

👀

🤔

😵

ok so no storage driver implementation, other than decomposedfs, looks at the key. only decomposedfs has some logic that would allow navigating the trash ...

so the storageprovider can actually pass

  1. key="" and relativePath="" to the ListRecycle implementations when no key was present.
  2. key=key and relativePath="" to get specific trash item
  3. key=key and relativePath="/" to get the children of a folder or
  4. key=key and relativePath=relativePathStartingWithASlash to get the children of a subfolder

So there is a difference in sending a key with or without ending in a /.

@butonic
Copy link
Member Author

butonic commented Aug 21, 2024

implemented the above in cs3org/reva#4818

@butonic butonic force-pushed the use-key-to-get-specific-trash-item branch from 78584ed to a2351d0 Compare August 23, 2024 08:38
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@butonic butonic force-pushed the use-key-to-get-specific-trash-item branch 4 times, most recently from 2821b69 to 24889db Compare August 23, 2024 15:31
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@butonic butonic force-pushed the use-key-to-get-specific-trash-item branch from 24889db to 23adc13 Compare August 23, 2024 15:50
Copy link

@butonic butonic merged commit 40449ce into master Aug 23, 2024
3 checks passed
@butonic butonic deleted the use-key-to-get-specific-trash-item branch August 23, 2024 16:28
ownclouders pushed a commit that referenced this pull request Aug 23, 2024
@micbar micbar mentioned this pull request Sep 12, 2024
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants