Class PackLockImpl

  • All Implemented Interfaces:
    PackLock

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

      • 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 Detail

      • 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