mirror of https://github.com/apache/jclouds.git
object stores typically sort the list of containers
This commit is contained in:
parent
7480d6e363
commit
8b325d585e
|
@ -38,6 +38,7 @@ import java.nio.file.Path;
|
|||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.nio.file.attribute.PosixFilePermission;
|
||||
import java.nio.file.attribute.UserDefinedFileAttributeView;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -134,7 +135,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getAllContainerNames() {
|
||||
public Collection<String> getAllContainerNames() {
|
||||
File[] files = new File(buildPathStartingFromBaseDir()).listFiles();
|
||||
if (files == null) {
|
||||
return ImmutableList.of();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.jclouds.blobstore;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.BlobAccess;
|
||||
|
@ -42,7 +43,7 @@ public interface LocalStorageStrategy {
|
|||
* Return an iterator that reports all the containers under base path
|
||||
* @return
|
||||
*/
|
||||
Iterable<String> getAllContainerNames();
|
||||
Collection<String> getAllContainerNames();
|
||||
|
||||
/**
|
||||
* Creates a new container
|
||||
|
|
|
@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import static com.google.common.io.BaseEncoding.base16;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -82,7 +83,7 @@ public class TransientStorageStrategy implements LocalStorageStrategy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getAllContainerNames() {
|
||||
public Collection<String> getAllContainerNames() {
|
||||
return containerToBlobs.keySet();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.SequenceInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -393,7 +395,8 @@ public final class LocalBlobStore implements BlobStore {
|
|||
|
||||
@Override
|
||||
public PageSet<? extends StorageMetadata> list() {
|
||||
Iterable<String> containers = storageStrategy.getAllContainerNames();
|
||||
ArrayList<String> containers = new ArrayList<String>(storageStrategy.getAllContainerNames());
|
||||
Collections.sort(containers);
|
||||
|
||||
return new PageSetImpl<StorageMetadata>(transform(
|
||||
containers, new Function<String, StorageMetadata>() {
|
||||
|
|
Loading…
Reference in New Issue