public abstract class ReftableBatchRefUpdate extends BatchRefUpdate
BatchRefUpdate
for Reftable based RefDatabase.Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.locks.Lock |
lock |
private ReftableDatabase |
refDb |
private Repository |
repository |
MAX_WAIT
Modifier | Constructor and Description |
---|---|
protected |
ReftableBatchRefUpdate(RefDatabase refdb,
ReftableDatabase reftableDb,
java.util.concurrent.locks.Lock lock,
Repository repository)
Initialize.
|
Modifier and Type | Method and 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) |
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
private final java.util.concurrent.locks.Lock lock
private final ReftableDatabase refDb
private final Repository repository
protected ReftableBatchRefUpdate(RefDatabase refdb, ReftableDatabase reftableDb, java.util.concurrent.locks.Lock lock, Repository repository)
refdb
- The RefDatabasereftableDb
- The ReftableDatabaselock
- A lock protecting the refdatabase's staterepository
- The repository on which this update will runpublic void execute(RevWalk rw, ProgressMonitor pm, java.util.List<java.lang.String> options)
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)
and
RefDatabase.performsAtomicTransactions()
.
execute
in class BatchRefUpdate
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 withoutprotected abstract void applyUpdates(java.util.List<Ref> newRefs, java.util.List<ReceiveCommand> pending) throws java.io.IOException
newRefs
- the new refs to createpending
- the pending receive commands to be executedjava.io.IOException
- if any of the writes fail.private java.util.List<ReceiveCommand> getPending()
private boolean checkObjectExistence(RevWalk rw, java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
private boolean checkNonFastForwards(RevWalk rw, java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
private boolean checkConflicting(java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
private boolean checkExpected(java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
private static boolean matchOld(ReceiveCommand cmd, @Nullable Ref ref)
protected void write(ReftableWriter writer, java.util.List<Ref> newRefs, java.util.List<ReceiveCommand> pending) throws java.io.IOException
writer
- the writer on which we should write.newRefs
- the ref data to write..pending
- the log data to write.java.io.IOException
- in case of problems.private void writeLog(ReftableWriter writer, long updateIndex, java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
private java.lang.String toResultString(ReceiveCommand cmd)
private static java.util.List<Ref> toNewRefs(RevWalk rw, java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException