|
|
|
@ -1,5 +1,4 @@ |
|
|
|
import os |
|
|
|
import os |
|
|
|
import concurrent |
|
|
|
|
|
|
|
import queue |
|
|
|
import queue |
|
|
|
import threading |
|
|
|
import threading |
|
|
|
import asyncio |
|
|
|
import asyncio |
|
|
|
@ -10,7 +9,10 @@ from .util import test_read_write_permissions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sql(func): |
|
|
|
def sql(func): |
|
|
|
"""wrapper for sql methods""" |
|
|
|
"""wrapper for sql methods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
returns an awaitable asyncio.Future |
|
|
|
|
|
|
|
""" |
|
|
|
def wrapper(self: 'SqlDB', *args, **kwargs): |
|
|
|
def wrapper(self: 'SqlDB', *args, **kwargs): |
|
|
|
assert threading.currentThread() != self.sql_thread |
|
|
|
assert threading.currentThread() != self.sql_thread |
|
|
|
f = self.asyncio_loop.create_future() |
|
|
|
f = self.asyncio_loop.create_future() |
|
|
|
@ -20,7 +22,7 @@ def sql(func): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SqlDB(Logger): |
|
|
|
class SqlDB(Logger): |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, asyncio_loop: asyncio.BaseEventLoop, path, commit_interval=None): |
|
|
|
def __init__(self, asyncio_loop: asyncio.BaseEventLoop, path, commit_interval=None): |
|
|
|
Logger.__init__(self) |
|
|
|
Logger.__init__(self) |
|
|
|
self.asyncio_loop = asyncio_loop |
|
|
|
self.asyncio_loop = asyncio_loop |
|
|
|
|