mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Merge DomainResource into DomainBase
This eliminates the use of Objectify polymorphism for EPP resources entirely (yay!), which makes the Registry 3.0 database migration easier. It is unfortunate that the naming parallelism of EppResources is lost between ContactResource, HostResource, and DomainResource, but the actual type as far as Datastore was concerned was DomainBase all along, and it would be a much more substantial data migration to allow us to continue using the class name DomainResource now that we're no longer using Objectify polymorphism. This simply isn't worth it. This also removes the polymorphic Datastore indexes (which will no longer function as of this change). The non-polymorphic replacement indexes were added in [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=230930546
This commit is contained in:
parent
97c2049669
commit
e2528875b2
166 changed files with 1525 additions and 1666 deletions
|
@ -38,7 +38,7 @@ import google.registry.gcs.GcsUtils;
|
|||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.mapreduce.inputs.NullInput;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.request.Action;
|
||||
|
@ -140,7 +140,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
|||
new GenerateBindFileMapper(
|
||||
tlds, exportTime, dnsDefaultATtl, dnsDefaultNsTtl, dnsDefaultDsTtl),
|
||||
new GenerateBindFileReducer(bucket, exportTime, gcsBufferSize),
|
||||
ImmutableList.of(new NullInput<>(), createEntityInput(DomainResource.class)))
|
||||
ImmutableList.of(new NullInput<>(), createEntityInput(DomainBase.class)))
|
||||
.getLinkToMapreduceConsole();
|
||||
ImmutableList<String> filenames =
|
||||
tlds.stream()
|
||||
|
@ -185,7 +185,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
|||
emit(tld, null);
|
||||
}
|
||||
} else {
|
||||
mapDomain((DomainResource) resource);
|
||||
mapDomain((DomainBase) resource);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
|||
// be emitted in the final file, which is incorrect. Rather, to match the actual DNS glue
|
||||
// records, we only want to emit host information for in-bailiwick hosts in the specified
|
||||
// TLD(s), meaning those that act as nameservers for their respective superordinate domains.
|
||||
private void mapDomain(DomainResource domain) {
|
||||
private void mapDomain(DomainBase domain) {
|
||||
// Domains never change their tld, so we can check if it's from the wrong tld right away.
|
||||
if (tlds.contains(domain.getTld())) {
|
||||
domain = loadAtPointInTime(domain, exportTime).now();
|
||||
|
@ -210,7 +210,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
|||
}
|
||||
}
|
||||
|
||||
private void emitForSubordinateHosts(DomainResource domain) {
|
||||
private void emitForSubordinateHosts(DomainBase domain) {
|
||||
ImmutableSet<String> subordinateHosts = domain.getSubordinateHosts();
|
||||
if (!subordinateHosts.isEmpty()) {
|
||||
for (HostResource unprojectedHost : ofy().load().keys(domain.getNameservers()).values()) {
|
||||
|
@ -276,7 +276,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
|||
* }
|
||||
*/
|
||||
private static String domainStanza(
|
||||
DomainResource domain,
|
||||
DomainBase domain,
|
||||
DateTime exportTime,
|
||||
Duration dnsDefaultNsTtl,
|
||||
Duration dnsDefaultDsTtl) {
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Lists;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.EppResourceUtils;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
|
@ -45,7 +45,7 @@ import org.joda.time.DateTime;
|
|||
path = ListDomainsAction.PATH,
|
||||
method = {GET, POST},
|
||||
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
|
||||
public final class ListDomainsAction extends ListObjectsAction<DomainResource> {
|
||||
public final class ListDomainsAction extends ListObjectsAction<DomainBase> {
|
||||
|
||||
/** An App Engine limitation on how many subqueries can be used in a single query. */
|
||||
@VisibleForTesting @NonFinalForTesting static int maxNumSubqueries = 30;
|
||||
|
@ -71,16 +71,16 @@ public final class ListDomainsAction extends ListObjectsAction<DomainResource> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<DomainResource> loadObjects() {
|
||||
public ImmutableSet<DomainBase> loadObjects() {
|
||||
checkArgument(!tlds.isEmpty(), "Must specify TLDs to query");
|
||||
assertTldsExist(tlds);
|
||||
DateTime now = clock.nowUtc();
|
||||
ImmutableList.Builder<DomainResource> domainsBuilder = new ImmutableList.Builder<>();
|
||||
ImmutableList.Builder<DomainBase> domainsBuilder = new ImmutableList.Builder<>();
|
||||
for (List<String> tldsBatch : Lists.partition(tlds.asList(), maxNumSubqueries)) {
|
||||
domainsBuilder.addAll(
|
||||
ofy()
|
||||
.load()
|
||||
.type(DomainResource.class)
|
||||
.type(DomainBase.class)
|
||||
.filter("tld in", tldsBatch)
|
||||
// Get the N most recently created domains (requires ordering in descending order).
|
||||
.order("-creationTime")
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.dns.DnsQueue;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.Response;
|
||||
|
@ -69,13 +69,13 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
|
|||
.setDefaultMapShards(10)
|
||||
.runMapOnly(
|
||||
new RefreshDnsForAllDomainsActionMapper(tlds),
|
||||
ImmutableList.of(createEntityInput(DomainResource.class)))
|
||||
ImmutableList.of(createEntityInput(DomainBase.class)))
|
||||
.sendLinkToMapreduceConsole(response);
|
||||
}
|
||||
|
||||
/** Mapper to refresh DNS for all active domain resources. */
|
||||
public static class RefreshDnsForAllDomainsActionMapper
|
||||
extends Mapper<DomainResource, Void, Void> {
|
||||
extends Mapper<DomainBase, Void, Void> {
|
||||
|
||||
private static final long serialVersionUID = 1455544013508953083L;
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void map(final DomainResource domain) {
|
||||
public void map(final DomainBase domain) {
|
||||
String domainName = domain.getFullyQualifiedDomainName();
|
||||
if (tlds.contains(domain.getTld())) {
|
||||
if (isActive(domain, DateTime.now(DateTimeZone.UTC))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue