diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-12-04 14:50:58 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-12-04 14:50:58 +0000 |
commit | 8054939afc603ea0f25a1c134799335a6b533211 (patch) | |
tree | e068edffa5260b3d9f140cd35c9bcfabf2c5dd9a | |
parent | 97aa4d99ae1919583330d8bbb8fc60548a88eb79 (diff) | |
download | obnam-8054939afc603ea0f25a1c134799335a6b533211.tar.gz |
Optimize remove_chunk to not remove from chunklist.
The chunk is not supposed to be removed until nobody
needs it, and in that case it is not in chunksums
anyway, so removing it is wasteful.
-rw-r--r-- | obnamlib/store.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/obnamlib/store.py b/obnamlib/store.py index 2f2315ef..4ad2fbec 100644 --- a/obnamlib/store.py +++ b/obnamlib/store.py @@ -527,15 +527,16 @@ class Store(object): @require_open_client def remove_chunk(self, chunk_id): - '''Remove a chunk from the store.''' + '''Remove a chunk from the store. + + Note that this does _not_ remove the chunk from the chunk + checksum forest. The caller is not supposed to call us until + the chunk is not there anymore. + + However, it does remove the chunk from the chunk list forest. + + ''' - try: - checksum = self.chunklist.get_checksum(chunk_id) - except KeyError: - pass - else: - self.chunksums.remove(checksum, chunk_id, - self.current_client_id) self.chunklist.remove(chunk_id) filename = self._chunk_filename(chunk_id) try: |