Merge pull request #1881 from Abogical/cache-progress

Add begin_txn progress message
This commit is contained in:
enkore 2016-11-26 19:11:08 +01:00 committed by GitHub
commit 5917822735
1 changed files with 5 additions and 0 deletions

View File

@ -233,14 +233,19 @@ Chunk index: {0.total_unique_chunks:20d} {0.total_chunks:20d}"""
def begin_txn(self):
# Initialize transaction snapshot
pi = ProgressIndicatorMessage()
txn_dir = os.path.join(self.path, 'txn.tmp')
os.mkdir(txn_dir)
pi.output('Initializing cache transaction: Reading config')
shutil.copy(os.path.join(self.path, 'config'), txn_dir)
pi.output('Initializing cache transaction: Reading chunks')
shutil.copy(os.path.join(self.path, 'chunks'), txn_dir)
pi.output('Initializing cache transaction: Reading files')
shutil.copy(os.path.join(self.path, 'files'), txn_dir)
os.rename(os.path.join(self.path, 'txn.tmp'),
os.path.join(self.path, 'txn.active'))
self.txn_active = True
pi.finish()
def commit(self):
"""Commit transaction