Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.70-captain-ulex | v1.70-defunct-try |
Files: | files | file ages | folders |
SHA1: |
0390dc30b4d0dd4e8888e21e0a8df13f |
User & Date: | mrwellan on 2020-01-06 17:06:20 |
Other Links: | branch diff | manifest | tags |
Context
2020-01-06
| ||
22:12 | wip check-in: 7f56278741 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
17:06 | wip check-in: 0390dc30b4 user: mrwellan tags: v1.70-captain-ulex, v1.70-defunct-try | |
2020-01-05
| ||
22:53 | wip check-in: cb68d1b734 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
Changes
Modified Makefile from [a962be5e52] to [9634350b91].
︙ | |||
171 172 173 174 175 176 177 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + + + | mofiles/mtconfigf.o : mtconfigf/mtconfigf.scm mofiles/ulex.o : ulex/ulex.scm mofiles/mutils.o : mutils/mutils.scm mofiles/cookie.o : stml2/cookie.scm mofiles/stml2.o : stml2/stml2.scm # for the modularized stuff |
︙ |
Modified commonmod.scm from [106c49900b] to [50c77be1e6].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 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 | - - | ;;====================================================================== (declare (unit commonmod)) (declare (uses mtargs)) ;; (declare (uses stml2)) (declare (uses mtconfigf)) |
︙ |
Modified megatest.scm from [0c9be227b7] to [00d64b5513].
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - + | ;; (include "megatest-version.scm") ;; fake out readline usage of toplevel-command (define (toplevel-command . a) #f) (use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (prefix base64 base64:) readline apropos json http-client directory-utils typed-records |
︙ |
Modified rmtmod.scm from [5c3bd41b91] to [52418ca14e].
︙ | |||
74 75 76 77 78 79 80 | 74 75 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | - - - - - - - + + + + + + + + + + + + + - - + + + - + - - - - - | ;; 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) |
︙ |
Modified ulex/ulex.scm from [f626150792] to [7b7114168d].
︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | typed-records srfi-69 srfi-1 srfi-4 regex-case (prefix sqlite3 sqlite3:) foreign tcp6 ;; ulex-netutil hostinfo) ;;====================================================================== ;; KEY FUNCTIONS - THESE ARE TOO BE EXPOSED AND USED ;;====================================================================== ;; connection setup and management functions ;; This is the basic setup command. Must always be ;; called before connecting to a db using connect. ;; ;; find or become the captain ;; setup and return a ulex object ;; (define (setup) (let* ((udata (make-udat)) (cpkts (get-all-captain-pkts udata)) ;; read captain pkts (captn (get-winning-pkt cpkts))) (if captn (let* ((port (alist-ref 'port captn)) (host (alist-ref 'host captn)) (ipaddr (alist-ref 'ipaddr captn)) (pid (alist-ref 'pid captn)) (Z (alist-ref 'Z captn))) (udat-captain-address-set! udata ipaddr) (udat-captain-host-set! udata host) (udat-captain-port-set! udata port) (udat-captain-pid-set! udata pid) (if (ping udata ipaddr port) udata (begin (remove-captain-pkt udata captn) (setup)))) (setup-as-captain udata)) ;; this saves the thread to captain-thread and starts the thread )) ;; connect to a specific dbfile (define (connect udata dbfname) udata) (define (ping udata host-port) (let ((cookie (make-cookie udata))) (send udata host-port 'ping "just pinging" (current-seconds)) ;; (mailbox-rec )) ;;====================================================================== ;; network utilities ;;====================================================================== (define (rate-ip ipaddr) (regex-case ipaddr |
︙ | |||
121 122 123 124 125 126 127 128 129 130 131 132 133 134 | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | + + | (serv-listener #f) ;; this processes server info (handler-thread #f) (handlers (make-hash-table)) (outgoing-conns (make-hash-table)) ;; host:port -> conn ;; app info (appname #f) (dbtypes (make-hash-table)) ;; this should be an alist but hash is easier. dbtype => [ initproc syncproc ] ;; cookies (cnum 0) ;; cookie num ) ;; struct for keeping track of others we are talking to (defstruct peer (addr-port #f) (hostname #f) |
︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 180 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | + + + + + + + + + + + + + + + + + + + + | (let ((ad (string->number (alist-ref 'D a))) (bd (string->number (alist-ref 'D b)))) (if (eq? a b) (let ((az (alist-ref 'Z a)) (bz (alist-ref 'Z b))) (string>=? az bz)) (> ad bd)))))))) ;; remove pkt associated with captn (the Z key .pkt) ;; (define (remove-captain-pkt udata captn) (let ((Z (alist-ref 'Z captn)) (cpktdir (udat-cpkts-dir udata))) (delete-file* (conc cpktdir "/" Z ".pkt")))) ;;====================================================================== ;; server primitives ;;====================================================================== (define (make-cookie udata) (let ((newcnum (+ (udat-cnum udata)))) (udat-cnum-set! udata newcnum) (conc (udat-my-address udata) ":" (udat-my-port udata) "-" (udat-my-pid udata) "-" newcnum))) ;; create a tcp listener and return a populated udat struct with ;; my port, address, hostname, pid etc. ;; return #f if fail to find a port to allocate. ;; (define (start-server-find-port udata #!optional (port 4242)) (handle-exceptions |
︙ | |||
248 249 250 251 252 253 254 | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | - - + + + - + + + + + - - - + + + + - + + + + - + + + - - + + - + - + - + - + + + + + + + | npdat)))) pdat)) (define (get-peer-ports udata host-port #!optional (hostname #f)(pid #f)) (let ((pdat (get-peer-dat udata host-port hostname pid))) (values (peer-inp pdat)(peer-oup pdat)))) |
︙ | |||
388 389 390 391 392 393 394 | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | #f)))))) ;; open databases, do initial sync (define (ulexdb-sync dbconndat udata) #f) |
︙ |