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

[Question] What's the most efficient way to count blobs under a folder? #91

Open
GZTimeWalker opened this issue Nov 11, 2024 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@GZTimeWalker
Copy link

What's the most efficient way to count under a folder?

Using Count after ListAsync doesn't seem to be a very elegant approach, as it reads a lot of metadata from the file - even if I only need a single count number.

@robinrodricks
Copy link
Owner

We could introduce a new count method. Suggest the signature. Also suggest which underlying AWS/Azure .NET SDK API it would use.

Which cloud are you using?

@robinrodricks robinrodricks added enhancement New feature or request question Further information is requested labels Nov 11, 2024
@GZTimeWalker
Copy link
Author

Not much, I knew FluentStorage just a day before...

And about the storage, I have only used minio and aws s3.

@GZTimeWalker
Copy link
Author

GZTimeWalker commented Nov 11, 2024

For signature, I think this is fine:

/// <summary>
/// Returns the count of available blobs
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns>Count of blobs</returns>
Task<int> CountAsync(string fullPath, CancellationToken cancellationToken = default);

For most cases, count is no need to do recursively. As expected, is should only access one folder blob.

NOTE: maybe an option for count Regular Files or Folders or both of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants