public class ReftableBatchRefUpdate extends BatchRefUpdate
Modifier and Type | Field and Description |
---|---|
private static int |
AVG_BYTES |
private java.util.concurrent.locks.ReentrantLock |
lock |
private DfsObjDatabase |
odb |
private DfsReftableDatabase |
refdb |
private ReftableConfig |
reftableConfig |
MAX_WAIT
Modifier | Constructor and Description |
---|---|
protected |
ReftableBatchRefUpdate(DfsReftableDatabase refdb,
DfsObjDatabase odb)
Initialize batch update.
|
Modifier and Type | Method and Description |
---|---|
private void |
applyUpdates(RevWalk rw,
java.util.List<ReceiveCommand> pending) |
private boolean |
canCompactTopOfStack(ReftableConfig cfg) |
private boolean |
checkConflicting(java.util.List<ReceiveCommand> pending) |
private boolean |
checkExpected(Reftable table,
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) |
private ReftableWriter.Stats |
compactTopOfStack(java.io.OutputStream out,
ReftableConfig cfg,
byte[] newTable) |
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 long |
nextUpdateIndex() |
private boolean |
packOnlyContainsReftable(DfsPackDescription desc) |
private static java.util.List<Ref> |
toNewRefs(RevWalk rw,
java.util.List<ReceiveCommand> pending) |
private java.util.Set<DfsPackDescription> |
toPruneTopOfStack() |
private java.lang.String |
toResultString(ReceiveCommand cmd) |
private ReftableWriter.Stats |
write(java.io.OutputStream os,
ReftableConfig cfg,
long updateIndex,
java.util.List<Ref> newRefs,
java.util.List<ReceiveCommand> pending) |
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 static final int AVG_BYTES
private final DfsReftableDatabase refdb
private final DfsObjDatabase odb
private final java.util.concurrent.locks.ReentrantLock lock
private final ReftableConfig reftableConfig
protected ReftableBatchRefUpdate(DfsReftableDatabase refdb, DfsObjDatabase odb)
refdb
- database the update will modify.odb
- object database to store the reftable.public 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 withoutprivate 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(Reftable table, java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
private static boolean matchOld(ReceiveCommand cmd, @Nullable Ref ref)
private void applyUpdates(RevWalk rw, java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
private ReftableWriter.Stats write(java.io.OutputStream os, ReftableConfig cfg, long updateIndex, java.util.List<Ref> newRefs, java.util.List<ReceiveCommand> pending) throws java.io.IOException
java.io.IOException
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
private long nextUpdateIndex() throws java.io.IOException
java.io.IOException
private boolean canCompactTopOfStack(ReftableConfig cfg) throws java.io.IOException
java.io.IOException
private ReftableWriter.Stats compactTopOfStack(java.io.OutputStream out, ReftableConfig cfg, byte[] newTable) throws java.io.IOException
java.io.IOException
private java.util.Set<DfsPackDescription> toPruneTopOfStack() throws java.io.IOException
java.io.IOException
private boolean packOnlyContainsReftable(DfsPackDescription desc)