Class NoteDbUpdateManager
- java.lang.Object
-
- com.google.gerrit.server.notedb.NoteDbUpdateManager
-
- All Implemented Interfaces:
AutoCloseable
public class NoteDbUpdateManager extends Object implements AutoCloseable
Object to manage a single sequence of updates to NoteDb.Instances are one-time-use. Handles updating both the change repo and the All-Users repo for any affected changes, with proper ordering.
To see the state that would be applied prior to executing the full sequence of updates, use
stage().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNoteDbUpdateManager.Factory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ChangeDraftUpdate draftUpdate)voidadd(ChangeUpdate update)Add an update to the list of updates to execute.voidclose()voiddeleteChange(Change.Id id)org.eclipse.jgit.lib.BatchRefUpdateexecute()org.eclipse.jgit.lib.BatchRefUpdateexecute(boolean dryrun)booleanisExecuted()NoteDbUpdateManagersetBatchUpdateListeners(com.google.common.collect.ImmutableList<BatchUpdateListener> batchUpdateListeners)NoteDbUpdateManagersetChangeRepo(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, ChainedReceiveCommands cmds)NoteDbUpdateManagersetPushCertificate(org.eclipse.jgit.transport.PushCertificate pushCert)Set a push certificate for the push that originally triggered this NoteDb update.NoteDbUpdateManagersetRefLogIdent(org.eclipse.jgit.lib.PersonIdent ident)NoteDbUpdateManagersetRefLogMessage(String message)
-
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
setChangeRepo
public NoteDbUpdateManager setChangeRepo(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, ChainedReceiveCommands cmds)
-
setRefLogMessage
public NoteDbUpdateManager setRefLogMessage(String message)
-
setRefLogIdent
public NoteDbUpdateManager setRefLogIdent(org.eclipse.jgit.lib.PersonIdent ident)
-
setPushCertificate
public NoteDbUpdateManager setPushCertificate(org.eclipse.jgit.transport.PushCertificate pushCert)
Set a push certificate for the push that originally triggered this NoteDb update.The pusher will not necessarily have specified any of the NoteDb refs explicitly, such as when processing a push to
refs/for/master. That's fine; this is just passed to the underlyingBatchRefUpdate, and the implementation decides what to do with it.The cert should be associated with the main repo. There is currently no way of associating a push cert with the
All-Usersrepo, since it is not currently possible to update draft changes via push.- Parameters:
pushCert- push certificate; may be null.- Returns:
- this
-
setBatchUpdateListeners
public NoteDbUpdateManager setBatchUpdateListeners(com.google.common.collect.ImmutableList<BatchUpdateListener> batchUpdateListeners)
-
isExecuted
public boolean isExecuted()
-
add
public void add(ChangeUpdate update)
Add an update to the list of updates to execute.Updates should only be added to the manager after all mutations have been made, as this method may eagerly access the update.
- Parameters:
update- the update to add.
-
add
public void add(ChangeDraftUpdate draftUpdate)
-
deleteChange
public void deleteChange(Change.Id id)
-
execute
public org.eclipse.jgit.lib.BatchRefUpdate execute() throws IOException- Throws:
IOException
-
execute
public org.eclipse.jgit.lib.BatchRefUpdate execute(boolean dryrun) throws IOException- Throws:
IOException
-
-