Package google.registry.model.common
Class DatabaseMigrationStateSchedule
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.model.common.CrossTldSingleton
-
- google.registry.model.common.DatabaseMigrationStateSchedule
-
- All Implemented Interfaces:
java.lang.Cloneable
@Entity public class DatabaseMigrationStateSchedule extends CrossTldSingleton
A wrapper object representing the stage-to-time mapping of the Registry 3.0 Cloud SQL migration.The entity is stored in SQL throughout the entire migration so as to have a single point of access.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DatabaseMigrationStateSchedule.MigrationState
The current phase of the migration plus information about which database to use and whether or not the phase is read-only.static class
DatabaseMigrationStateSchedule.PrimaryDatabase
static class
DatabaseMigrationStateSchedule.ReplayDirection
-
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotHydrate, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
-
Field Summary
Fields Modifier and Type Field Description static com.github.benmanes.caffeine.cache.LoadingCache<java.lang.Class<DatabaseMigrationStateSchedule>,TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState>>
CACHE
Cache of the current migration schedule.static TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState>
DEFAULT_TRANSITION_MAP
TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState>
migrationTransitions
-
Fields inherited from class google.registry.model.common.CrossTldSingleton
SINGLETON_ID
-
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
-
Constructor Summary
Constructors Constructor Description DatabaseMigrationStateSchedule(TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState> migrationTransitions)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState>
get()
Loads the currently-set migration schedule from the cache, or the default if none exists.static DatabaseMigrationStateSchedule.MigrationState
getValueAtTime(org.joda.time.DateTime dateTime)
Returns the database migration status at the given time.static void
set(com.google.common.collect.ImmutableSortedMap<org.joda.time.DateTime,DatabaseMigrationStateSchedule.MigrationState> migrationTransitionMap)
Sets and persists to SQL the provided migration transition schedule.-
Methods inherited from class google.registry.model.ImmutableObject
clone, cloneEmptyToNull, createVKey, equals, getSignificantFields, hashCode, toDiffableFieldMap, toHydratedString, toString, toStringHelper
-
-
-
-
Field Detail
-
CACHE
public static final com.github.benmanes.caffeine.cache.LoadingCache<java.lang.Class<DatabaseMigrationStateSchedule>,TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState>> CACHE
Cache of the current migration schedule. The key is meaningless; this is essentially a memoized Supplier that can be reset for testing purposes and after writes.
-
DEFAULT_TRANSITION_MAP
public static final TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState> DEFAULT_TRANSITION_MAP
-
migrationTransitions
public TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState> migrationTransitions
-
-
Constructor Detail
-
DatabaseMigrationStateSchedule
public DatabaseMigrationStateSchedule(TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState> migrationTransitions)
-
-
Method Detail
-
set
public static void set(com.google.common.collect.ImmutableSortedMap<org.joda.time.DateTime,DatabaseMigrationStateSchedule.MigrationState> migrationTransitionMap)
Sets and persists to SQL the provided migration transition schedule.
-
get
public static TimedTransitionProperty<DatabaseMigrationStateSchedule.MigrationState> get()
Loads the currently-set migration schedule from the cache, or the default if none exists.
-
getValueAtTime
public static DatabaseMigrationStateSchedule.MigrationState getValueAtTime(org.joda.time.DateTime dateTime)
Returns the database migration status at the given time.
-
-