Extract a superclass from BatchUpdate

The goal is to have a separate implementation of NoteDb when running
with the Changes tables disabled, since at that point we can safely
assume that NoteDb is the only storage for changes.

Unlike the previous few commits, this one is an abstract class rather
than an interface since we want to share a considerable amount of
implementation.

Change-Id: Ia2492570c60d27fc4bf4c5420dd464b2bcb03126
This commit is contained in:
Dave Borowitz
2017-03-10 14:32:38 -05:00
parent b4ed22c7aa
commit 2390ed393b
6 changed files with 993 additions and 856 deletions

View File

@@ -462,7 +462,7 @@ public class MergeOp implements AutoCloseable {
try {
List<SubmitStrategy> strategies = getSubmitStrategies(toSubmit, submoduleOp, dryrun);
this.allProjects = submoduleOp.getProjectsInOrder();
BatchUpdate.execute(
batchUpdateFactory.execute(
orm.batchUpdates(allProjects),
new SubmitStrategyListener(submitInput, strategies, commitStatus),
submissionId,

View File

@@ -98,6 +98,7 @@ public class SubmoduleOp {
private final PersonIdent myIdent;
private final ProjectCache projectCache;
private final ProjectState.Factory projectStateFactory;
private final BatchUpdate.Factory batchUpdateFactory;
private final VerboseSuperprojectUpdate verboseSuperProject;
private final boolean enableSuperProjectSubscriptions;
private final MergeOpRepoManager orm;
@@ -123,6 +124,7 @@ public class SubmoduleOp {
@GerritServerConfig Config cfg,
ProjectCache projectCache,
ProjectState.Factory projectStateFactory,
BatchUpdate.Factory batchUpdateFactory,
@Assisted Set<Branch.NameKey> updatedBranches,
@Assisted MergeOpRepoManager orm)
throws SubmoduleException {
@@ -130,6 +132,7 @@ public class SubmoduleOp {
this.myIdent = myIdent;
this.projectCache = projectCache;
this.projectStateFactory = projectStateFactory;
this.batchUpdateFactory = batchUpdateFactory;
this.verboseSuperProject =
cfg.getEnum("submodule", null, "verboseSuperprojectUpdate", VerboseSuperprojectUpdate.TRUE);
this.enableSuperProjectSubscriptions =
@@ -338,7 +341,7 @@ public class SubmoduleOp {
}
}
}
BatchUpdate.execute(
batchUpdateFactory.execute(
orm.batchUpdates(superProjects), BatchUpdateListener.NONE, orm.getSubmissionId(), false);
} catch (RestApiException | UpdateException | IOException | NoSuchProjectException e) {
throw new SubmoduleException("Cannot update gitlinks", e);