Index: api.scm ================================================================== --- api.scm +++ api.scm @@ -22,10 +22,13 @@ (declare (unit api)) (declare (uses rmt)) (declare (uses db)) (declare (uses tasks)) + +(declare (uses apimod)) +(import apimod) ;; api:read-only-queries and api:execute-requests have been moved into common_records ;; These are called by the server on recipt of /api calls Index: commonmod.scm ================================================================== --- commonmod.scm +++ commonmod.scm @@ -23,10 +23,15 @@ (module commonmod * (import scheme chicken data-structures extras) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18) + +(define (db:dbdat-get-path dbdat) + (if (pair? dbdat) + (cdr dbdat) + #f)) ;; (define (debug:print . params) #f) ;; (define (debug:print-info . params) #f) ;; ;; (define (set-functions dbgp dbgpinfo) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -41,11 +41,14 @@ (include "key_records.scm") (include "run_records.scm") (declare (uses rmtmod)) (import rmtmod) - +(declare (uses dbmod)) +(import dbmod) +(declare (uses commonmod)) +(import commonmod) (define *rundb-mutex* (make-mutex)) ;; prevent problems opening/closing rundb's (define *number-of-writes* 0) (define *number-non-write-queries* 0) @@ -115,21 +118,10 @@ ;; (stack-push! (dbr:dbstruct-dbstack dbstruct) newdb) newdb) (stack-pop! (dbr:dbstruct-dbstack dbstruct))) (db:open-db dbstruct))) -;; ;; legacy handling of structure for managing db's. Refactor this into dbr:? -(define (db:dbdat-get-db dbdat) - (if (pair? dbdat) - (car dbdat) - dbdat)) - -(define (db:dbdat-get-path dbdat) - (if (pair? dbdat) - (cdr dbdat) - #f)) - ;; mod-read: ;; 'mod modified data ;; 'read read data ;; Locks the mutex and depending on 'mod or 'read passed, sets the last timestamp in dbstruct ;; Index: dbmod.scm ================================================================== --- dbmod.scm +++ dbmod.scm @@ -28,8 +28,14 @@ (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18 srfi-69 format ports srfi-1 matchable) (import commonmod) ;; (use (prefix ulex ulex:)) (include "common_records.scm") + +;; ;; legacy handling of structure for managing db's. Refactor this into dbr:? +(define (db:dbdat-get-db dbdat) + (if (pair? dbdat) + (car dbdat) + dbdat)) ) Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -22,13 +22,16 @@ (declare (unit rmt)) (declare (uses api)) (declare (uses http-transport)) (include "common_records.scm") + (declare (uses rmtmod)) - (import rmtmod) +(declare (uses commonmod)) +(import commonmod) + (set-fn 'server:expiration-timeout server:expiration-timeout) (set-fn 'common:get-homehost common:get-homehost) (set-fn 'server:check-if-running server:check-if-running) (set-fn 'api:execute-requests api:execute-requests) (set-fn 'http-transport:close-connections http-transport:close-connections ) Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -61,11 +61,11 @@ ))) (define (rmt:open-qry-close-locally log-port multi-sync-mutex cmd run-id params alldat #!key (remretries 5)) (let* ((ro-queries (alldat-read-only-queries alldat)) (qry-is-write (not (member cmd ro-queries))) - (db-file-path (exec-fn 'db:dbfile-path)) ;; 0)) + (db-file-path (db:dbfile-path)) ;; 0)) (dbstruct-local (exec-fn 'db:setup #t)) ;; make-dbr:dbstruct path: dbdir local: #t))) (read-only (not (file-write-access? db-file-path))) (start (current-milliseconds)) (resdat (if (not (and read-only qry-is-write)) (let ((v (exec-fn 'api:execute-requests dbstruct-local (vector (symbol->string cmd) params))))