summaryrefslogtreecommitdiff
path: root/src/server/rz_kernel.py
blob: 75fc959a846da269f0a38164c7a6a05637b92aae (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
"""
Rhizi kernel, home to core operation login
"""
import db_controller
import logging
import traceback
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, db_ctl, topo_diff):
        """
        commit a graph topology diff - this is a common pathway for:
           - RESP API calls
           - socket.io calls
           - future interfaces
        """
        op = DBO_diff_commit__topo(topo_diff)
        try:
            op_ret = db_ctl.exec_op(op)
            return op_ret
        except Exception as e:
            log.error(e.message)
            log.error(traceback.print_exc())
            raise e

    def diff_commit__attr(self, db_ctl, attr_diff):
        op = DBO_diff_commit__attr(attr_diff)
        try:
            op_ret = db_ctl.exec_op(op)
            return op_ret
        except Exception as e:
            log.error(e.message)
            log.error(traceback.print_exc())
            raise e