Class PackLock

java.lang.Object
org.eclipse.jgit.internal.storage.file.PackLock

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

    Fields
    Modifier and Type
    Field
    Description
    private final File
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PackLock(File packFile, FS fs)
    Create a new lock for a pack file.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    lock(String msg)
    Create the pack-*.keep file, with the given message.
    void
    Remove the .keep file that holds this pack in place.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • keepFile

      private final File keepFile
  • Constructor Details

    • PackLock

      public PackLock(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
      Remove the .keep file that holds this pack in place.
      Throws:
      IOException - if deletion of .keep file failed