76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
;; state: 'live, 'shutting-down, 'dead
(define (tasks:server-register mdb pid hostname port priority state)
(sqlite3:execute
mdb
"INSERT OR REPLACE INTO servers (pid,hostname,port,start_time,priority,state) VALUES(?,?,?,strftime('%s','now'),?,?);"
pid hostname port priority (conc state)))
(define (tasks:server-deregister mdb hostname #!key (port #f)(pid #f))
(debug:print-info 11 "server-deregister " hostname ", port " port ", pid " pid)
(if pid
(sqlite3:execute mdb "DELETE FROM servers WHERE hostname=? AND pid=?;" hostname pid)
(if port
(sqlite3:execute mdb "DELETE FROM servers WHERE hostname=? AND port=?;" hostname port)
(debug:print 0 "ERROR: tasks:server-deregister called with neither pid nor port specified"))))
(define (tasks:server-deregister-self mdb)
(tasks:server-deregister mdb (get-host-name) pid: (current-process-id)))
(define (tasks:server-get-server-id mdb)
;; dunno yet
0)
(define (tasks:client-register mdb pid hostname cmdline)
(sqlite3:execute
|
>
|
|
|
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
;; state: 'live, 'shutting-down, 'dead
(define (tasks:server-register mdb pid hostname port priority state)
(sqlite3:execute
mdb
"INSERT OR REPLACE INTO servers (pid,hostname,port,start_time,priority,state) VALUES(?,?,?,strftime('%s','now'),?,?);"
pid hostname port priority (conc state)))
;; NB// two servers with same pid on different hosts will be removed from the list if pid: is used!
(define (tasks:server-deregister mdb hostname #!key (port #f)(pid #f))
(debug:print-info 11 "server-deregister " hostname ", port " port ", pid " pid)
(if pid
(sqlite3:execute mdb "DELETE FROM servers WHERE pid=?;" pid)
(if port
(sqlite3:execute mdb "DELETE FROM servers WHERE hostname=? AND port=?;" hostname port)
(debug:print 0 "ERROR: tasks:server-deregister called with neither pid nor port specified"))))
(define (tasks:server-deregister-self mdb hostname)
(tasks:server-deregister mdb hostname pid: (current-process-id)))
(define (tasks:server-get-server-id mdb)
;; dunno yet
0)
(define (tasks:client-register mdb pid hostname cmdline)
(sqlite3:execute
|