Various improvements.

This commit is contained in:
Jonas Borgström 2010-10-27 21:01:57 +02:00
parent baa0224f55
commit 4c178e0010
2 changed files with 7 additions and 3 deletions

View File

@ -57,7 +57,7 @@ class Archiver(object):
archive.list()
else:
for archive in Archive.list_archives(store, crypto):
print archive.metadata['name']
print '%(name)-20s %(time)s' % archive.metadata
return self.exit_code_from_logger()
def do_verify(self, args):

View File

@ -51,13 +51,17 @@ class Cache(object):
self.chunk_counts[id] = 1, size
self.save()
def filter_file_chunks(self):
for key, value in self.file_chunks.iteritems():
if value[0] < 8:
yield key, (value[0] + 1,) + value[1:]
def save(self):
assert self.store.state == self.store.OPEN
cache = {'version': 1,
'tid': self.store.tid,
'chunk_counts': self.chunk_counts,
'file_chunks': dict(ifilter(lambda i: i[1][0] < 8,
self.file_chunks.iteritems())),
'file_chunks': dict(self.filter_file_chunks()),
}
data, hash = self.crypto.encrypt_create(msgpack.packb(cache))
cachedir = os.path.dirname(self.path)