Megatest

Check-in [88ce699176]
Login
Overview
Comment:wip
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80-processes
Files: files | file ages | folders
SHA1: 88ce6991768aefcefc5797f48284ef24469e12b9
User & Date: matt on 2023-10-05 05:24:47
Other Links: branch diff | manifest | tags
Context
2023-10-05
21:16
Added beginnings of purpose finding function check-in: 6f2e80f7e6 user: matt tags: v1.80-processes
05:24
wip check-in: 88ce699176 user: matt tags: v1.80-processes
2023-10-02
19:56
fixed uses in dbfile check-in: 119cfc1040 user: mrwellan tags: v1.80-processes
Changes

Modified dbfile.scm from [b9031adaf7] to [97344cc733].

510
511
512
513
514
515
516
517

518
519
520
521



522
523
524
525






526






527
528
529
530
531
532
533
534
535
536
537
538
539








540
541
542
543
544
545
546
510
511
512
513
514
515
516

517
518



519
520
521
522
523
524
525
526
527
528
529
530
531

532
533
534
535
536
537
538
539
540
541
542








543
544
545
546
547
548
549
550
551
552
553
554
555
556
557







-
+

-
-
-
+
+
+




+
+
+
+
+
+
-
+
+
+
+
+
+





-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+







			)))
    (if on-tmp	      ;; done in cautious-open-database
	(begin
	  (sqlite3:execute db "PRAGMA synchronous = 0;")
	  (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000))))
    db))

;; processes table calls
;; mtest processes registry calls

(define (dbfile:insert-or-update-process nsdb pinfdat)
  (let* ((host  (pinf-host pinfdat))
	 (pid   (pinf-pid  pinfdat))
(define (dbfile:insert-or-update-process nsdb dat)
  (let* ((host  (pinf-host dat))
	 (pid   (pinf-pid  dat))
	 (curr-info (dbfile:get-process-info nsdb host pid)))
    (if curr-info ;; record exists, do update
	(match curr-info
	  ((host port pid starttime status purpose dbname mtversion)
	   (sqlite3:execute
	    nsdb
	    "UPDATE processes SET port=?,starttime=?,status=?,
                                  purpose=?,dbname=?,mtversion=?
              WHERE host=? AND pid=?;"
	    (or (pinf-port      dat) port)
	   (dbfile:register-process nsdb host port pid starttime status purpose dbname mtversion))
	    (or (pinf-start     dat) starttime)
	    (or (pinf-status    dat) status)
	    (or (pinf-purpose   dat) purpose)
	    (or (pinf-dbname    dat) dbname)
	    (or (pinf-mtversion dat) mtversion)
	    host pid))
	  (else
	   #f ;; what to do?
	   ))
	(dbfile:register-process
	 nsdb
	 (pinf-host      pinfdat)
	 (pinf-port      pinfdat)
	 (pinf-pid       pinfdat)
	 (pinf-start     pinfdat)
	 (pinf-status    pinfdat)
	 (pinf-purpose   pinfdat)
	 (pinf-dbname    pinfdat)
	 (pinf-mtversion pinfdat)))))
	 (pinf-host      dat)
	 (pinf-port      dat)
	 (pinf-pid       dat)
	 (pinf-start     dat)
	 (pinf-status    dat)
	 (pinf-purpose   dat)
	 (pinf-dbname    dat)
	 (pinf-mtversion dat)))))
	  

(define (dbfile:register-process nsdb host port pid starttime status purpose dbname mtversion)
  (sqlite3:execute nsdb "INSERT INTO processes (host,port,pid,starttime,status,purpose,dbname,mtversion) VALUES (?,?,?,?,?,?,?,?);"
		   host port pid starttime status purpose dbname mtversion))

(define (dbfile:set-process-status nsdb host pid newstatus)