summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-06-11 19:17:12 +0300
committerLars Wirzenius <liw@liw.fi>2017-06-11 19:17:12 +0300
commit98e73cdb0724c5382ed02a456346ccf6fbe7b73b (patch)
tree5eec5ce6c0d3b66c666a2a12bccbdb21b95bcb54
parent676ef991bc15b8cf18006fdb19d51daab8893997 (diff)
downloadobnam-98e73cdb0724c5382ed02a456346ccf6fbe7b73b.tar.gz
Add: methods to get unused chunks, bags with chunks
-rw-r--r--obnamlib/fmt_ga/indexes.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/obnamlib/fmt_ga/indexes.py b/obnamlib/fmt_ga/indexes.py
index b57b3877..babc2e4b 100644
--- a/obnamlib/fmt_ga/indexes.py
+++ b/obnamlib/fmt_ga/indexes.py
@@ -195,5 +195,19 @@ class GAChunkIndexes(object):
# FIXME: This requires having a way to list keys in a CowTree.
pass
+ def get_unused_chunks(self):
+ return [
+ chunk_id
+ for chunk_id in self._used_by_tree.keys()
+ if self._used_by_tree.lookup(chunk_id) == []
+ ]
+
+ def get_bags_contianing_chunks(self, chunk_store, chunk_ids):
+ return set(
+ chunk_id
+ for chunk_id in chunk_ids
+ chunk_store.get_bag_id(chunk_id)
+ )
+
def validate_chunk_content(self, chunk_id):
return None