Class ReftableBatchRefUpdate

    • Field Detail

      • lock

        private final java.util.concurrent.locks.Lock lock
    • Constructor Detail

      • ReftableBatchRefUpdate

        protected ReftableBatchRefUpdate​(RefDatabase refdb,
                                         ReftableDatabase reftableDb,
                                         java.util.concurrent.locks.Lock lock,
                                         Repository repository)
        Initialize.
        Parameters:
        refdb - The RefDatabase
        reftableDb - The ReftableDatabase
        lock - A lock protecting the refdatabase's state
        repository - 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) and RefDatabase.performsAtomicTransactions().

        Overrides:
        execute in class BatchRefUpdate
        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 create
        pending - the pending receive commands to be executed
        Throws:
        java.io.IOException - if any of the writes fail.
      • 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
      • 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