summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-06-11 19:12:45 +0300
committerLars Wirzenius <liw@liw.fi>2017-06-11 19:12:45 +0300
commit676ef991bc15b8cf18006fdb19d51daab8893997 (patch)
treead4e6966586e95d699a841ab93da717e70c0d67a
parent2901613dd7388fcd040a9a0a89a00fffeeef4922 (diff)
downloadobnam-676ef991bc15b8cf18006fdb19d51daab8893997.tar.gz
Add: methods to get bag id of chunk, and chunks in bag
-rw-r--r--obnamlib/fmt_ga/chunk_store.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/obnamlib/fmt_ga/chunk_store.py b/obnamlib/fmt_ga/chunk_store.py
index 9f916276..8d8741b6 100644
--- a/obnamlib/fmt_ga/chunk_store.py
+++ b/obnamlib/fmt_ga/chunk_store.py
@@ -65,6 +65,15 @@ class GAChunkStore(object):
filename=None)
return content
+ def get_bag_id(self, chunk_id):
+ bag_id, obj_id = obnamlib.parse_object_id(chunk_id)
+ return bag_id
+
+ def get_chunks_in_bag(self, bag_id):
+ bag = self._bag_store.get_bag(bag_id)
+ for i in range(len(bag)):
+ yield obnamlib.make_object_id(bag_id, i)
+
def has_chunk(self, chunk_id):
# This is ugly, 'cause it requires reading in the whole bag.
# We could easily check if the bag exists, but not whether it