Class S3Publisher
- java.lang.Object
-
- app.coronawarn.server.services.distribution.objectstore.S3Publisher
-
@Component 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 CWA-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(ObjectStoreAccess objectStoreAccess, FailedObjectStoreOperationsCounter failedOperationsCounter, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor executor, DistributionServiceConfig distributionServiceConfig)
Creates anS3Publisher
instance that attempts to publish the files at the specified location to an object store.
-
-
-
Constructor Detail
-
S3Publisher
public S3Publisher(ObjectStoreAccess objectStoreAccess, FailedObjectStoreOperationsCounter failedOperationsCounter, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor executor, DistributionServiceConfig distributionServiceConfig)
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:
objectStoreAccess
- TheObjectStoreAccess
used to communicate with the object store.failedOperationsCounter
- TheFailedObjectStoreOperationsCounter
that is used to monitor the number of failed operations.executor
- The executor that manages the upload task submission.distributionServiceConfig
- TheDistributionServiceConfig
used for distribution service configuration.
-
-
Method Detail
-
publish
public void publish(Path root) throws IOException
Synchronizes the files to S3. Current strategy is to never update diagnosis key archive files already published on S3, even if the retention and shifting policies cause a diff between subsequent distribution runs. Thus, by default distribution will only add new key files, but still modify indexes. This behaviour can however be controlled through the configuration parameterDistributionServiceConfig.forceUpdateKeyFiles
- Parameters:
root
- The path of the directory that shall be published.- Throws:
IOException
- in case there were problems reading files from the disk.- See Also:
issue #650
-
-