24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
;; (include "ulex/ulex.scm")
(module rmtmod
*
(import scheme chicken data-structures extras)
(import (prefix sqlite3 sqlite3:) posix typed-records srfi-18)
(import (prefix ulex ulex:))
(defstruct alldat
(areapath #f)
(ulexdat #f)
)
(define (send-receive cmd rid params #!key (attemptnum 1)(area-dat #f))
(print "Got here.")
(exit))
;; 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)
|
|
|
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
;; (include "ulex/ulex.scm")
(module rmtmod
*
(import scheme chicken data-structures extras)
(import (prefix sqlite3 sqlite3:) posix typed-records srfi-18)
(use tcp6)
(import (prefix ulex ulex:))
(defstruct alldat
(areapath #f)
(ulexdat (ulex:make-udat))
)
;; create-alldat also sets up our tcp server
;;
(define (create-alldat areapath)
(let* ((adat (make-alldat))
(udat (alldat-ulexdat adat)))
(alldat-areapath-set! adat areapath)
(if (not (ulex:start-server-find-port udat (+ 4242 (random 5000))))
(print "Server NOT started properly"))
(thread-start! (make-thread
(lambda ()
(ulex:ulex-handler-loop udat))
"Ulex handler loop thread"))
;; exit handler needed here
adat))
(define (send-receive adat cmd rid params)
(let* ((dbpath (conc (alldat-areapath adat) "/dbs/" (modulo (or rid 0) 1000) ".db")))
(ulex:remote-call (alldat-ulexdat adat) dbpath 'megatest cmd params)))
;; 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)
|