0

I am trying to set a quota based on directory, say about 5 mb. And Hence I need to read the size of present blobs in a directory.

I am able to get the size of individual BLOB using the below code,

if(containerName!=null && objectName!=null){
        BlobMetadata metaData = blobStore.blobMetadata(containerName, objectName);
        if(metaData !=null){
            userMetaData = metaData.getUserMetadata();
        }           
        ContentMetadata contMetadata = metaData.getContentMetadata();
        System.out.println("Object Size "+ contMetadata.getContentLength());
    }

Just not able to find out if I can check the size of all the blobs in a directory with out looping through all the blob metadata.

Vivek
  • 182
  • 1
  • 8

1 Answers1

3

The container will have that info:

http://jclouds.apache.org/reference/javadoc/1.9.x/org/jclouds/openstack/swift/v1/domain/Container.html#getBytesUsed()

zacksh
  • 196
  • 5
  • hi zachsh, I am aware of this functionality, but wanted to check size of the files inside a virtual or normal directory with in a container. A container may have more than one directories. – Vivek Apr 15 '15 at 11:31