From 388f10fb226c3d2904a3b108d8b69f437086ba27 Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 12 Apr 2019 14:39:34 -0700 Subject: [PATCH] Mysql as backend instead of flat files --- nodepupper/nodeops.py | 8 ++++++-- requirements.txt | 13 +++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/nodepupper/nodeops.py b/nodepupper/nodeops.py index b69229f..8f2398b 100644 --- a/nodepupper/nodeops.py +++ b/nodepupper/nodeops.py @@ -1,5 +1,7 @@ import ZODB -import ZODB.FileStorage +from relstorage.storage import RelStorage +from relstorage.options import Options +from relstorage.adapters.mysql import MySQLAdapter import persistent import persistent.list import persistent.mapping @@ -41,7 +43,9 @@ class NClassAttachment(persistent.Persistent): class NodeOps(object): def __init__(self, db_path): - self.storage = ZODB.FileStorage.FileStorage(db_path) + self.mysql = MySQLAdapter(host="localhost", user="zodb", passwd="zodb", db="zodb", + options=Options(keep_history=False)) + self.storage = RelStorage(adapter=self.mysql) self.db = ZODB.DB(self.storage) with self.db.transaction() as c: diff --git a/requirements.txt b/requirements.txt index 9fc62a5..fa408e6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,26 +1,35 @@ appdirs==1.4.3 +asn1crypto==0.24.0 backports.functools-lru-cache==1.5 BTrees==4.5.1 certifi==2018.11.29 +cffi==1.12.2 chardet==3.0.4 cheroot==6.5.2 CherryPy==18.0.1 +cryptography==2.6.1 idna==2.8 jaraco.functools==1.20 Jinja2==2.10 MarkupSafe==1.0 more-itertools==4.3.0 +perfmetrics==2.0 persistent==4.4.2 portend==2.3 +pycparser==2.19 +PyMySQL==0.9.3 pytz==2018.5 PyYAML==3.13 +RelStorage==2.1.1 requests==2.21.0 six==1.11.0 tempora==1.13 -transaction==2.2.1 +transaction==2.4.0 urllib3==1.24.1 zc.lockfile==1.3.0 ZConfig==3.3.0 -ZODB==5.4.0 +zdaemon==4.3 +ZEO==5.2.1 +ZODB==5.5.1 zodbpickle==1.0.2 zope.interface==4.5.0