Class PackLockImpl

java.lang.Object
org.eclipse.jgit.internal.storage.file.PackLockImpl
All Implemented Interfaces:
PackLock

public class PackLockImpl extends Object implements PackLock
Keeps track of a Pack's associated .keep file.
  • Field Details

    • keepFile

      private final File keepFile
  • Constructor Details

    • PackLockImpl

      public PackLockImpl(File packFile, FS fs)
      Create a new lock for a pack file.
      Parameters:
      packFile - location of the pack-*.pack file.
      fs - the filesystem abstraction used by the repository.
  • Method Details

    • lock

      public boolean lock(String msg) throws IOException
      Create the pack-*.keep file, with the given message.
      Parameters:
      msg - message to store in the file.
      Returns:
      true if the keep file was successfully written; false otherwise.
      Throws:
      IOException - the keep file could not be written.
    • unlock

      public void unlock() throws IOException
      Description copied from interface: PackLock
      Remove the .keep file that holds a pack in place.
      Specified by:
      unlock in interface PackLock
      Throws:
      IOException - if deletion of the .keep file failed