summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@xander>2010-12-26 14:00:44 +0200
committerLars Wirzenius <liw@xander>2010-12-26 14:00:44 +0200
commitc6cd170d7a8242abc000d0ac2b7ea59418c58fbb (patch)
tree7ed4ee3457bc237b179cecc544cf3e01015b5c67
parent5e4b2a86326a47c6782c26821128fbabadf64bcd (diff)
downloadobnam-c6cd170d7a8242abc000d0ac2b7ea59418c58fbb.tar.gz
Make use of append_file_chunks.
-rw-r--r--obnamlib/plugins/backup_plugin.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index f25d1293..25726a0c 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -211,19 +211,18 @@ class BackupPlugin(obnamlib.ObnamPlugin):
def backup_file_contents(self, filename):
'''Back up contents of a regular file.'''
logging.debug('backup_file_contents: %s' % filename)
- chunkids = []
+ self.store.set_file_chunks(filename, [])
f = self.fs.open(filename, 'r')
chunk_size = int(self.app.config['chunk-size'])
while True:
data = f.read(chunk_size)
if not data:
break
- chunkids.append(self.backup_file_chunk(data))
+ chunkid = self.backup_file_chunk(data)
+ self.store.append_file_chunks(filename, [chunkid])
self.app.hooks.call('progress-data-uploaded', len(data))
f.close()
- self.store.set_file_chunks(filename, chunkids)
-
def backup_file_chunk(self, data):
'''Back up a chunk of data by putting it into the store.'''
checksum = self.store.checksum(data)