mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Refer to Datastore everywhere correctly by its capitalized form
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=147479683
This commit is contained in:
parent
a8cf81bca2
commit
cdadb54acd
123 changed files with 232 additions and 235 deletions
|
@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlTransient;
|
|||
*/
|
||||
public abstract class BackupGroupRoot extends ImmutableObject {
|
||||
/**
|
||||
* An automatically managed timestamp of when this object was last written to datastore.
|
||||
* An automatically managed timestamp of when this object was last written to Datastore.
|
||||
*
|
||||
* <p>Note that this is distinct from the EPP-specified {@link EppResource#lastEppUpdateTime}, in
|
||||
* that this is updated on every save, rather than only in response to an {@code <update>} command
|
||||
|
|
|
@ -29,7 +29,7 @@ public class CacheUtils {
|
|||
* Memoize a supplier, with a short expiration specified in the environment config.
|
||||
*
|
||||
* <p>Use this for things that might change while code is running. (For example, the various
|
||||
* lists downloaded from the TMCH get updated in datastore and the caches need to be refreshed.)
|
||||
* lists downloaded from the TMCH get updated in Datastore and the caches need to be refreshed.)
|
||||
*/
|
||||
public static <T> Supplier<T> memoizeWithShortExpiration(Supplier<T> original) {
|
||||
Duration expiration = getSingletonCacheRefreshDuration();
|
||||
|
|
|
@ -18,7 +18,7 @@ import google.registry.model.translators.CreateAutoTimestampTranslatorFactory;
|
|||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* A timestamp that auto-updates when first saved to datastore.
|
||||
* A timestamp that auto-updates when first saved to Datastore.
|
||||
*
|
||||
* @see CreateAutoTimestampTranslatorFactory
|
||||
*/
|
||||
|
|
|
@ -112,10 +112,10 @@ public final class EntityClasses {
|
|||
TmchCrl.class);
|
||||
|
||||
/**
|
||||
* Function that converts an Objectify-registered class to its datastore kind name.
|
||||
* Function that converts an Objectify-registered class to its Datastore kind name.
|
||||
*
|
||||
* <p>Note that this mapping is not one-to-one, since polymorphic subclasses of an entity all
|
||||
* have the same datastore kind. (In theory, two distinct top-level entities could also map to
|
||||
* have the same Datastore kind. (In theory, two distinct top-level entities could also map to
|
||||
* the same kind since it's just {@code class.getSimpleName()}, but we test against that.)
|
||||
*/
|
||||
public static final Function<Class<? extends ImmutableObject>, String> CLASS_TO_KIND_FUNCTION =
|
||||
|
|
|
@ -72,14 +72,14 @@ public final class EppResourceUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads the last created version of an {@link EppResource} from the datastore by foreign key.
|
||||
* Loads the last created version of an {@link EppResource} from Datastore by foreign key.
|
||||
*
|
||||
* <p>Returns null if no resource with this foreign key was ever created, or if the most recently
|
||||
* created resource was deleted before time "now".
|
||||
*
|
||||
* <p>Loading an {@link EppResource} by itself is not sufficient to know its current state since
|
||||
* it may have various expirable conditions and status values that might implicitly change its
|
||||
* state as time progresses even if it has not been updated in the datastore. Rather, the resource
|
||||
* state as time progresses even if it has not been updated in Datastore. Rather, the resource
|
||||
* must be combined with a timestamp to view its current state. We use a global last updated
|
||||
* timestamp on the entire entity group (which is essentially free since all writes to the entity
|
||||
* group must be serialized anyways) to guarantee monotonically increasing write times, so
|
||||
|
@ -131,7 +131,7 @@ public final class EppResourceUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks multiple {@link EppResource} objects from the datastore by unique ids.
|
||||
* Checks multiple {@link EppResource} objects from Datastore by unique ids.
|
||||
*
|
||||
* <p>There are currently no resources that support checks and do not use foreign keys. If we need
|
||||
* to support that case in the future, we can loosen the type to allow any {@link EppResource} and
|
||||
|
@ -236,7 +236,7 @@ public final class EppResourceUtils {
|
|||
* perform a single asynchronous key fetch operation.
|
||||
*
|
||||
* <p><b>Warning:</b> A resource can only be rolled backwards in time, not forwards; therefore
|
||||
* {@code resource} should be whatever's currently in datastore.
|
||||
* {@code resource} should be whatever's currently in Datastore.
|
||||
*
|
||||
* <p><b>Warning:</b> Revisions are granular to 24-hour periods. It's recommended that
|
||||
* {@code timestamp} be set to midnight. Otherwise you must take into consideration that under
|
||||
|
@ -277,7 +277,7 @@ public final class EppResourceUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an asynchronous result holding the most recent datastore revision of a given
|
||||
* Returns an asynchronous result holding the most recent Datastore revision of a given
|
||||
* EppResource before or at the provided timestamp using the EppResource revisions map, falling
|
||||
* back to using the earliest revision or the resource as-is if there are no revisions.
|
||||
*
|
||||
|
|
|
@ -129,7 +129,7 @@ public class ModelUtils {
|
|||
static Set<Class<?>> getPersistedFieldTypes(Class<?> clazz) {
|
||||
ImmutableSet.Builder<Class<?>> builder = new ImmutableSet.Builder<>();
|
||||
for (Field field : getAllFields(clazz).values()) {
|
||||
// Skip fields that aren't persisted to datastore.
|
||||
// Skip fields that aren't persisted to Datastore.
|
||||
if (field.isAnnotationPresent(Ignore.class)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import google.registry.model.translators.UpdateAutoTimestampTranslatorFactory;
|
|||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* A timestamp that auto-updates on each save to datastore.
|
||||
* A timestamp that auto-updates on each save to Datastore.
|
||||
*
|
||||
* @see UpdateAutoTimestampTranslatorFactory
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* Annotation for an Objectify {@link Entity} to indicate that it should not be backed up by the
|
||||
* default datastore backup configuration (it may be backed up by something else).
|
||||
* default Datastore backup configuration (it may be backed up by something else).
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
|
|
|
@ -218,7 +218,7 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
Integer periodYears = null;
|
||||
|
||||
/**
|
||||
* For {@link Flag#SYNTHETIC} events, when this event was persisted to datastore (i.e. the
|
||||
* For {@link Flag#SYNTHETIC} events, when this event was persisted to Datastore (i.e. the
|
||||
* cursor position at the time the recurrence expansion job was last run). In the event a job
|
||||
* needs to be undone, a query on this field will return the complete set of potentially bad
|
||||
* events.
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.joda.time.DateTime;
|
|||
* <p>This is a one-off single-entry bookkeeping system. There is a separate account for each
|
||||
* (registrar, currency) pair.
|
||||
*
|
||||
* <p>You should never update these entities once they've been inserted into datastore. If you need
|
||||
* <p>You should never update these entities once they've been inserted into Datastore. If you need
|
||||
* to change something, add a correction entry.
|
||||
*/
|
||||
@Entity
|
||||
|
@ -79,7 +79,7 @@ public class RegistrarBillingEntry extends ImmutableObject implements Jsonifiabl
|
|||
* Currency of transaction.
|
||||
*
|
||||
* <p>This field is identical to {@code amount.getCurrencyUnit()} and is only here so it can be
|
||||
* indexed in datastore.
|
||||
* indexed in Datastore.
|
||||
*/
|
||||
@Index
|
||||
CurrencyUnit currency;
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.googlecode.objectify.annotation.Id;
|
|||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.ImmutableObject;
|
||||
|
||||
/** A singleton entity in the datastore. */
|
||||
/** A singleton entity in Datastore. */
|
||||
public abstract class CrossTldSingleton extends ImmutableObject {
|
||||
|
||||
public static final long SINGLETON_ID = 1; // There is always exactly one of these.
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.joda.time.DateTime;
|
|||
@Entity
|
||||
public class Cursor extends ImmutableObject {
|
||||
|
||||
/** The types of cursors, used as the string id field for each cursor in datastore. */
|
||||
/** The types of cursors, used as the string id field for each cursor in Datastore. */
|
||||
public enum CursorType {
|
||||
/** Cursor for ensuring rolling transactional isolation of BRDA staging operation. */
|
||||
BRDA(Registry.class),
|
||||
|
|
|
@ -29,7 +29,7 @@ import google.registry.model.annotations.NotBackedUp.Reason;
|
|||
|
||||
/**
|
||||
* A helper class to convert email addresses to GAE user ids. It does so by persisting a User
|
||||
* object with the email address to datastore, and then immediately reading it back.
|
||||
* object with the email address to Datastore, and then immediately reading it back.
|
||||
*/
|
||||
@Entity
|
||||
@NotBackedUp(reason = Reason.TRANSIENT)
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.google.common.collect.Range;
|
|||
import com.googlecode.objectify.annotation.Embed;
|
||||
import google.registry.model.ImmutableObject;
|
||||
|
||||
/** An object that's equivalent to a {@code Range<Long>} that can be persisted to datastore. */
|
||||
/** An object that's equivalent to a {@code Range<Long>} that can be persisted to Datastore. */
|
||||
@Embed
|
||||
public class PersistedRangeLong extends ImmutableObject {
|
||||
|
||||
|
|
|
@ -38,21 +38,21 @@ import javax.annotation.Nullable;
|
|||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* An entity property whose value transitions over time. Each value it takes on becomes active
|
||||
* at a corresponding instant, and remains active until the next transition occurs. At least one
|
||||
* "start of time" value (corresponding to START_OF_TIME, i.e. the Unix epoch) must be provided
|
||||
* so that the property will have a value for all possible times.
|
||||
* An entity property whose value transitions over time. Each value it takes on becomes active at a
|
||||
* corresponding instant, and remains active until the next transition occurs. At least one "start
|
||||
* of time" value (corresponding to START_OF_TIME, i.e. the Unix epoch) must be provided so that the
|
||||
* property will have a value for all possible times.
|
||||
*
|
||||
* <p>This concept is naturally represented by a sorted map of {@code DateTime} to {@code V}, but
|
||||
* the AppEngine datastore cannot natively represent a map keyed on non-strings. Instead, we store
|
||||
* the App Engine Datastore cannot natively represent a map keyed on non-strings. Instead, we store
|
||||
* an ordered list of transitions and use Objectify's @Mapify annotation to automatically recreate
|
||||
* the sorted map on load from the datastore, which is used as a backing map for this property; the
|
||||
* the sorted map on load from Datastore, which is used as a backing map for this property; the
|
||||
* property itself also implements Map by way of extending ForwardingMap, so that this property can
|
||||
* stored directly as the @Mapify field in the entity.
|
||||
*
|
||||
* <p>The type parameter {@code T} specifies a user-defined subclass of {@code TimedTransition<V>}
|
||||
* to use for storing the list of transitions. The user is given this choice of subclass so that
|
||||
* the field of the value type stored in the transition can be given a customized name.
|
||||
* to use for storing the list of transitions. The user is given this choice of subclass so that the
|
||||
* field of the value type stored in the transition can be given a customized name.
|
||||
*/
|
||||
public class TimedTransitionProperty<V, T extends TimedTransitionProperty.TimedTransition<V>>
|
||||
extends ForwardingMap<DateTime, T> {
|
||||
|
@ -62,7 +62,7 @@ public class TimedTransitionProperty<V, T extends TimedTransitionProperty.TimedT
|
|||
* for the {@code DateTime}, which means that subclasses should supply the field of type {@code V}
|
||||
* and implementations of the abstract getter and setter methods to access that field. This design
|
||||
* is so that subclasses tagged with @Embed can define a custom field name for their value, for
|
||||
* the purpose of backwards compatibility and better readability of the datastore representation.
|
||||
* the purpose of backwards compatibility and better readability of the Datastore representation.
|
||||
*
|
||||
* <p>The public visibility of this class exists only so that it can be subclassed; clients should
|
||||
* never call any methods on this class or attempt to access its members, but should instead treat
|
||||
|
@ -235,17 +235,15 @@ public class TimedTransitionProperty<V, T extends TimedTransitionProperty.TimedT
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new mutable {@code TimedTransitionProperty} representing the given map of DateTime
|
||||
* to value, with transitions constructed using the given {@code TimedTransition} subclass.
|
||||
* Returns a new mutable {@code TimedTransitionProperty} representing the given map of DateTime to
|
||||
* value, with transitions constructed using the given {@code TimedTransition} subclass.
|
||||
*
|
||||
* <p>This method should only be used for initializing fields that are declared with the
|
||||
* @Mapify annotation. The map for those fields must be mutable so that Objectify can load values
|
||||
* from the datastore into the map, but clients should still never mutate the field's map
|
||||
* directly.
|
||||
* <p>This method should only be used for initializing fields that are declared with the @Mapify
|
||||
* annotation. The map for those fields must be mutable so that Objectify can load values from
|
||||
* Datastore into the map, but clients should still never mutate the field's map directly.
|
||||
*/
|
||||
public static <V, T extends TimedTransition<V>> TimedTransitionProperty<V, T> forMapify(
|
||||
ImmutableSortedMap<DateTime, V> valueMap,
|
||||
Class<T> timedTransitionSubclass) {
|
||||
ImmutableSortedMap<DateTime, V> valueMap, Class<T> timedTransitionSubclass) {
|
||||
return new TimedTransitionProperty<>(
|
||||
new TreeMap<>(makeTransitionMap(valueMap, timedTransitionSubclass)));
|
||||
}
|
||||
|
@ -254,10 +252,9 @@ public class TimedTransitionProperty<V, T extends TimedTransitionProperty.TimedT
|
|||
* Returns a new mutable {@code TimedTransitionProperty} representing the given value being set at
|
||||
* start of time, constructed using the given {@code TimedTransition} subclass.
|
||||
*
|
||||
* <p>This method should only be used for initializing fields that are declared with the
|
||||
* @Mapify annotation. The map for those fields must be mutable so that Objectify can load values
|
||||
* from the datastore into the map, but clients should still never mutate the field's map
|
||||
* directly.
|
||||
* <p>This method should only be used for initializing fields that are declared with the @Mapify
|
||||
* annotation. The map for those fields must be mutable so that Objectify can load values from
|
||||
* Datastore into the map, but clients should still never mutate the field's map directly.
|
||||
*/
|
||||
public static <V, T extends TimedTransition<V>> TimedTransitionProperty<V, T> forMapify(
|
||||
V valueAtStartOfTime, Class<T> timedTransitionSubclass) {
|
||||
|
|
|
@ -127,7 +127,7 @@ public class ContactCommand {
|
|||
* Unique identifier for this contact.
|
||||
*
|
||||
* <p>This is only unique in the sense that for any given lifetime specified as the time range
|
||||
* from (creationTime, deletionTime) there can only be one contact in the datastore with this
|
||||
* from (creationTime, deletionTime) there can only be one contact in Datastore with this
|
||||
* id. However, there can be many contacts with the same id and non-overlapping lifetimes.
|
||||
*/
|
||||
@XmlElement(name = "id")
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ContactResource extends EppResource
|
|||
* Unique identifier for this contact.
|
||||
*
|
||||
* <p>This is only unique in the sense that for any given lifetime specified as the time range
|
||||
* from (creationTime, deletionTime) there can only be one contact in the datastore with this id.
|
||||
* from (creationTime, deletionTime) there can only be one contact in Datastore with this id.
|
||||
* However, there can be many contacts with the same id and non-overlapping lifetimes.
|
||||
*/
|
||||
String contactId;
|
||||
|
@ -163,7 +163,7 @@ public class ContactResource extends EppResource
|
|||
* Postal info for the contact.
|
||||
*
|
||||
* <p>The XML marshalling expects the {@link PostalInfo} objects in a list, but we can't actually
|
||||
* persist them to datastore that way because Objectify can't handle collections of embedded
|
||||
* persist them to Datastore that way because Objectify can't handle collections of embedded
|
||||
* objects that themselves contain collections, and there's a list of streets inside. This method
|
||||
* transforms the persisted format to the XML format for marshalling.
|
||||
*/
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class DomainBase extends EppResource {
|
|||
* Fully qualified domain name (puny-coded), which serves as the foreign key for this domain.
|
||||
*
|
||||
* <p>This is only unique in the sense that for any given lifetime specified as the time range
|
||||
* from (creationTime, deletionTime) there can only be one domain in the datastore with this name.
|
||||
* from (creationTime, deletionTime) there can only be one domain in Datastore with this name.
|
||||
* However, there can be many domains with the same name and non-overlapping lifetimes.
|
||||
*
|
||||
* @invariant fullyQualifiedDomainName == fullyQualifiedDomainName.toLowerCase()
|
||||
|
|
|
@ -287,7 +287,7 @@ public class DomainResource extends DomainBase
|
|||
.setAutorenewBillingEvent(transferData.getServerApproveAutorenewEvent())
|
||||
.setAutorenewPollMessage(transferData.getServerApproveAutorenewPollMessage())
|
||||
// Set the grace period using a key to the prescheduled transfer billing event. Not using
|
||||
// GracePeriod.forBillingEvent() here in order to avoid the actual datastore fetch.
|
||||
// GracePeriod.forBillingEvent() here in order to avoid the actual Datastore fetch.
|
||||
.setGracePeriods(ImmutableSet.of(GracePeriod.create(
|
||||
GracePeriodStatus.TRANSFER,
|
||||
transferExpirationTime.plus(Registry.get(getTld()).getTransferGracePeriodLength()),
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.joda.time.DateTime;
|
|||
* A domain grace period with an expiration time.
|
||||
*
|
||||
* <p>When a grace period expires, it is lazily removed from the {@link DomainResource} the next
|
||||
* time the resource is loaded from the datastore.
|
||||
* time the resource is loaded from Datastore.
|
||||
*/
|
||||
@Embed
|
||||
public class GracePeriod extends ImmutableObject {
|
||||
|
@ -120,7 +120,7 @@ public class GracePeriod extends ImmutableObject {
|
|||
* Creates a GracePeriod for an (optional) OneTime billing event.
|
||||
*
|
||||
* <p>Normal callers should always use {@link #forBillingEvent} instead, assuming they do not
|
||||
* need to avoid loading the BillingEvent from datastore. This method should typically be
|
||||
* need to avoid loading the BillingEvent from Datastore. This method should typically be
|
||||
* called only from test code to explicitly construct GracePeriods.
|
||||
*/
|
||||
public static GracePeriod create(
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* Nomulus datastore model common/shared classes.
|
||||
* Nomulus Datastore model common/shared classes.
|
||||
*
|
||||
* <p>This package is intended to hold classes which are shared across multiple XML namespaces. As
|
||||
* such, no default namespace is declared in this package, and all objects in this package should be
|
||||
|
|
|
@ -61,7 +61,7 @@ public class HostResource extends EppResource implements ForeignKeyedEppResource
|
|||
* Fully qualified hostname, which is a unique identifier for this host.
|
||||
*
|
||||
* <p>This is only unique in the sense that for any given lifetime specified as the time range
|
||||
* from (creationTime, deletionTime) there can only be one host in the datastore with this name.
|
||||
* from (creationTime, deletionTime) there can only be one host in Datastore with this name.
|
||||
* However, there can be many hosts with the same name and non-overlapping lifetimes.
|
||||
*/
|
||||
@Index
|
||||
|
|
|
@ -124,7 +124,7 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads a {@link Key} to an {@link EppResource} from the datastore by foreign key.
|
||||
* Loads a {@link Key} to an {@link EppResource} from Datastore by foreign key.
|
||||
*
|
||||
* <p>Returns null if no foreign key index with this foreign key was ever created, or if the
|
||||
* most recently created foreign key index was deleted before time "now". This method does not
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.joda.time.DateTime;
|
|||
* transaction throughput, while maintaining the ability to perform strongly-consistent ancestor
|
||||
* queries.
|
||||
*
|
||||
* @see <a href="https://cloud.google.com/appengine/articles/scaling/contention">Avoiding datastore
|
||||
* @see <a href="https://cloud.google.com/appengine/articles/scaling/contention">Avoiding Datastore
|
||||
* contention</a>
|
||||
*/
|
||||
@Entity
|
||||
|
|
|
@ -32,14 +32,14 @@ import java.util.Objects;
|
|||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* Entity representing a point-in-time consistent view of datastore, based on commit logs.
|
||||
* Entity representing a point-in-time consistent view of Datastore, based on commit logs.
|
||||
*
|
||||
* <p>Conceptually, this entity consists of two pieces of information: the checkpoint "wall" time
|
||||
* and a set of bucket checkpoint times. The former is the ID for this checkpoint (constrained
|
||||
* to be unique upon checkpoint creation) and also represents the approximate wall time of the
|
||||
* consistent datastore view this checkpoint represents. The latter is really a mapping from
|
||||
* consistent Datastore view this checkpoint represents. The latter is really a mapping from
|
||||
* bucket ID to timestamp, where the timestamp dictates the upper bound (inclusive) on commit logs
|
||||
* from that bucket to include when restoring the datastore to this checkpoint.
|
||||
* from that bucket to include when restoring Datastore to this checkpoint.
|
||||
*/
|
||||
@Entity
|
||||
@NotBackedUp(reason = Reason.COMMIT_LOGS)
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Set;
|
|||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* Archived datastore transaction that can be replayed.
|
||||
* Archived Datastore transaction that can be replayed.
|
||||
*
|
||||
* <p>Entities of this kind are entity group sharded using a {@link CommitLogBucket} parent. Each
|
||||
* object that was saved during this transaction is stored in a {@link CommitLogMutation} child
|
||||
|
|
|
@ -62,14 +62,14 @@ public class CommitLogMutation extends ImmutableObject {
|
|||
* Returns a new mutation entity created from an @Entity ImmutableObject instance.
|
||||
*
|
||||
* <p>The mutation key is generated deterministically from the {@code entity} key. The object is
|
||||
* converted to a raw datastore Entity, serialized to bytes, and stored within the mutation.
|
||||
* converted to a raw Datastore Entity, serialized to bytes, and stored within the mutation.
|
||||
*/
|
||||
public static CommitLogMutation create(Key<CommitLogManifest> parent, Object entity) {
|
||||
return createFromRaw(parent, ofy().save().toEntity(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new mutation entity created from a raw datastore Entity instance.
|
||||
* Returns a new mutation entity created from a raw Datastore Entity instance.
|
||||
*
|
||||
* <p>The mutation key is generated deterministically from the {@code entity} key. The Entity
|
||||
* itself is serialized to bytes and stored within the returned mutation.
|
||||
|
|
|
@ -102,8 +102,8 @@ public class ObjectifyService {
|
|||
|
||||
@Override
|
||||
protected AsyncDatastoreService createRawAsyncDatastoreService(DatastoreServiceConfig cfg) {
|
||||
// In the unit test environment, wrap the datastore service in a proxy that can be used to
|
||||
// examine the number of requests sent to datastore.
|
||||
// In the unit test environment, wrap the Datastore service in a proxy that can be used to
|
||||
// examine the number of requests sent to Datastore.
|
||||
AsyncDatastoreService service = super.createRawAsyncDatastoreService(cfg);
|
||||
return RegistryEnvironment.get().equals(RegistryEnvironment.UNITTEST)
|
||||
? new RequestCapturingAsyncDatastoreService(service)
|
||||
|
@ -134,7 +134,7 @@ public class ObjectifyService {
|
|||
}
|
||||
}
|
||||
|
||||
/** Register classes that can be persisted via Objectify as datastore entities. */
|
||||
/** Register classes that can be persisted via Objectify as Datastore entities. */
|
||||
private static void registerEntityClasses(
|
||||
Iterable<Class<? extends ImmutableObject>> entityClasses) {
|
||||
// Register all the @Entity classes before any @EntitySubclass classes so that we can check
|
||||
|
|
|
@ -69,7 +69,7 @@ public class Ofy {
|
|||
*
|
||||
* <p>This value should used as a cache expiration time for any entities annotated with an
|
||||
* Objectify {@code @Cache} annotation, to put an upper bound on unlikely-but-possible divergence
|
||||
* between memcache and datastore when a memcache write fails.
|
||||
* between memcache and Datastore when a memcache write fails.
|
||||
*/
|
||||
public static final int RECOMMENDED_MEMCACHE_EXPIRATION = 3600;
|
||||
|
||||
|
@ -230,7 +230,7 @@ public class Ofy {
|
|||
| DatastoreFailureException e) {
|
||||
// TransientFailureExceptions come from task queues and always mean nothing committed.
|
||||
// TimestampInversionExceptions are thrown by our code and are always retryable as well.
|
||||
// However, datastore exceptions might get thrown even if the transaction succeeded.
|
||||
// However, Datastore exceptions might get thrown even if the transaction succeeded.
|
||||
if ((e instanceof DatastoreTimeoutException || e instanceof DatastoreFailureException)
|
||||
&& checkIfAlreadySucceeded(work)) {
|
||||
return work.getResult();
|
||||
|
@ -255,10 +255,10 @@ public class Ofy {
|
|||
CommitLogManifest manifest = work.getManifest();
|
||||
if (manifest == null) {
|
||||
// Work ran but no commit log was created. This might mean that the transaction did not
|
||||
// write anything to datastore. We can safely retry because it only reads. (Although the
|
||||
// write anything to Datastore. We can safely retry because it only reads. (Although the
|
||||
// transaction might have written a task to a queue, we consider that safe to retry too
|
||||
// since we generally assume that tasks might be doubly executed.) Alternatively it
|
||||
// might mean that the transaction wrote to datastore but turned off commit logs by
|
||||
// might mean that the transaction wrote to Datastore but turned off commit logs by
|
||||
// exclusively using save/deleteWithoutBackups() rather than save/delete(). Although we
|
||||
// have no hard proof that retrying is safe, we use these methods judiciously and it is
|
||||
// reasonable to assume that if the transaction really did succeed that the retry will
|
||||
|
@ -300,7 +300,7 @@ public class Ofy {
|
|||
/**
|
||||
* Execute some work with a fresh session cache.
|
||||
*
|
||||
* <p>This is useful in cases where we want to load the latest possible data from datastore but
|
||||
* <p>This is useful in cases where we want to load the latest possible data from Datastore but
|
||||
* don't need point-in-time consistency across loads and consequently don't need a transaction.
|
||||
* Note that unlike a transaction's fresh session cache, the contents of this cache will be
|
||||
* discarded once the work completes, rather than being propagated into the enclosing session.
|
||||
|
|
|
@ -39,9 +39,9 @@ public class RequestCapturingAsyncDatastoreService implements AsyncDatastoreServ
|
|||
|
||||
private final AsyncDatastoreService delegate;
|
||||
|
||||
// Each outer lists represents datastore operations, with inner lists representing the keys or
|
||||
// Each outer lists represents Datastore operations, with inner lists representing the keys or
|
||||
// entities involved in that operation. We use static lists because we care about overall calls to
|
||||
// datastore, not calls via a specific instance of the service.
|
||||
// Datastore, not calls via a specific instance of the service.
|
||||
|
||||
private static List<List<Key>> reads = synchronizedList(new ArrayList<List<Key>>());
|
||||
private static List<List<Key>> deletes = synchronizedList(new ArrayList<List<Key>>());
|
||||
|
|
|
@ -24,8 +24,8 @@ import java.util.Map;
|
|||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* Exception when trying to write to the datastore with a timestamp that is inconsistent with
|
||||
* a partial ordering on transactions that touch the same entities.
|
||||
* Exception when trying to write to Datastore with a timestamp that is inconsistent with a partial
|
||||
* ordering on transactions that touch the same entities.
|
||||
*/
|
||||
class TimestampInversionException extends RuntimeException {
|
||||
|
||||
|
|
|
@ -42,6 +42,6 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
|||
* <p>Command classes are never persisted, and the Objectify annotations on the Create and Update
|
||||
* classes are purely for the benefit of the derived Resource classes that inherit from them.
|
||||
* Whenever a command that mutates the model is executed, a HistoryEvent is stored with the affected
|
||||
* Resource as its datastore parent. All history entries have an indexed modification time field so
|
||||
* Resource as its Datastore parent. All history entries have an indexed modification time field so
|
||||
* that the history can be read in chronological order.
|
||||
*/
|
||||
|
|
|
@ -62,10 +62,10 @@ public final class RdeRevision extends ImmutableObject {
|
|||
* Sets the revision ID for a given triplet.
|
||||
*
|
||||
* <p>This method verifies that the current revision is {@code revision - 1}, or that the object
|
||||
* does not exist in datastore if {@code revision == 0}.
|
||||
* does not exist in Datastore if {@code revision == 0}.
|
||||
*
|
||||
* @throws IllegalStateException if not in a transaction
|
||||
* @throws VerifyException if datastore state doesn't meet the above criteria
|
||||
* @throws VerifyException if Datastore state doesn't meet the above criteria
|
||||
*/
|
||||
public static void saveRevision(String tld, DateTime date, RdeMode mode, int revision) {
|
||||
checkArgument(revision >= 0, "Negative revision: %s", revision);
|
||||
|
|
|
@ -197,13 +197,13 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
|
|||
* on its length.
|
||||
*
|
||||
* <p>NB: We are assuming that this field is unique across all registrar entities. This is not
|
||||
* formally enforced in our datastore, but should be enforced by ICANN in that no two registrars
|
||||
* will be accredited with the same name.
|
||||
* formally enforced in Datastore, but should be enforced by ICANN in that no two registrars will
|
||||
* be accredited with the same name.
|
||||
*
|
||||
* @see <a href="http://www.icann.org/registrar-reports/accredited-list.html">ICANN-Accredited Registrars</a>
|
||||
* @see <a href="http://www.icann.org/registrar-reports/accredited-list.html">ICANN-Accredited
|
||||
* Registrars</a>
|
||||
*/
|
||||
@Index
|
||||
String registrarName;
|
||||
@Index String registrarName;
|
||||
|
||||
/** The type of this registrar. */
|
||||
Type type;
|
||||
|
|
|
@ -857,13 +857,13 @@ public class Registry extends ImmutableObject implements Buildable {
|
|||
"Cannot create registry for TLD that is not a valid, canonical domain name");
|
||||
// Check the validity of all TimedTransitionProperties to ensure that they have values for
|
||||
// START_OF_TIME. The setters above have already checked this for new values, but also check
|
||||
// here to catch cases where we loaded an invalid TimedTransitionProperty from datastore and
|
||||
// here to catch cases where we loaded an invalid TimedTransitionProperty from Datastore and
|
||||
// cloned it into a new builder, to block re-building a Registry in an invalid state.
|
||||
instance.tldStateTransitions.checkValidity();
|
||||
instance.renewBillingCostTransitions.checkValidity();
|
||||
instance.eapFeeSchedule.checkValidity();
|
||||
// All costs must be in the expected currency.
|
||||
// TODO(b/21854155): When we move PremiumList into datastore, verify its currency too.
|
||||
// TODO(b/21854155): When we move PremiumList into Datastore, verify its currency too.
|
||||
checkArgument(
|
||||
instance.getStandardCreateCost().getCurrencyUnit().equals(instance.currency),
|
||||
"Create cost must be in the registry's currency");
|
||||
|
|
|
@ -156,7 +156,7 @@ public class Lock extends ImmutableObject {
|
|||
@Override
|
||||
public void vrun() {
|
||||
// To release a lock, check that no one else has already obtained it and if not delete it.
|
||||
// If the lock in datastore was different then this lock is gone already; this can happen
|
||||
// If the lock in Datastore was different then this lock is gone already; this can happen
|
||||
// if release() is called around the expiration time and the lock expires underneath us.
|
||||
Lock loadedLock = ofy().load().type(Lock.class).id(lockId).now();
|
||||
if (Lock.this.equals(loadedLock)) {
|
||||
|
|
|
@ -39,11 +39,11 @@ public class ServerSecret extends CrossTldSingleton {
|
|||
long leastSignificant;
|
||||
|
||||
/**
|
||||
* Get the server secret, creating it if the datastore doesn't have one already.
|
||||
* Get the server secret, creating it if the Datastore doesn't have one already.
|
||||
*
|
||||
* <p>There's a tiny risk of a race here if two calls to this happen simultaneously and create
|
||||
* different keys, in which case one of the calls will end up with an incorrect key. However, this
|
||||
* happens precisely once in the history of the system (after that it's always in datastore) so
|
||||
* happens precisely once in the history of the system (after that it's always in Datastore) so
|
||||
* it's not worth worrying about.
|
||||
*/
|
||||
public static UUID getServerSecret() {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class SignedMarkRevocationList extends ImmutableObject {
|
|||
boolean isShard;
|
||||
|
||||
/**
|
||||
* A cached supplier that fetches the SMDRL shards from the datastore and recombines them into a
|
||||
* A cached supplier that fetches the SMDRL shards from Datastore and recombines them into a
|
||||
* single {@link SignedMarkRevocationList} object.
|
||||
*/
|
||||
private static final Supplier<SignedMarkRevocationList> CACHE =
|
||||
|
@ -119,7 +119,7 @@ public class SignedMarkRevocationList extends ImmutableObject {
|
|||
}});
|
||||
}});
|
||||
|
||||
/** Return a single logical instance that combines all the datastore shards. */
|
||||
/** Return a single logical instance that combines all Datastore shards. */
|
||||
public static SignedMarkRevocationList get() {
|
||||
return CACHE.get();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class SignedMarkRevocationList extends ImmutableObject {
|
|||
return revokes.size();
|
||||
}
|
||||
|
||||
/** Save this list to the datastore in sharded form. Returns {@code this}. */
|
||||
/** Save this list to Datastore in sharded form. Returns {@code this}. */
|
||||
public SignedMarkRevocationList save() {
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ClaimsListShard extends ImmutableObject {
|
|||
boolean isShard = false;
|
||||
|
||||
/**
|
||||
* A cached supplier that fetches the claims list shards from the datastore and recombines them
|
||||
* A cached supplier that fetches the claims list shards from Datastore and recombines them
|
||||
* into a single {@link ClaimsListShard} object.
|
||||
*/
|
||||
private static final Supplier<ClaimsListShard> CACHE =
|
||||
|
@ -203,7 +203,7 @@ public class ClaimsListShard extends ImmutableObject {
|
|||
return instance;
|
||||
}
|
||||
|
||||
/** Return a single logical instance that combines all the datastore shards. */
|
||||
/** Return a single logical instance that combines all Datastore shards. */
|
||||
@Nullable
|
||||
public static ClaimsListShard get() {
|
||||
return CACHE.get();
|
||||
|
|
|
@ -46,10 +46,10 @@ public final class TmchCrl extends CrossTldSingleton {
|
|||
}
|
||||
|
||||
/**
|
||||
* Change the datastore singleton to a new ASCII-armored X.509 CRL.
|
||||
* Change the Datastore singleton to a new ASCII-armored X.509 CRL.
|
||||
*
|
||||
* <p>Please do not call this function unless your CRL is properly formatted, signed by the root,
|
||||
* and actually newer than the one currently in the datastore.
|
||||
* and actually newer than the one currently in Datastore.
|
||||
*/
|
||||
public static void set(final String crl, final String url) {
|
||||
ofy().transactNew(new VoidWork() {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class CreateAutoTimestampTranslatorFactory
|
|||
|
||||
/**
|
||||
* Load an existing timestamp. It can be assumed to be non-null since if the field is null in
|
||||
* datastore then Objectify will skip this translator and directly load a null.
|
||||
* Datastore then Objectify will skip this translator and directly load a null.
|
||||
*/
|
||||
@Override
|
||||
public CreateAutoTimestamp loadValue(Date datastoreValue) {
|
||||
|
|
|
@ -143,7 +143,7 @@ abstract class ImmutableSortedMapTranslatorFactory<K extends Comparable<? super
|
|||
ImmutableSortedMap<K, V> mapToSave = transformBeforeSave(
|
||||
ImmutableSortedMap.copyOfSorted(nullToEmpty(mapFromPojo)));
|
||||
if (mapToSave.isEmpty()) {
|
||||
throw new SkipException(); // the datastore doesn't store empty lists
|
||||
throw new SkipException(); // Datastore doesn't store empty lists
|
||||
}
|
||||
Node node = new Node(path);
|
||||
for (Map.Entry<K, V> entry : mapToSave.entrySet()) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class UpdateAutoTimestampTranslatorFactory
|
|||
|
||||
/**
|
||||
* Load an existing timestamp. It can be assumed to be non-null since if the field is null in
|
||||
* datastore then Objectify will skip this translator and directly load a null.
|
||||
* Datastore then Objectify will skip this translator and directly load a null.
|
||||
*/
|
||||
@Override
|
||||
public UpdateAutoTimestamp loadValue(Date datastoreValue) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue