public class S3Uploader extends java.lang.Object implements IUploader
By default this uploader will write topology packages to s3://<bucket>/<topologyName>/topology.tar.gz. This is a known location where you can then download the topology package to where it needs to go in order to run the topology.
This class also handles the undo action by copying any existing topology.tar.gz package found in the folder to previous_topology.tar.gz. In the event that the deploy fails and the undo action is triggered the previous_topology.tar.gz file will be renamed to topology.tar.gz effectively rolling back the live code. In the event that the deploy is successful the previous_topology.tar.gz package will be deleted as it is no longer needed.
The config values for this uploader are: heron.class.uploader (required) com.twitter.heron.uploader.s3.S3Uploader heron.uploader.s3.bucket (required) The bucket that you have write access to where you want the topology packages to be stored heron.uploader.s3.path_prefix (optional) Optional prefix for the path to the topology packages heron.uploader.s3.access_key (required) S3 access key that can be used to write to the bucket provided heron.uploader.s3.secret_key (required) S3 access secret that can be used to write to the bucket provided
Modifier and Type | Field and Description |
---|---|
protected com.amazonaws.services.s3.AmazonS3Client |
s3Client |
Constructor and Description |
---|
S3Uploader() |
Modifier and Type | Method and Description |
---|---|
void |
close()
This is to for disposing or cleaning up any internal state accumulated by
the uploader
|
void |
initialize(Config config)
Initialize the uploader with the incoming context.
|
boolean |
undo()
If subsequent stages fail, undo will be called to free resources used by
uploading package.
|
java.net.URI |
uploadPackage()
UploadPackage will upload the topology package to the given location.
|
public void initialize(Config config)
IUploader
initialize
in interface IUploader
public java.net.URI uploadPackage()
IUploader
uploadPackage
in interface IUploader
null
if failed.public boolean undo()
IUploader
public void close()
IUploader
Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.