From 5611f40a200e30777587505d8405323ca4eec5fd Mon Sep 17 00:00:00 2001
From: "alexey.stratulat" <alexey.stratulat@demlabs.net>
Date: Thu, 19 Dec 2019 17:38:12 +0700
Subject: [PATCH] [+] Added initialize mempool module

---
 include/python-cellframe.h |  2 +-
 src/python-cellframe.c     | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/python-cellframe.h b/include/python-cellframe.h
index 7f93a390..01efcdba 100644
--- a/include/python-cellframe.h
+++ b/include/python-cellframe.h
@@ -11,7 +11,6 @@
 #include "libdap_chain_atom_iter_python.h"
 #include "wrapping_dap_chain_cell.h"
 #include "wrapping_dap_chain_common.h"
-#include "wrapping_dap_chain_common_objects.h"
 #include "wrapping_dap_chain_cs.h"
 #include "wrapping_dap_chain_datum.h"
 #include "wrapping_dap_chain_datum_token.h"
@@ -31,6 +30,7 @@
 #include "wrapping_dap_enc_http.h"
 #include "wrapping_dap_stream.h"
 #include "wrapping_dap_stream_ctl.h"
+#include "wrapping_dap_mempool.h"
 
 #include "dap_common.h"
 
diff --git a/src/python-cellframe.c b/src/python-cellframe.c
index f5e61409..d92fea18 100644
--- a/src/python-cellframe.c
+++ b/src/python-cellframe.c
@@ -144,6 +144,12 @@ static PyObject *python_cellframe_init(PyObject *self, PyObject *args){
                 return NULL;
             }
         }
+        if (strcmp(c_value, "Mempool") == 0){
+            if (dap_datum_mempool_init() != 0){
+                PyErr_SetString(CellFrame_error, "Failed to initialize Mempool module. ");
+                return NULL;
+            }
+        }
     }
     return PyLong_FromLong(0);
 }
@@ -194,7 +200,8 @@ PyMODINIT_FUNC PyInit_CellFrame(void){
             PyType_Ready(&DapHTTP_DapHTTPType) < 0 ||
             PyType_Ready(&DapEncHTTP_DapEncHTTPType) < 0 ||
             PyType_Ready(&DapStream_DapStreamType) < 0 ||
-            PyType_Ready(&DapStreamCtl_DapStreamCtlType) < 0
+            PyType_Ready(&DapStreamCtl_DapStreamCtlType) < 0 ||
+            PyType_Ready(&DapMempool_DapMempoolType) < 0
             )
                return NULL;
 
@@ -262,6 +269,7 @@ PyMODINIT_FUNC PyInit_CellFrame(void){
     PyModule_AddObject(module, "EncHttp", (PyObject*)&DapEncHTTP_DapEncHTTPType);
     PyModule_AddObject(module, "Stream", (PyObject*)&DapStream_DapStreamType);
     PyModule_AddObject(module, "StreamCtl", (PyObject*)&DapStreamCtl_DapStreamCtlType);
+    PyModule_AddObject(module, "Mempool", (PyObject*)&DapMempool_DapMempoolType);
 
 
     return module;
-- 
GitLab