From b2f460d5910db54130f63825bae1e1d04cc6abaa Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 13 Jul 2015 23:20:46 +0200 Subject: [PATCH] fix filenames used for locking, update docs about locking --- borg/cache.py | 2 +- borg/locking.py | 2 +- borg/repository.py | 2 +- docs/internals.rst | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/borg/cache.py b/borg/cache.py index 37e066685..1b66bc1b9 100644 --- a/borg/cache.py +++ b/borg/cache.py @@ -124,7 +124,7 @@ class Cache: def open(self): if not os.path.isdir(self.path): raise Exception('%s Does not look like a Borg cache' % self.path) - self.lock = UpgradableLock(os.path.join(self.path, 'repo'), exclusive=True).acquire() + self.lock = UpgradableLock(os.path.join(self.path, 'lock'), exclusive=True).acquire() self.rollback() def close(self): diff --git a/borg/locking.py b/borg/locking.py index 735429260..9bed13e19 100644 --- a/borg/locking.py +++ b/borg/locking.py @@ -221,7 +221,7 @@ class UpgradableLock: # an exclusive lock, used for: # - holding while doing roster queries / updates # - holding while the UpgradableLock itself is exclusive - self._lock = ExclusiveLock(path + '.lock', id=id) + self._lock = ExclusiveLock(path + '.exclusive', id=id) def __enter__(self): return self.acquire() diff --git a/borg/repository.py b/borg/repository.py index d7db689a0..60831c8ee 100644 --- a/borg/repository.py +++ b/borg/repository.py @@ -114,7 +114,7 @@ class Repository: self.path = path if not os.path.isdir(path): raise self.DoesNotExist(path) - self.lock = UpgradableLock(os.path.join(path, 'repo'), exclusive).acquire() + self.lock = UpgradableLock(os.path.join(path, 'lock'), exclusive).acquire() self.config = RawConfigParser() self.config.read(os.path.join(self.path, 'config')) if 'repository' not in self.config.sections() or self.config.getint('repository', 'version') != 1: diff --git a/docs/internals.rst b/docs/internals.rst index 2928b284f..30237e61a 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -26,7 +26,7 @@ README simple text file telling that this is a |project_name| repository config - repository configuration and lock file + repository configuration data/ directory where the actual data is stored @@ -37,6 +37,9 @@ hints.%d index.%d repository index +lock.roster and lock.exclusive/* + used by the locking system to manage shared and exclusive locks + Config file ----------- @@ -55,9 +58,6 @@ identifier for repositories. It will not change if you move the repository around so you can make a local transfer then decide to move the repository to another (even remote) location at a later time. -|project_name| will do a POSIX read lock on the config file when operating -on the repository. - Keys ----