public class PrimaryStorageMigrator
extends java.lang.Object
NoteDbChangeState.PrimaryStorage
of individual changes.Constructor and Description |
---|
PrimaryStorageMigrator(org.eclipse.jgit.lib.Config cfg,
com.google.inject.Provider<ReviewDb> db,
GitRepositoryManager repoManager,
AllUsersName allUsers,
ChangeRebuilder rebuilder,
com.github.rholder.retry.Retryer<NoteDbChangeState> testEnsureRebuiltRetryer,
ChangeControl.GenericFactory changeControlFactory,
com.google.inject.Provider<InternalChangeQuery> queryProvider,
ChangeUpdate.Factory updateFactory,
InternalUser.Factory internalUserFactory,
BatchUpdate.Factory batchUpdateFactory) |
Modifier and Type | Method and Description |
---|---|
void |
migrateToNoteDbPrimary(Change.Id id)
Migrate a change's primary storage from ReviewDb to NoteDb.
|
void |
migrateToReviewDbPrimary(Change.Id id,
Project.NameKey project) |
public PrimaryStorageMigrator(org.eclipse.jgit.lib.Config cfg, com.google.inject.Provider<ReviewDb> db, GitRepositoryManager repoManager, AllUsersName allUsers, ChangeRebuilder rebuilder, com.github.rholder.retry.Retryer<NoteDbChangeState> testEnsureRebuiltRetryer, ChangeControl.GenericFactory changeControlFactory, com.google.inject.Provider<InternalChangeQuery> queryProvider, ChangeUpdate.Factory updateFactory, InternalUser.Factory internalUserFactory, BatchUpdate.Factory batchUpdateFactory)
public void migrateToNoteDbPrimary(Change.Id id) throws com.google.gwtorm.server.OrmException, java.io.IOException
This method will return only if the primary storage of the change is NoteDb afterwards. (It may return early if the primary storage was already NoteDb.)
If this method throws an exception, then the primary storage of the change is probably not NoteDb. (It is possible that the primary storage of the change is NoteDb in this case, but there was an error reading the state.) Moreover, after an exception, the change may be read-only until a lease expires. If the caller chooses to retry, they should wait until the read-only lease expires; this method will fail relatively quickly if called on a read-only change.
Note that if the change is read-only after this method throws an exception, that does not necessarily guarantee that the read-only lease was acquired during that particular method invocation; this call may have in fact failed because another thread acquired the lease first.
id
- change ID.com.google.gwtorm.server.OrmException
- if a ReviewDb-level error occurs.java.io.IOException
- if a repo-level error occurs.public void migrateToReviewDbPrimary(Change.Id id, Project.NameKey project) throws com.google.gwtorm.server.OrmException, java.io.IOException
com.google.gwtorm.server.OrmException
java.io.IOException