[RTFACT-15639] Size of a top level folder that contains sub-folders in AQL or Artifactory REST API Created: 12/Jan/18  Updated: 03/Jun/19  Resolved: 03/Jun/19

Status: Resolved
Project: Artifactory Binary Repository
Component/s: AQL, REST API
Affects Version/s: 5.4.6
Fix Version/s: None

Type: Improvement Priority: High
Reporter: Scott Mosher Assignee: Unassigned
Resolution: Duplicate Votes: 4
Labels: None

Issue Links:
Duplicate
duplicates RTFACT-18831 AQL / rest API data extract Open

 Description   

Problem

Unable to get the size of a top level folder if this folder contains any sub-folders

Possible Solution/Improvement

Option 1: have the rest api for folder info contain the size of the folder including all sub-folders

Option 2: Be able to retrieve size via AQL. We tried to perform an AQL query to get the size of the folder.
Reproduce:
1. create local repo and deploy an artifact/s to a folder
2. deploy some other artifacts in a sub-folder of that folder
3. run the following AQL query to get the folder size:
items.find({"repo":

{"$eq":"example-repo-local"}

,"path":{"$eq":"folder"}}).include("size")
4. this returns only the size of the artifacts one layer below the top level folder and completely ignores all sub-folders (this seems to be intended but also seems a bit counter-intuitive)

Customer Use Case
Customer looking to get the size of individual top level folders for clean up script. They implemented a recursive function to aggregate all files in a top level folder but causes many issues when dealing with many files.

The customers use case is their builds are deposited in each repository of different sizes so then need to query the top level folders (associated with their build) to see the largest folder before adding another folder. Their logic using the recursive function cleans out the oldest builds until there is enough space for one more build of size equal to the largest build. They have folders with over 1000 files that drastically impacts the API.

The workaround for them now is to zip up the sources directory to limit the size to one API query. This then does not allow the source files that are used across other projects to leverage the checksum based storage.


Generated at Thu Aug 06 07:58:35 UTC 2020 using Jira 8.5.3#805003-sha1:b4933e02eaff29a49114274fe59e1f99d9d963d7.