Extension of OAK-6254: in addition to retrieving the size, it would be good to retrieve the estimated number and total size per file type. A simple (and in my view sufficient) solution is to use the first few bytes ("magic numbers", 2 bytes should be enough) to get the file type. That would allow to estimate, for example, the number of, and total size, of PDF files, JPEG, Lucene index and so on. A histogram would be nice as well, but I think is not needed.
To speed up calculation, the blob ID could be extended with the first 2 bytes of the file content, that is: <hash>#<length>@<magic> where magic is the first two bytes, in hex. That would allow to quickly get the data from the blob ids (no need to actually read content).
Sampling should be enough. The longer it takes, the more accurate the data. We could store the data while doing datastore GC, in which case the returned data would be somewhat stale; that's OK.