summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-py/db_controller.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/src-py/db_controller.py b/src-py/db_controller.py
index bd085371..ddc25a85 100644
--- a/src-py/db_controller.py
+++ b/src-py/db_controller.py
@@ -125,28 +125,29 @@ class DB_composed_op(DB_op):
class DBO_topo_diff_commit(DB_composed_op):
"""
- commit a
+ commit a Topo_Diff
"""
def __init__(self, topo_diff):
super(DBO_topo_diff_commit, self).__init__()
# TODO rm link set
# TODO rm node set
- assert not topo_diff.node_set_rm, 'unsupported'
- assert not topo_diff.link_set_rm, 'unsupported'
+ assert 0 == len(topo_diff.node_set_rm), 'unsupported'
+ assert 0 == len(topo_diff.link_set_rm), 'unsupported'
n_add_map = db_util.meta_attr_list_to_meta_attr_map(topo_diff.node_set_add)
l_add_map = db_util.meta_attr_list_to_meta_attr_map(topo_diff.link_set_add)
- op_n_add = DBO_add_node_set(n_add_map)
- op_l_add = DBO_add_link_set(l_add_map)
-
+ #
# [!] order critical
- self.add_sub_op(op_n_add)
- self.add_sub_op(op_l_add)
+ #
+ if len(n_add_map) > 0:
+ op_n_add = DBO_add_node_set(n_add_map)
+ self.add_sub_op(op_n_add)
- def on_completion(self, data):
- pass
+ if len(l_add_map) > 0:
+ op_l_add = DBO_add_link_set(l_add_map)
+ self.add_sub_op(op_l_add)
class DBO_attr_diff_commit(DB_op):
"""