fix filenames used for locking, update docs about locking

This commit is contained in:
Thomas Waldmann 2015-07-13 23:20:46 +02:00
parent b539169ec1
commit b2f460d591
4 changed files with 7 additions and 7 deletions

View file

@ -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):

View file

@ -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()

View file

@ -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:

View file

@ -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
----