Index: tests/simplerun/simple.scm ================================================================== --- tests/simplerun/simple.scm +++ tests/simplerun/simple.scm @@ -1,2 +1,2 @@ -(rmt:get-keys) +(print (rmt:get-keys)) Index: ulex-simple/dbmgr.scm ================================================================== --- ulex-simple/dbmgr.scm +++ ulex-simple/dbmgr.scm @@ -237,11 +237,11 @@ #t) ;; good to go ((not mconn) ;; no channel open to main? open it... (rmt:open-main-connection sinfo apath) (rmt:general-open-connection sinfo apath dbname num-tries: (- num-tries 1))) ((not dconn) ;; no channel open to dbname? - (let* ((res (rmt:send-receive sinfo apath mdbname 'get-server `(,apath ,dbname)))) + (let* ((res (rmt:send-receive-real sinfo apath mdbname 'get-server `(,apath ,dbname)))) (case res ((server-started) (if (> num-tries 0) (begin (thread-sleep! 2) @@ -289,11 +289,11 @@ (define *localmode* #f) (define *dbstruct* (make-dbr:dbstruct)) ;; Defaults to current area ;; -(define (rmt:send-receive cmd rid params #!key (attemptnum 1)(area-dat #f)) +(define (rmt:send-receive-attempted-consolidation cmd rid params #!key (attemptnum 1)(area-dat #f)) (let* ((apath *toppath*) (sinfo *db-serv-info*) (dbname (db:run-id->dbname rid))) (if (not *db-serv-info*) (begin @@ -311,10 +311,42 @@ (conndat-expires-set! cdat (+ (current-seconds) (server:expiration-timeout) -2)) ;; two second margin for network time misalignments etc. res)))) +; Defaults to current area +;; +(define (rmt:send-receive cmd rid params #!key (attemptnum 1)(area-dat #f)) + (let* ((apath *toppath*) + (sinfo *db-serv-info*) + (dbname (db:run-id->dbname rid))) + (if (not *db-serv-info*) ;; confirm this is really needed + (begin + (set! *db-serv-info* (make-servdat)) + (set! sinfo *db-serv-info*))) + (rmt:open-main-connection sinfo apath) + (if rid (rmt:general-open-connection sinfo apath dbname)) + #;(if (not (member cmd '(log-to-main))) + (debug:print-info 0 *default-log-port* "rmt:send-receive "cmd" params="params)) + (rmt:send-receive-real sinfo apath dbname cmd params))) + +;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed +;; sometime in the future +;; +(define (rmt:send-receive-real sinfo apath dbname cmd params) + (let* ((cdat (rmt:get-conn sinfo apath dbname))) + (assert cdat "FATAL: rmt:send-receive-real called without the needed channels opened") + (let* ((uconn (servdat-uconn sinfo)) ;; get the interface to ulex + ;; then send-receive using the ulex layer to host-port stored in cdat + (res (send-receive uconn (conndat-hostport cdat) cmd params))) + ;; since we accessed the server we can bump the expires time up + (conndat-expires-set! cdat (+ (current-seconds) + (server:expiration-timeout) + -2)) ;; two second margin for network time misalignments etc. + res))) + +; ;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed ;; sometime in the future. ;; ;; Purpose - call the main.db server and request a server be started ;; for the given area path and dbname @@ -730,11 +762,11 @@ (servdat-port sdat))))))))) (define (rmt:register-server sinfo apath iface port server-key dbname) (servdat-conns sinfo) ;; just checking types (rmt:open-main-connection sinfo apath) ;; we need a channel to main.db - (rmt:send-receive sinfo apath ;; params: host port servkey pid ipaddr dbpath + (rmt:send-receive-real sinfo apath ;; params: host port servkey pid ipaddr dbpath (db:run-id->dbname #f) 'register-server `(,iface ,port ,server-key ,(current-process-id) @@ -743,11 +775,11 @@ ,dbname))) (define (rmt:get-count-servers sinfo apath) (servdat-conns sinfo) ;; just checking types (rmt:open-main-connection sinfo apath) ;; we need a channel to main.db - (rmt:send-receive sinfo apath ;; params: host port servkey pid ipaddr dbpath + (rmt:send-receive-real sinfo apath ;; params: host port servkey pid ipaddr dbpath (db:run-id->dbname #f) 'get-count-servers `(,apath))) (define (rmt:get-servers-info apath) (rmt:send-receive 'get-servers-info #f `(,apath)))