summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-12-21 19:43:36 +0100
committerLars Wirzenius <liw@liw.fi>2015-12-21 22:28:13 +0100
commit637fc8bc3843d9f1f77f75cc5c2e12e0ec594270 (patch)
tree9d0bfaf87ced5ea4bccd2ebadb94f36e123595d9
parent0cecea8e2bcf421de715ccc200504dd2c1df9d53 (diff)
downloadobnam-637fc8bc3843d9f1f77f75cc5c2e12e0ec594270.tar.gz
Change remove_generation to return list of chunks
This will be useful for actually implementing removal of unused chunks in green-albatross.
-rw-r--r--obnamlib/fmt_6/repo_fmt_6.py2
-rw-r--r--obnamlib/fmt_ga/client.py2
-rw-r--r--obnamlib/repo_interface.py9
3 files changed, 11 insertions, 2 deletions
diff --git a/obnamlib/fmt_6/repo_fmt_6.py b/obnamlib/fmt_6/repo_fmt_6.py
index 25156e78..cd389af2 100644
--- a/obnamlib/fmt_6/repo_fmt_6.py
+++ b/obnamlib/fmt_6/repo_fmt_6.py
@@ -561,6 +561,8 @@ class RepositoryFormat6(obnamlib.RepositoryInterface):
open_client_info.client.start_changes(create_tree=False)
open_client_info.client.remove_generation(gen_number)
+ return [] # We handle chunk removal ourselves.
+
def get_generation_chunk_ids(self, generation_id):
# This intentionally doesn't construct chunk ids for in-tree
# data, because that's very slow, as it requires iterating
diff --git a/obnamlib/fmt_ga/client.py b/obnamlib/fmt_ga/client.py
index d07bea77..b267aae0 100644
--- a/obnamlib/fmt_ga/client.py
+++ b/obnamlib/fmt_ga/client.py
@@ -203,6 +203,8 @@ class GAClient(object):
self._generations.set_generations(remaining)
+ return [] # FIXME
+
def get_generation_key(self, gen_number, key):
self._load_data()
generation = self._lookup_generation_by_gen_number(gen_number)
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py
index 1a076ea6..4df397a9 100644
--- a/obnamlib/repo_interface.py
+++ b/obnamlib/repo_interface.py
@@ -644,6 +644,9 @@ class RepositoryInterface(object):
The removed generation may be the currently unfinished one.
+ Return a list of chunk ids that are no longer used by this
+ client.
+
'''
raise NotImplementedError()
@@ -1562,16 +1565,18 @@ class RepositoryInterfaceTests(unittest.TestCase): # pragma: no cover
def test_removes_unfinished_generation(self):
gen_id = self.create_generation()
- self.repo.remove_generation(gen_id)
+ chunk_ids = self.repo.remove_generation(gen_id)
self.assertEqual(self.repo.get_client_generation_ids('fooclient'), [])
+ self.assertEqual(type(chunk_ids), list)
def test_removes_finished_generation(self):
gen_id = self.create_generation()
self.repo.commit_client('fooclient')
self.repo.unlock_client('fooclient')
self.repo.lock_client('fooclient')
- self.repo.remove_generation(gen_id)
+ chunk_ids = self.repo.remove_generation(gen_id)
self.assertEqual(self.repo.get_client_generation_ids('fooclient'), [])
+ self.assertEqual(type(chunk_ids), list)
def test_removing_removed_generation_fails(self):
gen_id = self.create_generation()