简体   繁体   中英

How to get the size of all services in azure storage for files, tables & queues? in JAVA

Trying to get the size/length of the azure storage blob, file, queues& tables.

I am able to get the size of the blob by the below code but am not able to do it for others like files, queues & tables.

for (CloudBlobContainer cloudBlobContainer : cloudBlobContainers) {

                               Iterable<ListBlobItem> blobItems = cloudBlobContainer.listBlobs();

                                   for (ListBlobItem blobItem : blobItems) {
                                        if (blobItem instanceof CloudBlob) {
                                            CloudBlob blob = (CloudBlob) blobItem;
                                            size += blob.getProperties().getLength();
                                            logger.info("Size : "+blob.getProperties().getLength());
                                        }

                                    } 

Appreciate if someoncan help with ccode snippet.

Thank you

Unfortunately, there isn't an easy way to so.

For files, you can do something like you did for blobs - listing and aggregating file sizes.

For tables, you need to scan the whole table and estimate entity size one by one. https://blogs.msdn.microsoft.com/avkashchauhan/2011/11/30/how-the-size-of-an-entity-is-caclulated-in-windows-azure-table-storage/

To my understanding, it's infeasible for queues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM