diff --git a/datastore/sql.nim b/datastore/sql.nim index 3650323..16ed24a 100644 --- a/datastore/sql.nim +++ b/datastore/sql.nim @@ -20,13 +20,13 @@ push: {.upraises: [].} type SQLiteDatastore* = ref object of Datastore - db: SQLiteBackend[KeyId, DataBuffer] + db: ThreadDatastore[SQLiteBackend[KeyId, DataBuffer]] proc path*(self: SQLiteDatastore): string = - self.db.path() + self.db.backend.path() proc readOnly*(self: SQLiteDatastore): bool = - self.db.readOnly() + self.db.backend.readOnly() method has*(self: SQLiteDatastore, key: Key): Future[?!bool] {.async.} = diff --git a/datastore/threads/threadproxyds.nim b/datastore/threads/threadproxyds.nim index 41e5b88..2181b6a 100644 --- a/datastore/threads/threadproxyds.nim +++ b/datastore/threads/threadproxyds.nim @@ -23,8 +23,8 @@ import pkg/threading/smartptrs import ../key import ../query import ./backend -import ./fsbackend -import ./sqlbackend +# import ./fsbackend +# import ./sqlbackend import ./asyncsemaphore import ./databuffer @@ -137,6 +137,7 @@ template dispatchTask*[BT](self: ThreadDatastore[BT], proc hasTask[T, DB](ctx: TaskCtx[T], ds: DB, key: KeyId) {.gcsafe.} = ## run backend command + mixin has executeTask(ctx): has(ds, key) @@ -156,6 +157,7 @@ proc has*[BT](self: ThreadDatastore[BT], proc deleteTask[T, DB](ctx: TaskCtx[T], ds: DB; key: KeyId) {.gcsafe.} = ## run backend command + mixin delete executeTask(ctx): delete(ds, key) @@ -187,6 +189,7 @@ proc delete*[BT](self: ThreadDatastore[BT], proc putTask[T, DB](ctx: TaskCtx[T], ds: DB; key: KeyId, data: DataBuffer) {.gcsafe, nimcall.} = + mixin put executeTask(ctx): put(ds, key, data) @@ -221,6 +224,7 @@ proc put*[E, DB]( proc getTask[DB](ctx: TaskCtx[DataBuffer], ds: DB; key: KeyId) {.gcsafe, nimcall.} = ## run backend command + mixin get executeTask(ctx): let res = get(ds, key) res