Class SwiftFileStore
java.lang.Object
io.github.qubitpi.athena.filestore.swift.SwiftFileStore
- All Implemented Interfaces:
FileStore
An OpenStack Swift implementation of
FileStore
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The container name where all files are going to be stored in. -
Constructor Summary
ConstructorDescriptionSwiftFileStore
(@NotNull org.javaswift.joss.model.Account account, @NotNull FileIdGenerator fileIdGenerator) DI constructor. -
Method Summary
-
Field Details
-
DEFAULT_CONTAINER
The container name where all files are going to be stored in.- See Also:
-
-
Constructor Details
-
SwiftFileStore
@Inject public SwiftFileStore(@NotNull @NotNull org.javaswift.joss.model.Account account, @NotNull @NotNull FileIdGenerator fileIdGenerator) DI constructor.- Parameters:
account
- A Swift client allowing access to the various containers underneath it. Note that you need to callAccount.getContainer(String)
to work on Containers and then pass theAccount
into this constructor. The method returns a stub for dealing with Containers, but does not create a container in the Object Store. The creation only takes place when you run theContainer.create()
method on a Container. Information on the container will not be retrieved until the time you actually call on that information - ie, information is lazily loaded.fileIdGenerator
- An object that provides file unique identifiers- Throws:
NullPointerException
- if any constructor argument isnull
-
-
Method Details
-
upload
Description copied from interface:FileStore
Persists a file into object storage database.Note that calling this method does NOT automatically update the managed metadata of this file in
MetaStore
. The metadata must be saved separately usingMetaStore.saveMetaData(String, MetaData)
.The implementation does NOT have to be thread-safe.
FileStore
assumes that it is the callers' responsibilities to implement the thread safety themselves. -
download
Description copied from interface:FileStore
Retrieves a file identified by a specified file ID from object storage.- Specified by:
download
in interfaceFileStore
- Parameters:
fileId
- The provided file ID, which is the same as the return value ofFileStore.upload(File)
- Returns:
- a previously
uploaded file stream
-