blob: e8d81270bdfca7f87397257d4911523615c25a2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
"""
Rhizi kernel, home to core operation login
"""
import logging
import traceback
import db_controller
from db_op import DBO_diff_commit__attr
from db_op import DBO_diff_commit__topo
log = logging.getLogger('rhizi')
class RZ_Kernel(object):
def diff_commit__topo(self, topo_diff, ctx={}):
"""
commit a graph topology diff - this is a common pathway for:
- RESP API calls
- socket.io calls
- future interfaces
@return: a tuple containing the input diff and the result of it's commit
"""
op = DBO_diff_commit__topo(topo_diff)
try:
for op, op_ret in self.db_ctl.exec_op(op):
yield topo_diff, op, op_ret
except Exception as e:
log.error(e.message)
log.error(traceback.print_exc())
raise e
def diff_commit__attr(self, attr_diff, ctx={}):
"""
commit a graph attribute diff - this is a common pathway for:
- RESP API calls
- socket.io calls
- future interfaces
@return: a tuple containing the input diff and the result of it's commit
"""
op = DBO_diff_commit__attr(attr_diff)
try:
for op, op_ret in self.db_ctl.exec_op(op):
yield attr_diff, op, op_ret
except Exception as e:
log.error(e.message)
log.error(traceback.print_exc())
raise e
|