Package com.google.gerrit.server.update
Class BatchUpdate
java.lang.Object
com.google.gerrit.server.update.BatchUpdate
- All Implemented Interfaces:
AutoCloseable
Helper for a set of change updates that should be applied to the NoteDb database.
An update operation can be divided into three phases:
- Git reference updates
- Review metadata updates
- Post-update steps
BatchRefUpdate.
Similarly, all post-update steps, such as sending email, must run only after all storage mutations have completed.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionaddOp(Change.Id id, CurrentUser contextUser, BatchUpdateOp op) Adds aBatchUpdatefor a change that should be executed by the given context user.addOp(Change.Id id, BatchUpdateOp op) Adds aBatchUpdatefor a change.addRepoOnlyOp(CurrentUser contextUser, RepoOnlyOp op) Adds aRepoOnlyOpthat should be executed by the given context user.Adds aRepoOnlyOp.voidclose()execute()execute(BatchUpdateListener listener) Map<BranchNameKey, org.eclipse.jgit.transport.ReceiveCommand> getSuccessfullyUpdatedBranches(boolean dryrun) Return the references successfully updated by this BatchUpdate with their command.booleanstatic com.google.inject.Modulemodule()setNotify(NotifyResolver.Result notify) Set the default notification settings for all changes in the batch.setNotifyHandling(Change.Id changeId, NotifyHandling notifyHandling) Override theNotifyHandlingon a per-change basis.setOnSubmitValidators(OnSubmitValidators onSubmitValidators) Add a validation step for intended ref operations, which will be performed at the end ofRepoOnlyOp.updateRepo(RepoContext)step.setPushCertificate(org.eclipse.jgit.transport.PushCertificate pushCert) setRefLogMessage(String refLogMessage) setRepository(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk revWalk, org.eclipse.jgit.lib.ObjectInserter inserter)
-
Method Details
-
module
public static com.google.inject.Module module() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
execute
@CanIgnoreReturnValue public BatchUpdates.Result execute(BatchUpdateListener listener) throws UpdateException, RestApiException - Throws:
UpdateExceptionRestApiException
-
execute
- Throws:
UpdateExceptionRestApiException
-
isExecuted
public boolean isExecuted() -
setRepository
@CanIgnoreReturnValue public BatchUpdate setRepository(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk revWalk, org.eclipse.jgit.lib.ObjectInserter inserter) -
setPushCertificate
@CanIgnoreReturnValue public BatchUpdate setPushCertificate(org.eclipse.jgit.transport.PushCertificate pushCert) -
setRefLogMessage
-
setNotify
Set the default notification settings for all changes in the batch.- Parameters:
notify- notification settings.- Returns:
- this.
-
setNotifyHandling
@CanIgnoreReturnValue public BatchUpdate setNotifyHandling(Change.Id changeId, NotifyHandling notifyHandling) Override theNotifyHandlingon a per-change basis.Only the handling enum can be overridden; all changes share the same value for
NotifyResolver.Result.accounts().- Parameters:
changeId- change ID.notifyHandling- notify handling.- Returns:
- this.
-
setOnSubmitValidators
@CanIgnoreReturnValue public BatchUpdate setOnSubmitValidators(OnSubmitValidators onSubmitValidators) Add a validation step for intended ref operations, which will be performed at the end ofRepoOnlyOp.updateRepo(RepoContext)step. -
getProject
-
getRefUpdates
-
getSuccessfullyUpdatedBranches
public Map<BranchNameKey,org.eclipse.jgit.transport.ReceiveCommand> getSuccessfullyUpdatedBranches(boolean dryrun) Return the references successfully updated by this BatchUpdate with their command. In dryrun, we assume all updates were successful. -
addOp
Adds aBatchUpdatefor a change.The op is executed by the user for which the
BatchUpdatehas been created. -
addOp
@CanIgnoreReturnValue public BatchUpdate addOp(Change.Id id, CurrentUser contextUser, BatchUpdateOp op) Adds aBatchUpdatefor a change that should be executed by the given context user. -
addRepoOnlyOp
Adds aRepoOnlyOp.The op is executed by the user for which the
BatchUpdatehas been created. -
addRepoOnlyOp
Adds aRepoOnlyOpthat should be executed by the given context user. -
insertChange
- Throws:
IOException
-