Class ReftableBatchRefUpdate
- java.lang.Object
-
- org.eclipse.jgit.lib.BatchRefUpdate
-
- org.eclipse.jgit.internal.storage.reftable.ReftableBatchRefUpdate
-
- Direct Known Subclasses:
DfsReftableBatchRefUpdate
,FileReftableDatabase.FileReftableBatchRefUpdate
public abstract class ReftableBatchRefUpdate extends BatchRefUpdate
BatchRefUpdate
for Reftable based RefDatabase.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.locks.Lock
lock
private ReftableDatabase
refDb
private Repository
repository
-
Fields inherited from class org.eclipse.jgit.lib.BatchRefUpdate
MAX_WAIT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReftableBatchRefUpdate(RefDatabase refdb, ReftableDatabase reftableDb, java.util.concurrent.locks.Lock lock, Repository repository)
Initialize.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
applyUpdates(java.util.List<Ref> newRefs, java.util.List<ReceiveCommand> pending)
Implements the storage-specific part of the update.private boolean
checkConflicting(java.util.List<ReceiveCommand> pending)
private boolean
checkExpected(java.util.List<ReceiveCommand> pending)
private boolean
checkNonFastForwards(RevWalk rw, java.util.List<ReceiveCommand> pending)
private boolean
checkObjectExistence(RevWalk rw, java.util.List<ReceiveCommand> pending)
void
execute(RevWalk rw, ProgressMonitor pm, java.util.List<java.lang.String> options)
Execute this batch update.private java.util.List<ReceiveCommand>
getPending()
private static boolean
matchOld(ReceiveCommand cmd, Ref ref)
private static java.util.List<Ref>
toNewRefs(RevWalk rw, java.util.List<ReceiveCommand> pending)
private java.lang.String
toResultString(ReceiveCommand cmd)
protected void
write(ReftableWriter writer, java.util.List<Ref> newRefs, java.util.List<ReceiveCommand> pending)
Writes the refs to the writer, and calls finish.private void
writeLog(ReftableWriter writer, long updateIndex, java.util.List<ReceiveCommand> pending)
-
Methods inherited from class org.eclipse.jgit.lib.BatchRefUpdate
addCommand, addCommand, addCommand, addPrefixesTo, addProposedTimestamp, blockUntilTimestamps, disableRefLog, execute, getCommands, getPrefixes, getProposedTimestamps, getPushCertificate, getPushOptions, getRefLogIdent, getRefLogMessage, getRefLogMessage, isAllowNonFastForwards, isAtomic, isForceRefLog, isForceRefLog, isRefLogDisabled, isRefLogDisabled, isRefLogIncludingResult, isRefLogIncludingResult, newUpdate, setAllowNonFastForwards, setAtomic, setForceRefLog, setPushCertificate, setPushOptions, setRefLogIdent, setRefLogMessage, toString
-
-
-
-
Field Detail
-
lock
private final java.util.concurrent.locks.Lock lock
-
refDb
private final ReftableDatabase refDb
-
repository
private final Repository repository
-
-
Constructor Detail
-
ReftableBatchRefUpdate
protected ReftableBatchRefUpdate(RefDatabase refdb, ReftableDatabase reftableDb, java.util.concurrent.locks.Lock lock, Repository repository)
Initialize.- Parameters:
refdb
- The RefDatabasereftableDb
- The ReftableDatabaselock
- A lock protecting the refdatabase's staterepository
- The repository on which this update will run
-
-
Method Detail
-
execute
public void execute(RevWalk rw, ProgressMonitor pm, java.util.List<java.lang.String> options)
Execute this batch update.The default implementation of this method performs a sequential reference update over each reference.
Implementations must respect the atomicity requirements of the underlying database as described in
BatchRefUpdate.setAtomic(boolean)
andRefDatabase.performsAtomicTransactions()
.- Overrides:
execute
in classBatchRefUpdate
- Parameters:
rw
- a RevWalk to parse tags in case the storage system wants to store them pre-peeled, a common performance optimization.pm
- progress monitor to receive update status on.options
- a list of option strings; set null to execute without
-
applyUpdates
protected abstract void applyUpdates(java.util.List<Ref> newRefs, java.util.List<ReceiveCommand> pending) throws java.io.IOException
Implements the storage-specific part of the update.- Parameters:
newRefs
- the new refs to createpending
- the pending receive commands to be executed- Throws:
java.io.IOException
- if any of the writes fail.
-
getPending
private java.util.List<ReceiveCommand> getPending()
-
checkObjectExistence
private boolean checkObjectExistence(RevWalk rw, java.util.List<ReceiveCommand> pending) throws java.io.IOException
- Throws:
java.io.IOException
-
checkNonFastForwards
private boolean checkNonFastForwards(RevWalk rw, java.util.List<ReceiveCommand> pending) throws java.io.IOException
- Throws:
java.io.IOException
-
checkConflicting
private boolean checkConflicting(java.util.List<ReceiveCommand> pending) throws java.io.IOException
- Throws:
java.io.IOException
-
checkExpected
private boolean checkExpected(java.util.List<ReceiveCommand> pending) throws java.io.IOException
- Throws:
java.io.IOException
-
matchOld
private static boolean matchOld(ReceiveCommand cmd, @Nullable Ref ref)
-
write
protected void write(ReftableWriter writer, java.util.List<Ref> newRefs, java.util.List<ReceiveCommand> pending) throws java.io.IOException
Writes the refs to the writer, and calls finish.- Parameters:
writer
- the writer on which we should write.newRefs
- the ref data to write..pending
- the log data to write.- Throws:
java.io.IOException
- in case of problems.
-
writeLog
private void writeLog(ReftableWriter writer, long updateIndex, java.util.List<ReceiveCommand> pending) throws java.io.IOException
- Throws:
java.io.IOException
-
toResultString
private java.lang.String toResultString(ReceiveCommand cmd)
-
toNewRefs
private static java.util.List<Ref> toNewRefs(RevWalk rw, java.util.List<ReceiveCommand> pending) throws java.io.IOException
- Throws:
java.io.IOException
-
-