|
@@ -93,11 +93,7 @@ class Cache(object):
|
|
|
with open(os.path.join(self.path, 'files'), 'w') as fd:
|
|
|
pass # empty file
|
|
|
|
|
|
- def open(self):
|
|
|
- if not os.path.isdir(self.path):
|
|
|
- raise Exception('%s Does not look like an Attic cache' % self.path)
|
|
|
- self.lock = UpgradableLock(os.path.join(self.path, 'config'), exclusive=True)
|
|
|
- self.rollback()
|
|
|
+ def _do_open(self):
|
|
|
self.config = RawConfigParser()
|
|
|
self.config.read(os.path.join(self.path, 'config'))
|
|
|
if self.config.getint('cache', 'version') != 1:
|
|
@@ -110,6 +106,12 @@ class Cache(object):
|
|
|
self.chunks = ChunkIndex.read(os.path.join(self.path, 'chunks').encode('utf-8'))
|
|
|
self.files = None
|
|
|
|
|
|
+ def open(self):
|
|
|
+ if not os.path.isdir(self.path):
|
|
|
+ raise Exception('%s Does not look like an Attic cache' % self.path)
|
|
|
+ self.lock = UpgradableLock(os.path.join(self.path, 'config'), exclusive=True)
|
|
|
+ self.rollback()
|
|
|
+
|
|
|
def close(self):
|
|
|
if self.lock:
|
|
|
self.lock.release()
|
|
@@ -181,6 +183,7 @@ class Cache(object):
|
|
|
if os.path.exists(os.path.join(self.path, 'txn.tmp')):
|
|
|
shutil.rmtree(os.path.join(self.path, 'txn.tmp'))
|
|
|
self.txn_active = False
|
|
|
+ self._do_open()
|
|
|
|
|
|
def sync(self):
|
|
|
"""Initializes cache by fetching and reading all archive indicies
|