summaryrefslogtreecommitdiffstats
path: root/cobbler/serializer.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-10-15 11:01:19 -0400
committerMichael DeHaan <mdehaan@redhat.com>2007-10-15 11:01:19 -0400
commit096b9e109e2f8a954af25b8f5241d5f7fd089755 (patch)
tree57b70179eed0b5b3b65a8f78d3fb5ad8093496d5 /cobbler/serializer.py
parent2fd4775c68160a8617fff5f7015542bf8c1501e5 (diff)
downloadthird_party-cobbler-096b9e109e2f8a954af25b8f5241d5f7fd089755.tar.gz
third_party-cobbler-096b9e109e2f8a954af25b8f5241d5f7fd089755.tar.xz
third_party-cobbler-096b9e109e2f8a954af25b8f5241d5f7fd089755.zip
Work on an shelve-based external storage, for performance testing. Sqlite
is just as likely at this point.
Diffstat (limited to 'cobbler/serializer.py')
-rw-r--r--cobbler/serializer.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/cobbler/serializer.py b/cobbler/serializer.py
index 871aad9..2aa5d87 100644
--- a/cobbler/serializer.py
+++ b/cobbler/serializer.py
@@ -33,10 +33,32 @@ def serialize(obj):
"""
Save a collection to disk or other storage.
"""
+
storage_module = __get_storage_module(obj.collection_type())
storage_module.serialize(obj)
return True
+def serialize_item(collection, item):
+ storage_module = __get_storage_module(collection.collection_type())
+ save_fn = getattr(storage_module, "serialize_item", None)
+ if save_fn is None:
+ # print "DEBUG: full serializer"
+ return storage_module.serialize(collection)
+ else:
+ # print "DEBUG: partial serializer"
+ return save_fn(collection,item)
+
+def serialize_delete(collection, item):
+ storage_module = __get_storage_module(collection.collection_type())
+ delete_fn = getattr(storage_module, "serialize_delete", None)
+ if delete_fn is None:
+ # print "DEBUG: full delete"
+ return storage_module.serialize(collection)
+ else:
+ # print "DEBUG: partial delete"
+ return delete_fn(collection,item)
+
+
def deserialize(obj,topological=False):
"""
Fill in an empty collection from disk or other storage