jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GARDAIS Ionel <ionel.gard...@tech-advantage.com>
Subject BlobStore list() and PageSet
Date Sun, 03 Dec 2017 15:47:38 GMT
Hi, 

I have a question regarding BlobStore listing. 
We are currently using the FileSystem storage implementation 

private long containerSize(String containerName) { 
long containerSize = 0; 
String marker = null; 
PageSet<? extends StorageMetadata> containerSML = null; 
ListContainerOptions lcoRecursive = new ListContainerOptions().recursive(); 

(1) containerSML = blobStore.list(containerName, lcoRecursive); 
containerSize += pageSize(containerSML); 
marker = containerSML.getNextMarker(); 

while (marker != null) { 
lcoRecursive.afterMarker(marker); 
(2) containerSML = blobStore.list(containerName, lcoRecursive); 
containerSize += pageSize(containerSML); 
marker = containerSML.getNextMarker(); 
} 

log.debug("container:{} size:{}", containerName, containerSize); 
return containerSize; 
} 
private long pageSize(PageSet<? extends StorageMetadata> containerStorageMetadataList)
{ 
long size = 0; 
for (StorageMetadata containerStorageMetadata : containerStorageMetadataList) { 
if (containerStorageMetadata.getType() == StorageType.BLOB) { 
log.debug("name:{} size:{}", containerStorageMetadata.getName(), containerStorageMetadata.getSize());

size += containerStorageMetadata.getSize(); 
} else { 
log.debug("other in container: {}", containerStorageMetadata.getType()); 
} 
} 
return size; 
} 


By calling list() with ListContainerOptions().recursive() on both (1) and (2), all container’s
blobs are opened every PageSet. 
I tried to call list() with recursive() on (1) only then iterating over PageSets without the
recursive flag set but I don’t get all Blobs. 

Is there a way to iterate over all blobs in a container in a more effective way ? 

Thanks, 
Ionel 

--

232 avenue Napoleon BONAPARTE 92500 RUEIL MALMAISON

Capital EUR 219 300,00 - RCS Nanterre B 408 832 301 - TVA FR 09 408 832 301


Mime
View raw message