summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-08-01 12:40:08 +0300
committerLars Wirzenius <liw@liw.fi>2015-08-01 13:38:21 +0300
commit1eb41f8df54fe1ab4043f85e89153a1af9e0f186 (patch)
treeff72e7568b711df2bdc88e119ae61d2b572356a3
parent510f24a45478aa1cfeb8823f64dec0f466b89d03 (diff)
downloadobnam-1eb41f8df54fe1ab4043f85e89153a1af9e0f186.tar.gz
Add remove_unused_chunks method
-rw-r--r--obnamlib/delegator.py3
-rw-r--r--obnamlib/fmt_6/repo_fmt_6.py3
-rw-r--r--obnamlib/fmt_ga/chunk_store.py4
-rw-r--r--obnamlib/repo_interface.py9
4 files changed, 19 insertions, 0 deletions
diff --git a/obnamlib/delegator.py b/obnamlib/delegator.py
index f0c6038a..e1b2a220 100644
--- a/obnamlib/delegator.py
+++ b/obnamlib/delegator.py
@@ -276,6 +276,9 @@ class RepositoryDelegator(obnamlib.RepositoryInterface):
def flush_chunks(self):
self._chunk_store.flush_chunks()
+ def remove_unused_chunks(self):
+ return self._chunk_store.remove_unused_chunks()
+
def get_chunk_ids(self):
return self._chunk_store.get_chunk_ids()
diff --git a/obnamlib/fmt_6/repo_fmt_6.py b/obnamlib/fmt_6/repo_fmt_6.py
index 352a73f2..b7ca4f48 100644
--- a/obnamlib/fmt_6/repo_fmt_6.py
+++ b/obnamlib/fmt_6/repo_fmt_6.py
@@ -684,6 +684,9 @@ class RepositoryFormat6(obnamlib.RepositoryInterface):
def flush_chunks(self):
pass
+ def remove_unused_chunks(self):
+ pass
+
def get_chunk_ids(self):
# Note: This does not cover for in-tree chunk data. We cannot
# realistically iterate over all per-client B-trees to find
diff --git a/obnamlib/fmt_ga/chunk_store.py b/obnamlib/fmt_ga/chunk_store.py
index 3740d912..f7e486d5 100644
--- a/obnamlib/fmt_ga/chunk_store.py
+++ b/obnamlib/fmt_ga/chunk_store.py
@@ -56,6 +56,10 @@ class GAChunkStore(object):
def flush_chunks(self):
self._blob_store.flush()
+ def remove_unused_chunks(self):
+ # FIXME: This is a no-op operation, for now.
+ pass
+
def get_chunk_content(self, chunk_id):
content = self._blob_store.get_blob(chunk_id)
if content is None:
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py
index 515c29da..4cb05d44 100644
--- a/obnamlib/repo_interface.py
+++ b/obnamlib/repo_interface.py
@@ -740,6 +740,15 @@ class RepositoryInterface(object):
'''Write any pending new chunks to repository.'''
raise NotImplementedError()
+ def remove_unused_chunk(self):
+ '''Remove chunks that are no longer used by any client.
+
+ The caller MUST commit any changes to clients or chunk indexes
+ before calling this method.
+
+ '''
+ raise NotImplementedError()
+
def lock_chunk_indexes(self):
'''Locks chunk indexes for updates.'''
raise NotImplementedError()