summaryrefslogtreecommitdiff
path: root/server/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'server/__init__.py')
-rw-r--r--server/__init__.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/server/__init__.py b/server/__init__.py
new file mode 100644
index 0000000..f2c73b7
--- /dev/null
+++ b/server/__init__.py
@@ -0,0 +1,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()