Class MutableNotesMigration
- java.lang.Object
-
- com.google.gerrit.server.notedb.NotesMigration
-
- com.google.gerrit.server.notedb.MutableNotesMigration
-
public class MutableNotesMigration extends NotesMigration
NotesMigration
with additional methods for altering the migration state at runtime.Almost all callers care only about inspecting the migration state, and for safety should not have access to mutation methods, which must be used with extreme care. Those callers should inject
NotesMigration
.Some callers, namely the NoteDb migration pipeline and tests, do need to alter the migration state at runtime, and those callers are expected to take the necessary precautions such as keeping the in-memory and on-disk config state in sync. Those callers use this class.
Mutations to the
MutableNotesMigration
are guaranteed to be instantly visible to all callers that use the non-mutableNotesMigration
. The current implementation accomplishes this by always bindingNotesMigration
toMutableNotesMigration
in Guice, so there is just oneNotesMigration
instance process-wide.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.gerrit.server.notedb.NotesMigration
NotesMigration.Module
-
-
Field Summary
-
Fields inherited from class com.google.gerrit.server.notedb.NotesMigration
SECTION_NOTE_DB, snapshot
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MutableNotesMigration
fromConfig(org.eclipse.jgit.lib.Config cfg)
static MutableNotesMigration
newDisabled()
MutableNotesMigration
setChangePrimaryStorage(NoteDbChangeState.PrimaryStorage changePrimaryStorage)
MutableNotesMigration
setDisableChangeReviewDb(boolean disableChangeReviewDb)
MutableNotesMigration
setFailOnLoadForTest(boolean failOnLoadForTest)
MutableNotesMigration
setFrom(NotesMigration other)
MutableNotesMigration
setFrom(NotesMigrationState state)
Set the in-memory values returned by this instance to match the given state.MutableNotesMigration
setReadChanges(boolean readChanges)
MutableNotesMigration
setReadChangeSequence(boolean readChangeSequence)
MutableNotesMigration
setWriteChanges(boolean writeChanges)
-
Methods inherited from class com.google.gerrit.server.notedb.NotesMigration
changePrimaryStorage, commitChangeWrites, disableChangeReviewDb, equals, failChangeWrites, failOnLoadForTest, hashCode, rawWriteChangesSetting, readChanges, readChangeSequence, setConfigValues
-
-
-
-
Method Detail
-
newDisabled
public static MutableNotesMigration newDisabled()
-
fromConfig
public static MutableNotesMigration fromConfig(org.eclipse.jgit.lib.Config cfg)
-
setReadChanges
public MutableNotesMigration setReadChanges(boolean readChanges)
-
setWriteChanges
public MutableNotesMigration setWriteChanges(boolean writeChanges)
-
setReadChangeSequence
public MutableNotesMigration setReadChangeSequence(boolean readChangeSequence)
-
setChangePrimaryStorage
public MutableNotesMigration setChangePrimaryStorage(NoteDbChangeState.PrimaryStorage changePrimaryStorage)
-
setDisableChangeReviewDb
public MutableNotesMigration setDisableChangeReviewDb(boolean disableChangeReviewDb)
-
setFailOnLoadForTest
public MutableNotesMigration setFailOnLoadForTest(boolean failOnLoadForTest)
-
setFrom
public MutableNotesMigration setFrom(NotesMigrationState state)
Set the in-memory values returned by this instance to match the given state.This method is only intended for use by
NoteDbMigrator
.This only modifies the in-memory state; if this instance was initialized from a file-based config, the underlying storage is not updated. Callers are responsible for managing the underlying storage on their own.
-
setFrom
public MutableNotesMigration setFrom(NotesMigration other)
- See Also:
setFrom(NotesMigrationState)
-
-