summaryrefslogtreecommitdiff
path: root/server/__init__.py
blob: f2c73b78218017cddb6b7bf641da2ebeca9f0e3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# coding=utf-8

import multiprocessing.managers
from . import user_session
from . import prolog_session

__all__ = ['user_session']

class CodeqManager(multiprocessing.managers.BaseManager):
    pass

class UserSessionProxy(multiprocessing.managers.BaseProxy):
    _method_to_typeid_ = {'get_prolog':'PrologSession'}

CodeqManager.register('PrologSession')
CodeqManager.register('UserSession', proxytype=UserSessionProxy)
CodeqManager.register('get_session_by_id', callable=user_session.get_session_by_id, proxytype=UserSessionProxy)
CodeqManager.register('get_or_create_session', callable=user_session.get_or_create_session, proxytype=UserSessionProxy)
CodeqManager.register('authenticate_and_create_session', callable=user_session.authenticate_and_create_session, proxytype=UserSessionProxy)

def start():
    m = CodeqManager(address=('localhost', 16231), authkey=b'c0d3q3y')
    m.get_server().serve_forever()