summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-07-19 16:22:35 +0300
committerLars Wirzenius <liw@liw.fi>2015-07-19 16:22:35 +0300
commitbdc8b792955b5c19f496447e36ce60739ff793e3 (patch)
tree66c820738433cb7a99f49409220b5c31c6c32fd1
parent28a6295fed6d59c74ef4db265713c2c9590baef2 (diff)
downloadobnam-bdc8b792955b5c19f496447e36ce60739ff793e3.tar.gz
Use Bag.get_bytes to determine when bag is full
-rw-r--r--obnamlib/blob_store.py2
-rw-r--r--obnamlib/blob_store_tests.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/obnamlib/blob_store.py b/obnamlib/blob_store.py
index 33e2d1af..6e4b6b49 100644
--- a/obnamlib/blob_store.py
+++ b/obnamlib/blob_store.py
@@ -56,7 +56,7 @@ class BlobStore(object):
if self._bag is None:
self._bag = self._new_bag()
blob_id = self._bag.append(blob)
- if len(self._bag) >= self._max_bag_size:
+ if self._bag.get_bytes() >= self._max_bag_size:
self.flush()
return blob_id
diff --git a/obnamlib/blob_store_tests.py b/obnamlib/blob_store_tests.py
index 4f562c33..079c932b 100644
--- a/obnamlib/blob_store_tests.py
+++ b/obnamlib/blob_store_tests.py
@@ -77,7 +77,7 @@ class BlobStoreTests(unittest.TestCase):
blob_store = obnamlib.BlobStore()
blob_store.set_bag_store(bag_store)
- blob_store.set_max_bag_size(len(blob))
+ blob_store.set_max_bag_size(len(blob) + 1)
blob_store.put_blob(blob)
self.assertTrue(bag_store.is_empty())
@@ -91,7 +91,7 @@ class BlobStoreTests(unittest.TestCase):
blob_store = obnamlib.BlobStore()
blob_store.set_bag_store(bag_store)
- blob_store.set_max_bag_size(len(blob))
+ blob_store.set_max_bag_size(len(blob) + 1)
blob_id = blob_store.put_blob(blob)
self.assertTrue(bag_store.is_empty())