Class RegionScopedSwiftBlobStore
- java.lang.Object
-
- org.jclouds.openstack.swift.v1.blobstore.RegionScopedSwiftBlobStore
-
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.cache.LoadingCache<String,com.google.common.base.Optional<Container>>
containerCache
protected Logger
logger
protected int
retryCountLimit
protected PayloadSlicer
slicer
protected com.google.common.util.concurrent.ListeningExecutorService
userExecutor
-
Constructor Summary
Constructors Modifier Constructor Description protected
RegionScopedSwiftBlobStore(com.google.inject.Injector baseGraph, BlobStoreContext context, SwiftApi api, com.google.common.base.Supplier<Set<? extends Location>> locations, String regionId, PayloadSlicer slicer, com.google.common.util.concurrent.ListeningExecutorService userExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abortMultipartUpload(MultipartUpload mpu)
BlobBuilder
blobBuilder(String name)
boolean
blobExists(String container, String name)
Determines if a blob existsBlobMetadata
blobMetadata(String container, String name)
Retrieves the metadata of aBlob
at locationcontainer/name
void
clearContainer(String containerName)
This will delete the contents of a container at its root path without deleting the containervoid
clearContainer(String containerName, ListContainerOptions options)
LikeBlobStore.clearContainer(String)
except you can use options to do things like recursive deletes, or clear at a different path than root.String
completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> parts)
boolean
containerExists(String container)
determines if a service-level container existsString
copyBlob(String fromContainer, String fromName, String toContainer, String toName, CopyOptions options)
Copy blob from one container to another.long
countBlobs(String containerName)
long
countBlobs(String containerName, ListContainerOptions options)
boolean
createContainerInLocation(Location location, String container)
Creates a namespace for your blobsboolean
createContainerInLocation(Location location, String container, CreateContainerOptions options)
void
createDirectory(String containerName, String directory)
Creates a folder or a directory marker depending on the servicevoid
deleteContainer(String container)
This will delete everything inside a container recursively.boolean
deleteContainerIfEmpty(String container)
Deletes a container if it is empty.void
deleteDirectory(String containerName, String directory)
Deletes a folder or a directory marker depending on the serviceboolean
directoryExists(String containerName, String directory)
Determines if a directory existsvoid
downloadBlob(String container, String name, File destination)
void
downloadBlob(String container, String name, File destination, ExecutorService executor)
Blob
getBlob(String container, String key)
Retrieves aBlob
representing the data at locationcontainer/name
Blob
getBlob(String container, String name, GetOptions options)
Retrieves aBlob
representing the data at locationcontainer/name
BlobAccess
getBlobAccess(String container, String name)
ContainerAccess
getContainerAccess(String name)
BlobStoreContext
getContext()
long
getMaximumMultipartPartSize()
int
getMaximumNumberOfParts()
long
getMinimumMultipartPartSize()
MultipartUpload
initiateMultipartUpload(String container, BlobMetadata blobMetadata, PutOptions options)
PageSet<? extends StorageMetadata>
list()
Lists all root-level resources available to the identity.PageSet<? extends StorageMetadata>
list(String container)
Lists all resources in a container non-recursive.PageSet<? extends StorageMetadata>
list(String container, ListContainerOptions options)
LikeBlobStore.list(String)
except you can control the size, recursion, and context of the list usingoptions
Set<? extends Location>
listAssignableLocations()
The get locations command returns all the valid locations for containers.List<MultipartPart>
listMultipartUpload(MultipartUpload mpu)
List<MultipartUpload>
listMultipartUploads(String container)
String
putBlob(String container, Blob blob)
Adds aBlob
representing the data at locationcontainer/blob.metadata.name
String
putBlob(String container, Blob blob, PutOptions options)
Adds aBlob
representing the data at locationcontainer/blob.metadata.name
options using multipart strategies.protected String
putMultipartBlob(String container, Blob blob, PutOptions overrides)
Upload using a user-provided executor, or the jclouds userExecutorprotected String
putMultipartBlob(String container, Blob blob, PutOptions overrides, com.google.common.util.concurrent.ListeningExecutorService executor)
void
removeBlob(String container, String name)
Deletes aBlob
representing the data at locationcontainer/name
void
removeBlobs(String container, Iterable<String> names)
Delete multiple single-part objects.void
setBlobAccess(String container, String name, BlobAccess access)
void
setContainerAccess(String name, ContainerAccess access)
InputStream
streamBlob(String container, String name)
InputStream
streamBlob(String container, String name, ExecutorService executor)
protected com.google.common.base.Function<SwiftObject,MutableBlobMetadata>
toBlobMetadata(String container)
MultipartPart
uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload)
-
-
-
Field Detail
-
slicer
protected final PayloadSlicer slicer
-
userExecutor
protected final com.google.common.util.concurrent.ListeningExecutorService userExecutor
-
logger
protected Logger logger
-
containerCache
protected final com.google.common.cache.LoadingCache<String,com.google.common.base.Optional<Container>> containerCache
-
retryCountLimit
@Inject(optional=true) @Named("jclouds.max-retries") protected int retryCountLimit
-
-
Constructor Detail
-
RegionScopedSwiftBlobStore
@Inject protected RegionScopedSwiftBlobStore(com.google.inject.Injector baseGraph, BlobStoreContext context, SwiftApi api, com.google.common.base.Supplier<Set<? extends Location>> locations, String regionId, PayloadSlicer slicer, @Named("jclouds.user-threads") com.google.common.util.concurrent.ListeningExecutorService userExecutor)
-
-
Method Detail
-
listAssignableLocations
public Set<? extends Location> listAssignableLocations()
Description copied from interface:BlobStore
The get locations command returns all the valid locations for containers. A location has a scope, which is typically region or zone. A region is a general area, like eu-west, where a zone is similar to a datacenter. If a location has a parent, that implies it is within that location. For example a location can be a rack, whose parent is likely to be a zone.- Specified by:
listAssignableLocations
in interfaceBlobStore
-
list
public PageSet<? extends StorageMetadata> list()
Description copied from interface:BlobStore
Lists all root-level resources available to the identity.
-
containerExists
public boolean containerExists(String container)
Description copied from interface:BlobStore
determines if a service-level container exists- Specified by:
containerExists
in interfaceBlobStore
-
createContainerInLocation
public boolean createContainerInLocation(Location location, String container)
Description copied from interface:BlobStore
Creates a namespace for your blobs A container is a namespace for your objects. Depending on the service, the scope can be global, identity, or sub-identity scoped. For example, in Amazon S3, containers are called buckets, and they must be uniquely named such that no-one else in the world conflicts. In other blobstores, the naming convention of the container is less strict. All blobstores allow you to list your containers and also the contents within them. These contents can either be blobs, folders, or virtual paths.- Specified by:
createContainerInLocation
in interfaceBlobStore
- Parameters:
location
- some blobstores allow you to specify a location, such as US-EAST, for where this container will exist. null will choose a default locationcontainer
- namespace. Typically constrained to lowercase alpha-numeric and hyphens.- Returns:
- true if the container was created, false if it already existed.
-
createContainerInLocation
public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options)
- Specified by:
createContainerInLocation
in interfaceBlobStore
options
- controls default access control- See Also:
BlobStore.createContainerInLocation(Location,String)
-
getContainerAccess
public ContainerAccess getContainerAccess(String name)
- Specified by:
getContainerAccess
in interfaceBlobStore
-
setContainerAccess
public void setContainerAccess(String name, ContainerAccess access)
- Specified by:
setContainerAccess
in interfaceBlobStore
-
list
public PageSet<? extends StorageMetadata> list(String container)
Description copied from interface:BlobStore
Lists all resources in a container non-recursive.
-
list
public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options)
Description copied from interface:BlobStore
LikeBlobStore.list(String)
except you can control the size, recursion, and context of the list usingoptions
-
blobExists
public boolean blobExists(String container, String name)
Description copied from interface:BlobStore
Determines if a blob exists- Specified by:
blobExists
in interfaceBlobStore
- Parameters:
container
- container where the blob resides
-
putBlob
public String putBlob(String container, Blob blob)
Description copied from interface:BlobStore
Adds aBlob
representing the data at locationcontainer/blob.metadata.name
-
putBlob
public String putBlob(String container, Blob blob, PutOptions options)
Description copied from interface:BlobStore
Adds aBlob
representing the data at locationcontainer/blob.metadata.name
options using multipart strategies.
-
copyBlob
public String copyBlob(String fromContainer, String fromName, String toContainer, String toName, CopyOptions options)
Description copied from interface:BlobStore
Copy blob from one container to another. Some providers implement this more efficiently than corresponding getBlob and putBlob operations. Note: options are currently ignored
-
blobMetadata
public BlobMetadata blobMetadata(String container, String name)
Description copied from interface:BlobStore
Retrieves the metadata of aBlob
at locationcontainer/name
- Specified by:
blobMetadata
in interfaceBlobStore
- Parameters:
container
- container where this exists.name
- fully qualified name relative to the container.- Returns:
- null if name isn't present or the blob you intended to receive.
-
getBlob
public Blob getBlob(String container, String key)
Description copied from interface:BlobStore
Retrieves aBlob
representing the data at locationcontainer/name
-
getBlob
public Blob getBlob(String container, String name, GetOptions options)
Description copied from interface:BlobStore
Retrieves aBlob
representing the data at locationcontainer/name
-
removeBlob
public void removeBlob(String container, String name)
Description copied from interface:BlobStore
Deletes aBlob
representing the data at locationcontainer/name
- Specified by:
removeBlob
in interfaceBlobStore
- Parameters:
container
- container where this exists.name
- fully qualified name relative to the container.
-
removeBlobs
public void removeBlobs(String container, Iterable<String> names)
Delete multiple single-part objects. Note that this does not remove the subobjects of a multi-part upload.- Specified by:
removeBlobs
in interfaceBlobStore
- Parameters:
container
- container where this exists.names
- fully qualified names relative to the container.
-
getBlobAccess
public BlobAccess getBlobAccess(String container, String name)
- Specified by:
getBlobAccess
in interfaceBlobStore
-
setBlobAccess
public void setBlobAccess(String container, String name, BlobAccess access)
- Specified by:
setBlobAccess
in interfaceBlobStore
-
getContext
public BlobStoreContext getContext()
- Specified by:
getContext
in interfaceBlobStore
- Returns:
- a reference to the context that created this BlobStore.
-
blobBuilder
public BlobBuilder blobBuilder(String name)
- Specified by:
blobBuilder
in interfaceBlobStore
- Returns:
- builder for creating new
Blob
s
-
directoryExists
public boolean directoryExists(String containerName, String directory)
Description copied from interface:BlobStore
Determines if a directory exists- Specified by:
directoryExists
in interfaceBlobStore
- Parameters:
containerName
- container where the directory residesdirectory
- full path to the directory
-
createDirectory
public void createDirectory(String containerName, String directory)
Description copied from interface:BlobStore
Creates a folder or a directory marker depending on the service- Specified by:
createDirectory
in interfaceBlobStore
- Parameters:
containerName
- container to create the directory indirectory
- full path to the directory
-
deleteDirectory
public void deleteDirectory(String containerName, String directory)
Description copied from interface:BlobStore
Deletes a folder or a directory marker depending on the service- Specified by:
deleteDirectory
in interfaceBlobStore
-
countBlobs
public long countBlobs(String containerName)
- Specified by:
countBlobs
in interfaceBlobStore
- Returns:
- a count of all blobs in the container, excluding directory markers
-
initiateMultipartUpload
public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata, PutOptions options)
- Specified by:
initiateMultipartUpload
in interfaceBlobStore
-
abortMultipartUpload
public void abortMultipartUpload(MultipartUpload mpu)
- Specified by:
abortMultipartUpload
in interfaceBlobStore
-
completeMultipartUpload
public String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> parts)
- Specified by:
completeMultipartUpload
in interfaceBlobStore
-
uploadMultipartPart
public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload)
- Specified by:
uploadMultipartPart
in interfaceBlobStore
-
listMultipartUpload
public List<MultipartPart> listMultipartUpload(MultipartUpload mpu)
- Specified by:
listMultipartUpload
in interfaceBlobStore
-
listMultipartUploads
public List<MultipartUpload> listMultipartUploads(String container)
- Specified by:
listMultipartUploads
in interfaceBlobStore
-
getMinimumMultipartPartSize
public long getMinimumMultipartPartSize()
- Specified by:
getMinimumMultipartPartSize
in interfaceBlobStore
-
getMaximumMultipartPartSize
public long getMaximumMultipartPartSize()
- Specified by:
getMaximumMultipartPartSize
in interfaceBlobStore
-
getMaximumNumberOfParts
public int getMaximumNumberOfParts()
- Specified by:
getMaximumNumberOfParts
in interfaceBlobStore
-
clearContainer
public void clearContainer(String containerName)
Description copied from interface:BlobStore
This will delete the contents of a container at its root path without deleting the container- Specified by:
clearContainer
in interfaceBlobStore
- Parameters:
containerName
- what to clear
-
clearContainer
public void clearContainer(String containerName, ListContainerOptions options)
Description copied from interface:BlobStore
LikeBlobStore.clearContainer(String)
except you can use options to do things like recursive deletes, or clear at a different path than root.- Specified by:
clearContainer
in interfaceBlobStore
- Parameters:
containerName
- what to clearoptions
- recursion and path to clear
-
deleteContainer
public void deleteContainer(String container)
Description copied from interface:BlobStore
This will delete everything inside a container recursively.- Specified by:
deleteContainer
in interfaceBlobStore
- Parameters:
container
- what to delete
-
deleteContainerIfEmpty
public boolean deleteContainerIfEmpty(String container)
Description copied from interface:BlobStore
Deletes a container if it is empty.- Specified by:
deleteContainerIfEmpty
in interfaceBlobStore
- Parameters:
container
- name of the container to delete- Returns:
- true if the container was deleted or does not exist
-
toBlobMetadata
protected com.google.common.base.Function<SwiftObject,MutableBlobMetadata> toBlobMetadata(String container)
-
countBlobs
public long countBlobs(String containerName, ListContainerOptions options)
- Specified by:
countBlobs
in interfaceBlobStore
- Returns:
- a count of all blobs that are in a listing constrained by the options specified, excluding directory markers
-
putMultipartBlob
@Beta protected String putMultipartBlob(String container, Blob blob, PutOptions overrides)
Upload using a user-provided executor, or the jclouds userExecutor- Parameters:
container
-blob
-overrides
-- Returns:
- the multipart blob etag
-
putMultipartBlob
@Beta protected String putMultipartBlob(String container, Blob blob, PutOptions overrides, com.google.common.util.concurrent.ListeningExecutorService executor)
-
downloadBlob
@Beta public void downloadBlob(String container, String name, File destination)
- Specified by:
downloadBlob
in interfaceBlobStore
-
downloadBlob
@Beta public void downloadBlob(String container, String name, File destination, ExecutorService executor)
- Specified by:
downloadBlob
in interfaceBlobStore
-
streamBlob
@Beta public InputStream streamBlob(String container, String name)
- Specified by:
streamBlob
in interfaceBlobStore
-
streamBlob
@Beta public InputStream streamBlob(String container, String name, ExecutorService executor)
- Specified by:
streamBlob
in interfaceBlobStore
-
-