summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-06-24 17:26:58 +0300
committerLars Wirzenius <liw@liw.fi>2017-06-24 17:26:58 +0300
commit1d1d2fcfbf2af0e0738073898f91de03e3fccf28 (patch)
tree437423ec47006dcf675ce739109312bd1917b416
parentd9bdb11d7d89945b2e43d54e8e4ed6e2a4b172ee (diff)
downloadobnam-1d1d2fcfbf2af0e0738073898f91de03e3fccf28.tar.gz
Add: trace statements for leaf put/get/remove
-rw-r--r--obnamlib/fmt_ga/cowtree.py9
-rw-r--r--obnamlib/fmt_ga/leaf_store.py9
2 files changed, 17 insertions, 1 deletions
diff --git a/obnamlib/fmt_ga/cowtree.py b/obnamlib/fmt_ga/cowtree.py
index dbfdcf81..c507fca3 100644
--- a/obnamlib/fmt_ga/cowtree.py
+++ b/obnamlib/fmt_ga/cowtree.py
@@ -16,6 +16,9 @@
# =*= License: GPL-3+ =*=
+import tracing
+
+
import obnamlib
@@ -74,6 +77,7 @@ class CowTree(object):
yield key
def commit(self):
+ tracing.trace('start comitting')
keys = sorted(self.keys())
leaf = obnamlib.CowLeaf()
leaf_list = obnamlib.LeafList()
@@ -86,7 +90,10 @@ class CowTree(object):
if len(leaf) > 0:
self._add_leaf(leaf_list, leaf)
leaf_id = self._put_leaf_list(leaf_list)
+ tracing.trace('commit: remove old tree')
self._remove_old_tree(self._leaf_list)
+ tracing.trace('finish committing')
+ self.set_list_node(leaf_id)
return leaf_id
def _add_leaf(self, leaf_list, leaf):
@@ -102,5 +109,7 @@ class CowTree(object):
return list_id
def _remove_old_tree(self, leaf_list): # pragma: no cover
+ tracing.trace('start removing old cowtree')
for leaf_id in leaf_list.leaves():
self._store.remove_leaf(leaf_id)
+ tracing.trace('finished removing old cowtree')
diff --git a/obnamlib/fmt_ga/leaf_store.py b/obnamlib/fmt_ga/leaf_store.py
index 56b08faa..7ba0f48a 100644
--- a/obnamlib/fmt_ga/leaf_store.py
+++ b/obnamlib/fmt_ga/leaf_store.py
@@ -16,6 +16,9 @@
# =*= License: GPL-3+ =*=
+import tracing
+
+
import obnamlib
@@ -65,14 +68,18 @@ class LeafStore(LeafStoreInterface): # pragma: no cover
self._blob_store = blob_store
def put_leaf(self, leaf):
- return self._blob_store.put_blob(leaf.as_dict())
+ leaf_id = self._blob_store.put_blob(leaf.as_dict())
+ tracing.trace('new leaf %s', leaf_id)
+ return leaf_id
def get_leaf(self, leaf_id):
+ tracing.trace('leaf_id %s', leaf_id)
leaf = obnamlib.CowLeaf()
leaf.from_dict(self._blob_store.get_blob(leaf_id))
return leaf
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)