Index: api.scm ================================================================== --- api.scm +++ api.scm @@ -23,15 +23,17 @@ (declare (uses db)) (declare (uses debugprint)) (declare (uses dbmod)) (declare (uses dbfile)) (declare (uses tasks)) +(declare (uses rmtmod)) (declare (uses tcp-transportmod)) (import dbmod) (import dbfile) (import debugprint) +(import rmtmod) (import tcp-transportmod) (use srfi-69 posix matchable Index: archive.scm ================================================================== --- archive.scm +++ archive.scm @@ -22,16 +22,18 @@ (declare (uses db)) (declare (uses debugprint)) (declare (uses mtargs)) (declare (uses common)) (declare (uses commonmod)) +(declare (uses rmtmod)) (use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 format md5 message-digest srfi-18) (import commonmod debugprint + rmtmod (prefix mtargs args:)) (include "common_records.scm") (include "db_records.scm") Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -18,10 +18,11 @@ ;;====================================================================== (declare (unit common)) (declare (uses commonmod)) +(declare (uses rmtmod)) (declare (uses debugprint)) (declare (uses mtargs)) (use srfi-1 data-structures posix regex-case (prefix base64 base64:) format dot-locking csv-xml z3 udp ;; sql-de-lite @@ -34,10 +35,11 @@ (use posix-extras pathname-expand files) (import commonmod debugprint + rmtmod (prefix mtargs args:)) (include "common_records.scm") Index: dashboard-context-menu.scm ================================================================== --- dashboard-context-menu.scm +++ dashboard-context-menu.scm @@ -27,10 +27,11 @@ (declare (uses common)) (declare (uses commonmod)) (declare (uses db)) (declare (uses gutils)) (declare (uses rmt)) +(declare (uses rmtmod)) (declare (uses ezsteps)) ;; (declare (uses sdb)) ;; (declare (uses filedb)) (declare (uses subrun)) @@ -46,10 +47,11 @@ (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (import commonmod + rmtmod debugprint) (define (dboard:launch-testpanel run-id test-id) (let* ((dboardexe (common:find-local-megatest "dashboard")) (cmd (conc dboardexe Index: dashboard-tests.scm ================================================================== --- dashboard-tests.scm +++ dashboard-tests.scm @@ -27,14 +27,13 @@ (declare (uses commonmod)) (declare (uses db)) (declare (uses gutils)) (declare (uses rmt)) (declare (uses ezsteps)) -;; (declare (uses sdb)) -;; (declare (uses filedb)) (declare (uses subrun)) (declare (uses debugprint)) +(declare (uses rmtmod)) (use format fmt) (require-library iup) (import (prefix iup iup:)) @@ -42,10 +41,11 @@ (use srfi-1 posix regex regex-case srfi-69) (use (prefix sqlite3 sqlite3:)) (import commonmod + rmtmod debugprint) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -35,11 +35,11 @@ (declare (uses dashboard-context-menu)) (declare (uses vg)) (declare (uses subrun)) (declare (uses mt)) (declare (uses dbmod)) -;; (declare (uses dbmemmod)) +(declare (uses rmtmod)) (declare (uses dbfile)) (declare (uses commonmod)) (declare (uses commonmod.import)) (use format) @@ -56,10 +56,11 @@ (import commonmod (prefix mtargs args:) dbmod dbfile + rmtmod debugprint) (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -32,10 +32,11 @@ (declare (uses keys)) (declare (uses ods)) (declare (uses mt)) (declare (uses commonmod)) (declare (uses mtargs)) +(declare (uses rmtmod)) (import commonmod (prefix mtargs args:)) (use (srfi 18) @@ -69,10 +70,11 @@ (define *number-non-write-queries* 0) (import debugprint) (import dbmod) (import dbfile) +(import rmtmod) ;; record for keeping state,status and count for doing roll-ups in ;; iterated tests ;; (defstruct dbr:counts Index: dbfile.scm ================================================================== --- dbfile.scm +++ dbfile.scm @@ -15,10 +15,12 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see . ;;====================================================================== + +(use srfi-18) (declare (unit dbfile)) (declare (uses debugprint)) (declare (uses commonmod)) @@ -27,22 +29,25 @@ (import scheme chicken data-structures extras - matchable) - -(import (prefix sqlite3 sqlite3:) - posix typed-records srfi-18 srfi-1 - srfi-69 - stack - files - ports - - commonmod - debugprint - ) + matchable + + (prefix sqlite3 sqlite3:) + posix typed-records + + srfi-18 + srfi-1 + srfi-69 + stack + files + ports + + commonmod + debugprint + ) ;; parameters ;; (define dbfile:testsuite-name (make-parameter #f)) @@ -1076,14 +1081,10 @@ ;; call with dbinit=db:initialize-main-db ;; (define (db:open-db dbstruct run-id dbinit) ;; (mutex-lock! *db-open-mutex*) (let* ((dbdat (dbfile:open-db dbstruct run-id dbinit))) - #;(case (rmt:transport-mode) - ((http) (dbfile:open-db dbstruct run-id dbinit)) - ((tcp) (dbmod:open-db dbstruct run-id dbinit)) - (else (assert #f "FATAL: rmt:transport-node not correct value"(rmt:transport-mode)))) (set! *db-write-access* (not (dbr:dbdat-read-only dbdat))) ;; (mutex-unlock! *db-open-mutex*) dbdat)) (define dbfile:db-init-proc (make-parameter #f)) Index: dcommon.scm ================================================================== --- dcommon.scm +++ dcommon.scm @@ -21,19 +21,21 @@ (declare (unit dcommon)) (declare (uses gutils)) (declare (uses db)) (declare (uses commonmod)) +(declare (uses rmtmod)) (use format) (require-library iup) (import (prefix iup iup:)) (use canvas-draw) (import canvas-draw-iup) (use regex typed-records matchable) (import commonmod + rmtmod debugprint) ;; (declare (uses synchash)) (include "megatest-version.scm") (include "common_records.scm") Index: diff-report.scm ================================================================== --- diff-report.scm +++ diff-report.scm @@ -18,12 +18,14 @@ (declare (unit diff-report)) (declare (uses common)) (declare (uses debugprint)) (declare (uses rmt)) +(declare (uses rmtmod)) (declare (uses commonmod)) (import commonmod + rmtmod debugprint) (include "common_records.scm") (use matchable) (use fmt) Index: ezsteps.scm ================================================================== --- ezsteps.scm +++ ezsteps.scm @@ -23,20 +23,20 @@ (declare (uses db)) (declare (uses common)) (declare (uses debugprint)) (declare (uses items)) (declare (uses runconfig)) -;; (declare (uses sdb)) -;; (declare (uses filedb)) (declare (uses commonmod)) +(declare (uses rmtmod)) (declare (uses mtargs)) (use srfi-1 posix regex srfi-69 directory-utils call-with-environment-variables posix-extras z3 csv typed-records pathname-expand matchable) (import commonmod debugprint + rmtmod (prefix mtargs args:)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") Index: genexample.scm ================================================================== --- genexample.scm +++ genexample.scm @@ -19,13 +19,15 @@ ;;====================================================================== (declare (unit genexample)) (declare (uses mtargs)) (declare (uses debugprint)) +(declare (uses rmtmod)) (use posix regex matchable) (import (prefix mtargs args:) + rmtmod debugprint) (include "db_records.scm") (define genexample:example-logpro Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -26,10 +26,11 @@ (declare (uses common)) (declare (uses debugprint)) (declare (uses commonmod)) (declare (uses configf)) (declare (uses db)) +(declare (uses rmtmod)) (declare (uses ezsteps)) (declare (uses dbfile)) (declare (uses mtargs)) (use regex regex-case base64 sqlite3 srfi-18 directory-utils posix-extras z3 @@ -37,10 +38,11 @@ (use typed-records pathname-expand matchable) (import (prefix base64 base64:) (prefix sqlite3 sqlite3:) (prefix mtargs args:) + rmtmod debugprint) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") Index: mt.scm ================================================================== --- mt.scm +++ mt.scm @@ -28,13 +28,14 @@ (declare (uses runconfig)) (declare (uses tests)) (declare (uses server)) (declare (uses runs)) (declare (uses rmt)) -;; (declare (uses filedb)) +(declare (uses rmtmod)) -(import debugprint) +(import debugprint + rmtmod) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -42,11 +42,11 @@ ;; http - use the old http + in /tmp db ;; tcp - use tcp transport with inmem db ;; nfs - use direct to disk access (read-only) ;; -(define rmt:transport-mode (make-parameter 'http)) +(define rmt:transport-mode (make-parameter 'tcp)) ;; ;; THESE ARE ALL CALLED ON THE CLIENT SIDE!!! ;; ;; generate entries for ~/.megatestrc with the following @@ -244,16 +244,10 @@ ;; Deprecated for nmsg-transport. ;; ;; (define (rmt:login-no-auto-client-setup runremote) ;; (rmt:send-receive-no-auto-client-setup runremote 'login 0 (list *toppath* megatest-version (client:get-signature)))) -;; hand off a call to one of the db:queries statements -;; added run-id to make looking up the correct db possible -;; -(define (rmt:general-call stmtname run-id . params) - (rmt:send-receive 'general-call run-id (append (list stmtname run-id) params))) - ;; given a hostname, return a pair of cpu load and update time representing latest intelligence from tests running on that host (define (rmt:get-latest-host-load hostname) (rmt:send-receive 'get-latest-host-load 0 (list hostname))) Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -43,10 +43,22 @@ (ulexdat #f) ) ;; hold the send-receive proc in this parameter (define rmtmod:send-receive #f) ;; (make-parameter #f)) + +;;====================================================================== +;; M I S C +;;====================================================================== + +;; hand off a call to one of the db:queries statements +;; added run-id to make looking up the correct db possible +;; +(define (rmt:general-call stmtname run-id . params) + (rmtmod:send-receive 'general-call run-id (append (list stmtname run-id) params))) + + ;;====================================================================== ;; import an sexpr file into the db ;;====================================================================== @@ -97,48 +109,8 @@ (let* ((testname (alist-ref "testname" test-rec equal?)) (item-path (alist-ref "item_path" test-rec equal?))) (debug:print 0 *default-log-port* " Insert test in run "run-id": "testname"/"item-path) (rmtmod:send-receive 'insert-test run-id test-rec))) -;;====================================================================== -;; return the handle struct for sending queries to a specific database -;; - initializes the connection object if this is the first access -;; - finds the "captain" and asks who to talk to for the given dbfname -;; - establishes the connection to the current dbowner -;; -#;(define (rmt:connect alldat dbfname dbtype) - (let* ((ulexdat (or (alldat-ulexdat alldat) - (rmt:setup-ulex alldat)))) - (ulex:connect ulexdat dbfname dbtype))) - -;; setup the remote calls -#;(define (rmt:setup-ulex alldat) - (let* ((udata (ulex:setup))) ;; establish connection to ulex - (alldat-ulexdat-set! alldat udata) - ;; register all needed procs - (ulex:register-handler udata 'ping cmod:get-full-version) ;; override ping with get-full-version - (ulex:register-handler udata 'login cmod:get-full-version) ;; force setup of the connection - (ulex:register-handler udata 'execute api:execute-requests) - udata)) - -;; set up a connection to the current owner of the dbfile associated with rid -;; then send the query to that dbfile owner and wait for a response. -;; -#;(define (rmt:send-receive alldat cmd rid params #!key (attemptnum 1)(area-dat #f)) ;; start attemptnum at 1 so the modulo below works as expected - (let* (;; (alldat *alldat*) - (areapath (alldat-areapath alldat)) - (dbtype (if (or (not rid)(< rid 1)) ;; this is the criteria for "main.db" - "main" "runs")) - (dbfname (if (equal? dbtype "main") - "main.db" - (conc rid ".db"))) - (dbfile (conc areapath "/.db/" dbfname)) - (ulexconn (rmt:connect alldat dbfname dbtype)) ;; ulexconn is our new *runremote*, it is a dbowner struct < pdat lastrefresh > - (udata (alldat-ulexdat alldat))) - (ulex:remote-request udata ulexconn 'immediate dbfile 'execute rid params))) - ;; need to call this on the other side - ;; (api:execute-requests dbstruct-local (vector (symbol->string cmd) params)))) - - #;(with-input-from-string - (ulex:remote-request udata ulexconn 'immediate dbfile 'execute rid (with-output-to-string (lambda ()(serialize params)))) - (lambda ()(deserialize))) + + ) Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -27,10 +27,11 @@ (declare (uses tests)) (declare (uses server)) (declare (uses mt)) (declare (uses archive)) (declare (uses mtargs)) +(declare (uses rmtmod)) (use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (srfi 18) posix-extras directory-utils pathname-expand typed-records format sxml-serializer sxml-modifications matchable) @@ -44,10 +45,11 @@ ;; (include "debugger.scm") (import commonmod debugprint + rmtmod (prefix mtargs args:)) ;; use this struct to facilitate refactoring ;; Index: synchash.scm ================================================================== --- synchash.scm +++ synchash.scm @@ -27,11 +27,15 @@ (import (prefix sqlite3 sqlite3:)) (declare (unit synchash)) (declare (uses db)) (declare (uses server)) +(declare (uses rmtmod)) + (include "db_records.scm") + +(import rmtmod) (define (synchash:make) (make-hash-table)) ;; given an alist of objects '((id obj) ...) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -21,10 +21,11 @@ (declare (unit tasks)) (declare (uses debugprint)) (declare (uses dbfile)) (declare (uses db)) (declare (uses rmt)) +(declare (uses rmtmod)) (declare (uses common)) (declare (uses pgdb)) (declare (uses commonmod)) (declare (uses mtargs)) @@ -31,10 +32,11 @@ (use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking format) (import (prefix sqlite3 sqlite3:)) (import commonmod debugprint + rmtmod (prefix mtargs args:)) (import dbfile) ;; (import pgdb) ;; pgdb is a module Index: tcmt.scm ================================================================== --- tcmt.scm +++ tcmt.scm @@ -23,10 +23,11 @@ ;; 2. Every five seconds check for state/status changes and print the info ;; (declare (uses mtargs)) (declare (uses rmt)) +(declare (uses rmtmod)) (declare (uses common)) ;; (declare (uses megatest-version)) (declare (uses commonmod)) (use srfi-1 posix srfi-69 srfi-18 regex defstruct) @@ -33,10 +34,11 @@ (use trace) ;; (trace-call-sites #t) (import commonmod + rmtmod (prefix mtargs args:)) (include "megatest-version.scm") (include "megatest-fossil-hash.scm") (include "db_records.scm") Index: tdb.scm ================================================================== --- tdb.scm +++ tdb.scm @@ -29,18 +29,20 @@ (declare (uses ods)) (declare (uses mt)) (declare (uses db)) (declare (uses commonmod)) (declare (uses mtargs)) +(declare (uses rmtmod)) (require-extension (srfi 18) extras tcp) (use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 message-digest base64) (import (prefix sqlite3 sqlite3:)) (import (prefix base64 base64:)) (import commonmod debugprint + rmtmod (prefix mtargs args:)) (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") Index: tests.scm ================================================================== --- tests.scm +++ tests.scm @@ -34,16 +34,18 @@ (declare (uses runconfig)) ;; (declare (uses sdb)) (declare (uses server)) ;;(declare (uses stml2)) (declare (uses mtargs)) +(declare (uses rmtmod)) (use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking tcp directory-utils) (import (prefix sqlite3 sqlite3:)) (import commonmod (prefix mtargs args:) - debugprint) + debugprint + rmtmod) (require-library stml) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm")