Ejemplo n.º 1
0
 def get_blob(self, blob_id):
     bag_id, index = obnamlib.parse_object_id(blob_id)
     if self._bag and bag_id == self._bag.get_id():
         return self._bag[index]
     if blob_id in self._cached_blobs:
         return self._cached_blobs.get(blob_id)
     if self._bag_store.has_bag(bag_id):
         bag = self._bag_store.get_bag(bag_id)
         for i, this_blob in enumerate(bag):
             this_id = obnamlib.make_object_id(bag_id, i)
             self._cached_blobs.put(this_id, this_blob)
         return bag[index]
     return None
Ejemplo n.º 2
0
 def test_round_trip_works(self):
     bag_id = 123
     object_index = 456
     object_id = obnamlib.make_object_id(bag_id, object_index)
     self.assertEqual(obnamlib.parse_object_id(object_id),
                      (bag_id, object_index))
Ejemplo n.º 3
0
 def test_round_trip_works(self):
     bag_id = 123
     object_index = 456
     object_id = obnamlib.make_object_id(bag_id, object_index)
     self.assertEqual(obnamlib.parse_object_id(object_id), (bag_id, object_index))
Ejemplo n.º 4
0
 def get_bag_ids(chunk_ids):
     return set(
         obnamlib.parse_object_id(chunk_id)[0]
         for chunk_id in chunks_to_remove)
Ejemplo n.º 5
0
 def remove_leaf(self, leaf_id):
     tracing.trace('leaf_id %s', leaf_id)
     # FIXME: This is a bit ugly, since we need to break the
     # bag/blob store abstraction.
     bag_id, _ = obnamlib.parse_object_id(leaf_id)
     self._blob_store._bag_store.remove_bag(bag_id)
Ejemplo n.º 6
0
 def get_bag_id(self, chunk_id):
     bag_id, _ = obnamlib.parse_object_id(chunk_id)
     return bag_id