summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-05-04 22:50:30 +0300
committerLars Wirzenius <liw@liw.fi>2016-05-04 22:50:30 +0300
commit8cc35c8e38c2e5f99ea8c379388226f94e8945d3 (patch)
tree71be6d1d5d4f98aeea0efd547912c584562353b3
parent98ab95283d6057c977fff6f33dc8dee1f5710f8e (diff)
downloadobnam-8cc35c8e38c2e5f99ea8c379388226f94e8945d3.tar.gz
Add tracing for some object creation/deletion
-rw-r--r--obnamlib/bag.py6
-rw-r--r--obnamlib/fmt_ga/client.py26
-rw-r--r--obnamlib/fmt_ga/dirobj.py6
-rw-r--r--obnamlib/fmt_ga/tree.py10
4 files changed, 48 insertions, 0 deletions
diff --git a/obnamlib/bag.py b/obnamlib/bag.py
index 87bec277..dea00f60 100644
--- a/obnamlib/bag.py
+++ b/obnamlib/bag.py
@@ -16,16 +16,22 @@
# =*= License: GPL-3+ =*=
+import tracing
+
import obnamlib
class Bag(object):
def __init__(self):
+ tracing.trace('INIT Bag %s', id(self))
self._bag_id = None
self._blobs = []
self._blobs_bytes = 0
+ def __del__(self):
+ tracing.trace('DEL Bag %s', id(self))
+
def get_id(self):
return self._bag_id
diff --git a/obnamlib/fmt_ga/client.py b/obnamlib/fmt_ga/client.py
index d29c85a6..ee24730b 100644
--- a/obnamlib/fmt_ga/client.py
+++ b/obnamlib/fmt_ga/client.py
@@ -20,6 +20,8 @@ import copy
import os
import stat
+import tracing
+
import obnamlib
@@ -28,6 +30,7 @@ class GAClient(object):
_well_known_blob = 'root'
def __init__(self, client_name):
+ tracing.trace('INIT GAClient %s', id(self))
self._fs = None
self._dirname = None
self._client_name = client_name
@@ -35,6 +38,9 @@ class GAClient(object):
self._default_checksum_algorithm = None
self.clear()
+ def __del__(self):
+ tracing.trace('DEL GAClient %s', id(self))
+
def clear(self):
self._blob_store = None
self._client_keys = GAKeys()
@@ -394,8 +400,12 @@ class GAClient(object):
class GAKeys(object):
def __init__(self):
+ tracing.trace('INIT GAKeys %s', id(self))
self._dict = {}
+ def __del__(self):
+ tracing.trace('DEL GAKeys %s', id(self))
+
def as_dict(self):
return self._dict
@@ -412,9 +422,13 @@ class GAKeys(object):
class GAGenerationList(object):
def __init__(self):
+ tracing.trace('INIT GAGenerationList %s', id(self))
self._generations = []
self._by_number = {}
+ def __del__(self):
+ tracing.trace('DEL GAGenerationList %s', id(self))
+
def __len__(self):
return len(self._generations)
@@ -440,11 +454,15 @@ class GAGenerationList(object):
class GAGeneration(object):
def __init__(self):
+ tracing.trace('INIT GAGeneration %s', id(self))
self._id = None
self._keys = GAKeys()
self._file_metadata = GAFileMetadata()
self._root_object_id = None
+ def __del__(self):
+ tracing.trace('DEL GAGeneration %s', id(self))
+
def as_dict(self):
return {
'id': self._id,
@@ -483,10 +501,14 @@ class GAGeneration(object):
class GAFileMetadata(object):
def __init__(self):
+ tracing.trace('INIT GAFileMetadata %s', id(self))
self._blob_store = None
self._tree = None
self._added_files = AddedFiles()
+ def __del__(self):
+ tracing.trace('DEL GAFileMetadata %s', id(self))
+
def set_blob_store(self, blob_store):
assert self._blob_store is None
assert self._tree is None
@@ -745,8 +767,12 @@ class GAFileMetadata(object):
class AddedFiles(object):
def __init__(self):
+ tracing.trace('INIT AddedFile %s', id(self))
self.clear()
+ def __del__(self):
+ tracing.trace('DEL AddedFile %s', id(self))
+
def clear(self):
self._files = {}
diff --git a/obnamlib/fmt_ga/dirobj.py b/obnamlib/fmt_ga/dirobj.py
index 64c333d1..58337e3d 100644
--- a/obnamlib/fmt_ga/dirobj.py
+++ b/obnamlib/fmt_ga/dirobj.py
@@ -16,6 +16,8 @@
# =*= License: GPL-3+ =*=
+import tracing
+
import obnamlib
@@ -53,12 +55,16 @@ _key_from_short = dict((v, k) for k, v in _short_key_names.items())
class GADirectory(object):
def __init__(self):
+ tracing.trace('INIT GADirectory %s', id(self))
self._dict = {
'metadata': {},
'subdirs': {},
}
self._mutable = True
+ def __del__(self):
+ tracing.trace('DEL GADirectory %s', id(self))
+
def is_mutable(self):
return self._mutable
diff --git a/obnamlib/fmt_ga/tree.py b/obnamlib/fmt_ga/tree.py
index a10a7c48..e401f4ca 100644
--- a/obnamlib/fmt_ga/tree.py
+++ b/obnamlib/fmt_ga/tree.py
@@ -18,6 +18,8 @@
import os
+import tracing
+
import obnamlib
@@ -36,10 +38,14 @@ class GATree(object):
'''
def __init__(self):
+ tracing.trace('INIT GATree %s', id(self))
self._blob_store = None
self._root_dir_id = None
self._cache = DirectoryObjectCache()
+ def __del__(self):
+ tracing.trace('DEL GATree %s', id(self))
+
def set_blob_store(self, blob_store):
self._blob_store = blob_store
@@ -155,8 +161,12 @@ class GATree(object):
class DirectoryObjectCache(object):
def __init__(self):
+ tracing.trace('INIT DirectoryObjectCache %s', id(self))
self.clear()
+ def __del__(self):
+ tracing.trace('DEL DirectoryObjectCache %s', id(self))
+
def clear(self):
self._objs = {}