summaryrefslogtreecommitdiff
path: root/obnamlib/repo_interface.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-07-19 12:42:48 +0300
committerLars Wirzenius <liw@liw.fi>2015-07-19 13:00:23 +0300
commitfe42dd953139ffc3bf25ed0a0beea9acbaf5dce6 (patch)
treedf7d22c7e454a0850af6b2d9cafe267644af6c7a /obnamlib/repo_interface.py
parent3915676a4d961247cf9d22d98af6a31ebe1f6fd7 (diff)
downloadobnam-fe42dd953139ffc3bf25ed0a0beea9acbaf5dce6.tar.gz
Drop remove_chunk
FORMAT GREEN ALBATROSS puts multiple chunks in a bag. This means that removing an individual chunk can't happen without rewriting a bag, and that would be disastrous for other reasons. Thus, we drop the remove_chunk method from RepositoryInterface. Format 6 still drops chunks when "obnam forget" is run. For Green Albatross, we'll need to figure out some kind of garbage collection for "obnam forget" (or RepositoryInterface.remove_generation) to use, so that unused chunk bags actually disappear. But they weren't disappearing correctly before this change anyway.
Diffstat (limited to 'obnamlib/repo_interface.py')
-rw-r--r--obnamlib/repo_interface.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py
index de297a17..f16d6925 100644
--- a/obnamlib/repo_interface.py
+++ b/obnamlib/repo_interface.py
@@ -732,10 +732,6 @@ class RepositoryInterface(object):
'''Does a chunk (still) exist in the repository?'''
raise NotImplementedError()
- def remove_chunk(self, chunk_id):
- '''Remove chunk from repository, but not chunk indexes.'''
- raise NotImplementedError()
-
def get_chunk_ids(self):
'''Generate all chunk ids in repository.'''
raise NotImplementedError()
@@ -1947,21 +1943,6 @@ class RepositoryInterfaceTests(unittest.TestCase): # pragma: no cover
self.assertTrue(self.repo.has_chunk(chunk_id))
self.assertEqual(self.repo.get_chunk_content(chunk_id), 'foochunk')
- def test_removes_chunk(self):
- chunk_id = self.repo.put_chunk_content('foochunk')
- self.repo.remove_chunk(chunk_id)
- self.assertFalse(self.repo.has_chunk(chunk_id))
- self.assertRaises(
- obnamlib.RepositoryChunkDoesNotExist,
- self.repo.get_chunk_content, chunk_id)
-
- def test_removing_nonexistent_chunk_fails(self):
- chunk_id = self.repo.put_chunk_content('foochunk')
- self.repo.remove_chunk(chunk_id)
- self.assertRaises(
- obnamlib.RepositoryChunkDoesNotExist,
- self.repo.remove_chunk, chunk_id)
-
def test_get_chunk_ids_returns_nothing_initially(self):
self.assertEqual(list(self.repo.get_chunk_ids()), [])
@@ -2115,17 +2096,6 @@ class RepositoryInterfaceTests(unittest.TestCase): # pragma: no cover
ret = self.repo.validate_chunk_content(chunk_id)
self.assertTrue(ret is True or ret is None)
- def test_validate_chunk_content_returns_False_or_None_if_corrupted(self):
- self.setup_client()
- chunk_id = self.repo.put_chunk_content('foochunk')
- self.repo.lock_chunk_indexes()
- token = self.repo.prepare_chunk_for_indexes('foochunk')
- self.repo.put_chunk_into_indexes(chunk_id, token, 'fooclient')
- self.repo.commit_chunk_indexes()
- self.repo.remove_chunk(chunk_id)
- ret = self.repo.validate_chunk_content(chunk_id)
- self.assertTrue(ret is False or ret is None)
-
# Fsck.
def test_returns_fsck_work_item(self):