Refactor/rename refresh all DNS action

I'm moving it out of the scrap folder too because there's nothing else
in there and we do want to retain this indefinitely because it's a useful
tool for performing DNS writer migrations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160168902
This commit is contained in:
mcilwain 2017-06-26 11:18:52 -07:00 committed by Ben McIlwain
parent 5a31be12ba
commit 30d5d05fdf
8 changed files with 40 additions and 61 deletions

View file

@ -9,6 +9,7 @@ java_library(
srcs = glob(["*.java"]),
deps = [
"//java/google/registry/config",
"//java/google/registry/dns",
"//java/google/registry/export",
"//java/google/registry/flows",
"//java/google/registry/gcs",

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.tools.server.javascrap;
package google.registry.tools.server;
import static google.registry.mapreduce.inputs.EppResourceInputs.createEntityInput;
import static google.registry.util.PipelineUtils.createJobPath;
@ -33,14 +33,18 @@ import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
/**
* A mapreduce that enqueues publish tasks on all active domains.
* A mapreduce that enqueues DNS publish tasks on all active domains.
*
* <p>This refreshes DNS both for all domain names and all in-bailiwick hostnames, as DNS writers
* are responsible for enqueuing refresh tasks for subordinate hosts. So this action thus refreshes
* DNS for everything applicable under all TLDs under management.
*
* <p>Because there are no auth settings in the {@link Action} annotation, this command can only be
* run internally, or by pretending to be internal by setting the X-AppEngine-QueueName header,
* which only admin users can do.
*/
@Action(
path = "/_dr/task/refreshAllDomains",
path = "/_dr/task/refreshDnsForAllDomains",
auth =
@Auth(
methods = {Auth.AuthMethod.INTERNAL, Auth.AuthMethod.API},
@ -48,13 +52,13 @@ import org.joda.time.DateTimeZone;
userPolicy = Auth.UserPolicy.ADMIN
)
)
public class RefreshAllDomainsAction implements Runnable {
public class RefreshDnsForAllDomainsAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
@Inject MapreduceRunner mrRunner;
@Inject Response response;
@Inject RefreshAllDomainsAction() {}
@Inject RefreshDnsForAllDomainsAction() {}
@Override
public void run() {
@ -65,12 +69,13 @@ public class RefreshAllDomainsAction implements Runnable {
.setModuleName("tools")
.setDefaultMapShards(10)
.runMapOnly(
new RefreshAllDomainsActionMapper(),
new RefreshDnsForAllDomainsActionMapper(),
ImmutableList.of(createEntityInput(DomainResource.class)))));
}
/** Mapper to refresh all active domain resources. */
public static class RefreshAllDomainsActionMapper extends Mapper<DomainResource, Void, Void> {
/** Mapper to refresh DNS for all active domain resources. */
public static class RefreshDnsForAllDomainsActionMapper
extends Mapper<DomainResource, Void, Void> {
private static final DnsQueue dnsQueue = DnsQueue.create();
private static final long serialVersionUID = 1356876487351666133L;

View file

@ -1,26 +0,0 @@
package(
default_visibility = ["//java/google/registry:registry_project"],
)
licenses(["notice"]) # Apache 2.0
java_library(
name = "javascrap",
srcs = glob(["*.java"]),
deps = [
"//java/google/registry/dns",
"//java/google/registry/mapreduce",
"//java/google/registry/mapreduce/inputs",
"//java/google/registry/model",
"//java/google/registry/request",
"//java/google/registry/request/auth",
"//java/google/registry/util",
"//third_party/java/objectify:objectify-v4_1",
"@com_google_appengine_api_1_0_sdk",
"@com_google_appengine_tools_appengine_mapreduce",
"@com_google_code_findbugs_jsr305",
"@com_google_dagger",
"@com_google_guava",
"@joda_time",
],
)