Rename Runnable classes from Tasks to Actions

This is cleanup relating to a naming decision that we made awhile ago
but never got around to.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117244827
This commit is contained in:
mcilwain
2016-03-16 21:20:25 -04:00
committed by Justine Tunney
parent 5f7bf57cf9
commit 57fa57968d
48 changed files with 320 additions and 318 deletions
@@ -43,11 +43,11 @@ import java.io.OutputStream;
import javax.inject.Inject;
/**
* Task that re-encrypts a BRDA escrow deposit and puts it into the upload bucket.
* Action that re-encrypts a BRDA escrow deposit and puts it into the upload bucket.
*
* <p>This task is run by the mapreduce for each BRDA staging file it generates. The staging file is
* encrypted with our internal {@link Ghostryde} encryption. We then re-encrypt it as a RyDE file,
* which is what the third-party escrow provider understands.
* <p>This action is run by the mapreduce for each BRDA staging file it generates. The staging file
* is encrypted with our internal {@link Ghostryde} encryption. We then re-encrypt it as a RyDE
* file, which is what the third-party escrow provider understands.
*
* <p>Then we put the RyDE file (along with our digital signature) into the configured BRDA bucket.
* This bucket is special because a separate script will rsync it to the third party escrow provider
@@ -55,8 +55,8 @@ import javax.inject.Inject;
*
* @see "http://newgtlds.icann.org/en/applicants/agb/agreement-approved-09jan14-en.htm"
*/
@Action(path = BrdaCopyTask.PATH, method = POST, automaticallyPrintOk = true)
public final class BrdaCopyTask implements Runnable {
@Action(path = BrdaCopyAction.PATH, method = POST, automaticallyPrintOk = true)
public final class BrdaCopyAction implements Runnable {
static final String PATH = "/_dr/task/brdaCopy";
@@ -76,7 +76,7 @@ public final class BrdaCopyTask implements Runnable {
@Inject @Key("brdaReceiverKey") PGPPublicKey receiverKey;
@Inject @Key("brdaSigningKey") PGPKeyPair signingKey;
@Inject @Key("rdeStagingDecryptionKey") PGPPrivateKey stagingDecryptionKey;
@Inject BrdaCopyTask() {}
@Inject BrdaCopyAction() {}
@Override
public void run() {
@@ -40,7 +40,7 @@ import javax.inject.Inject;
* as-needed basis.
*
* @see JSchSftpChannel
* @see RdeUploadTask
* @see RdeUploadAction
* @see com.jcraft.jsch.Session
*/
final class JSchSshSession implements Closeable {
@@ -48,10 +48,10 @@ import java.io.InputStream;
import javax.inject.Inject;
/**
* Uploads a small XML RDE report to ICANN after {@link RdeUploadTask} has finished.
* Action that uploads a small XML RDE report to ICANN after {@link RdeUploadAction} has finished.
*/
@Action(path = RdeReportTask.PATH, method = POST)
public final class RdeReportTask implements Runnable, EscrowTask {
@Action(path = RdeReportAction.PATH, method = POST)
public final class RdeReportAction implements Runnable, EscrowTask {
static final String PATH = "/_dr/task/rdeReport";
@@ -67,7 +67,7 @@ public final class RdeReportTask implements Runnable, EscrowTask {
@Inject @Config("rdeInterval") Duration interval;
@Inject @Config("rdeReportLockTimeout") Duration timeout;
@Inject @Key("rdeStagingDecryptionKey") PGPPrivateKey stagingDecryptionKey;
@Inject RdeReportTask() {}
@Inject RdeReportAction() {}
@Override
public void run() {
@@ -80,7 +80,7 @@ public final class RdeReportTask implements Runnable, EscrowTask {
RegistryCursor.load(Registry.get(tld), CursorType.RDE_UPLOAD).or(START_OF_TIME);
if (!stagingCursor.isAfter(watermark)) {
logger.infofmt("tld=%s reportCursor=%s uploadCursor=%s", tld, watermark, stagingCursor);
throw new NoContentException("Waiting for RdeUploadTask to complete");
throw new NoContentException("Waiting for RdeUploadAction to complete");
}
String prefix = RdeNamingUtils.makeRydeFilename(tld, watermark, FULL, 1, 0);
GcsFilename reportFilename = new GcsFilename(bucket, prefix + "-report.xml.ghostryde");
@@ -51,7 +51,7 @@ import javax.inject.Inject;
/**
* Class that uploads a decrypted XML deposit report to ICANN's webserver.
*
* @see RdeReportTask
* @see RdeReportAction
*/
public class RdeReporter {
@@ -67,7 +67,7 @@ import javax.inject.Inject;
* <p>The XML deposit files generated by this job are humongous. A tiny XML report file is generated
* for each deposit, telling us how much of what it contains.
*
* <p>Once a deposit is successfully generated, an {@link RdeUploadTask} is enqueued which will
* <p>Once a deposit is successfully generated, an {@link RdeUploadAction} is enqueued which will
* upload it via SFTP to the third-party escrow provider.
*
* <p>To generate escrow deposits manually and locally, use the {@code registry_tool} command
@@ -128,7 +128,7 @@ import javax.inject.Inject;
* Duplicate jobs may exist {@code <=cursor}. So a transaction will not bother changing the cursor
* if it's already been rolled forward.
*
* <p>Enqueueing {@code RdeUploadTask} is also part of the cursor transaction. This is necessary
* <p>Enqueueing {@code RdeUploadAction} is also part of the cursor transaction. This is necessary
* because the first thing the upload task does is check the staging cursor to verify it's been
* completed, so we can't enqueue before we roll. We also can't enqueue after the roll, because then
* if enqueueing fails, the upload might never be enqueued.
@@ -169,7 +169,7 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
// Write a file to GCS containing the byte length (ASCII) of the raw unencrypted XML.
//
// This is necessary because RdeUploadTask creates a tar file which requires that the length
// This is necessary because RdeUploadAction creates a tar file which requires that the length
// be outputted. We don't want to have to decrypt the entire ghostryde file to determine the
// length, so we just save it separately.
logger.infofmt("Writing %s", xmlLengthFilename);
@@ -195,7 +195,7 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
}
}
// Now that we're done, kick off RdeUploadTask and roll forward the cursor transactionally.
// Now that we're done, kick off RdeUploadAction and roll forward the cursor transactionally.
ofy().transact(new VoidWork() {
@Override
public void vrun() {
@@ -213,11 +213,11 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
RdeRevision.saveRevision(tld, watermark, mode, revision);
if (mode == RdeMode.FULL) {
taskEnqueuer.enqueue(getQueue("rde-upload"),
withUrl(RdeUploadTask.PATH)
withUrl(RdeUploadAction.PATH)
.param(RequestParameters.PARAM_TLD, tld));
} else {
taskEnqueuer.enqueue(getQueue("brda"),
withUrl(BrdaCopyTask.PATH)
withUrl(BrdaCopyAction.PATH)
.param(RequestParameters.PARAM_TLD, tld)
.param(RdeModule.PARAM_WATERMARK, watermark.toString()));
}
@@ -67,17 +67,17 @@ import javax.inject.Inject;
import javax.inject.Named;
/**
* Task that securely uploads an RDE XML file from Cloud Storage to a trusted third party (such as
* Action that securely uploads an RDE XML file from Cloud Storage to a trusted third party (such as
* Iron Mountain) via SFTP.
*
* <p>This task is invoked by {@link RdeStagingAction} once it's created the files we need. The date
* is calculated from {@link CursorType#RDE_UPLOAD}.
* <p>This action is invoked by {@link RdeStagingAction} once it's created the files we need. The
* date is calculated from {@link CursorType#RDE_UPLOAD}.
*
* <p>Once this task completes, it rolls the cursor forward a day and triggers
* {@link RdeReportTask}.
* <p>Once this action completes, it rolls the cursor forward a day and triggers
* {@link RdeReportAction}.
*/
@Action(path = RdeUploadTask.PATH, method = POST)
public final class RdeUploadTask implements Runnable, EscrowTask {
@Action(path = RdeUploadAction.PATH, method = POST)
public final class RdeUploadAction implements Runnable, EscrowTask {
static final String PATH = "/_dr/task/rdeUpload";
@@ -106,14 +106,14 @@ public final class RdeUploadTask implements Runnable, EscrowTask {
@Inject @Key("rdeSigningKey") PGPKeyPair signingKey;
@Inject @Key("rdeStagingDecryptionKey") PGPPrivateKey stagingDecryptionKey;
@Inject @Named("rde-report") Queue reportQueue;
@Inject RdeUploadTask() {}
@Inject RdeUploadAction() {}
@Override
public void run() {
runner.lockRunAndRollForward(this, Registry.get(tld), timeout, CursorType.RDE_UPLOAD, interval);
taskEnqueuer.enqueue(
reportQueue,
withUrl(RdeReportTask.PATH).param(RequestParameters.PARAM_TLD, tld));
withUrl(RdeReportAction.PATH).param(RequestParameters.PARAM_TLD, tld));
}
@Override
@@ -122,7 +122,7 @@ public final class RdeUploadTask implements Runnable, EscrowTask {
RegistryCursor.load(Registry.get(tld), CursorType.RDE_STAGING).or(START_OF_TIME);
if (!stagingCursor.isAfter(watermark)) {
logger.infofmt("tld=%s uploadCursor=%s stagingCursor=%s", tld, watermark, stagingCursor);
throw new ServiceUnavailableException("Waiting for RdeStagingTask to complete");
throw new ServiceUnavailableException("Waiting for RdeStagingAction to complete");
}
DateTime sftpCursor =
RegistryCursor.load(Registry.get(tld), CursorType.RDE_UPLOAD_SFTP).or(START_OF_TIME);
@@ -37,7 +37,7 @@ import javax.annotation.concurrent.Immutable;
* preferable to using a plain {@link URI}.
*
* @see java.net.URI
* @see RdeUploadTask
* @see RdeUploadAction
*/
@Immutable
final class RdeUploadUrl implements Comparable<RdeUploadUrl> {