Class S3Publisher
- java.lang.Object
-
- app.coronawarn.server.services.distribution.objectstore.S3Publisher
-
public class S3Publisher extends Object
Publishes a folder on the disk to S3 while keeping the folder and file structure.
Moreover, does the following:
- Publishes index files on a different route, removing the trailing "/index" part.
- Adds meta information to the uploaded files, e.g. the sha256 hash value.
- Only performs the upload for files, which do not yet exist on the object store, and checks whether the existing files hash differ from the to-be-uploaded files hash. Only if the hash differs, the file will ultimately be uploaded
- Currently not implemented: Set cache control headers
- Currently not implemented: Supports multi threaded upload of files.
-
-
Constructor Summary
Constructors Constructor Description S3Publisher(Path root, ObjectStoreAccess objectStoreAccess, FailedObjectStoreOperationsCounter failedOperationsCounter)
Creates anS3Publisher
instance that attempts to publish the files at the specified location to an object store.
-
-
-
Constructor Detail
-
S3Publisher
public S3Publisher(Path root, ObjectStoreAccess objectStoreAccess, FailedObjectStoreOperationsCounter failedOperationsCounter)
Creates anS3Publisher
instance that attempts to publish the files at the specified location to an object store. Object store operations are performed through the specifiedObjectStoreAccess
instance.- Parameters:
root
- The path of the directory that shall be published.objectStoreAccess
- TheObjectStoreAccess
used to communicate with the object store.failedOperationsCounter
- TheFailedObjectStoreOperationsCounter
that is used to monitor the number of failed operations.
-
-
Method Detail
-
publish
public void publish() throws IOException
Synchronizes the files to S3.- Throws:
IOException
- in case there were problems reading files from the disk.
-
-