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-mutable NotesMigration
. The current implementation accomplishes
this by always binding NotesMigration
to MutableNotesMigration
in Guice, so there
is just one NotesMigration
instance process-wide.
NotesMigration.Module
SECTION_NOTE_DB, snapshot
Modifier and Type | Method and 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) |
changePrimaryStorage, commitChangeWrites, disableChangeReviewDb, equals, failChangeWrites, failOnLoadForTest, hashCode, rawWriteChangesSetting, readChanges, readChangeSequence, setConfigValues
public static MutableNotesMigration newDisabled()
public static MutableNotesMigration fromConfig(org.eclipse.jgit.lib.Config cfg)
public MutableNotesMigration setReadChanges(boolean readChanges)
public MutableNotesMigration setWriteChanges(boolean writeChanges)
public MutableNotesMigration setReadChangeSequence(boolean readChangeSequence)
public MutableNotesMigration setChangePrimaryStorage(NoteDbChangeState.PrimaryStorage changePrimaryStorage)
public MutableNotesMigration setDisableChangeReviewDb(boolean disableChangeReviewDb)
public MutableNotesMigration setFailOnLoadForTest(boolean failOnLoadForTest)
public MutableNotesMigration setFrom(NotesMigrationState 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.
public MutableNotesMigration setFrom(NotesMigration other)
setFrom(NotesMigrationState)