X-Git-Url: https://jxself.org/git/?p=8sync.git;a=blobdiff_plain;f=8sync%2Factors.scm;h=333d779b6d6dea92e66d3f6db53ef1e382204920;hp=2c7381d556457b839e9b23123777f80eeb700313;hb=c769bb3b2c949c304eb4395d3f24eebea6106c1a;hpb=7b3f08078664ba2a09d204fe175b5b80f497b44f diff --git a/8sync/actors.scm b/8sync/actors.scm index 2c7381d..333d779 100644 --- a/8sync/actors.scm +++ b/8sync/actors.scm @@ -25,7 +25,6 @@ #:use-module (ice-9 match) #:use-module (ice-9 pretty-print) #:use-module (8sync agenda) - #:use-module (8sync repl) #:export (;; utilities... ought to go in their own module big-random-number big-random-number-string @@ -48,6 +47,8 @@ actor-id-hive actor-id-string + actor-am-i-alive? + build-actions define-simple-actor @@ -74,7 +75,7 @@ call-with-message msg-receive msg-val - ez-run-hive + run-hive bootstrap-message serialize-message write-message @@ -295,15 +296,13 @@ raise an exception if an error." ;; @@: There's no reason not to use #:class instead of ;; #:each-subclass anywhere in this file, except for ;; Guile bug #25211 (#:class is broken in Guile 2.2) - #:allocation #:each-subclass) + #:allocation #:each-subclass + #:getter actor-message-handler) ;; This is the default, "simple" way to inherit and process messages. (actions #:init-value '() #:allocation #:each-subclass)) -(define-method (actor-message-handler (actor )) - (slot-ref actor 'message-handler)) - ;;; So these are the nicer representations of addresses. ;;; However, they don't serialize so easily with scheme read/write, so we're ;;; using the simpler cons cell version below for now. @@ -349,6 +348,9 @@ raise an exception if an error." (define %current-actor (make-parameter #f)) +(define (actor-am-i-alive? actor) + (hive-resolve-local-actor (actor-hive actor) (actor-id actor))) + ;;; Actor utilities @@ -696,21 +698,11 @@ Like create-actor, but permits supplying an id-cookie." ;;; 8sync bootstrap utilities ;;; ========================= -(define* (ez-run-hive hive initial-tasks #:key repl-server) - "Start up an agenda and run HIVE in it with INITIAL-TASKS. - -Should we start up a cooperative REPL for live hacking? REPL-SERVER -wants to know! You can pass it #t or #f, or if you want to specify a port, -an integer." +(define* (run-hive hive initial-tasks) + "Start up an agenda and run HIVE in it with INITIAL-TASKS." (let* ((queue (list->q initial-tasks)) (agenda (make-agenda #:pre-unwind-handler print-error-and-continue #:queue queue))) - (cond - ;; If repl-server is an integer, we'll use that as the port - ((integer? repl-server) - (spawn-and-queue-repl-server! agenda repl-server)) - (repl-server - (spawn-and-queue-repl-server! agenda))) (start-agenda agenda))) (define (bootstrap-message hive to-id action . message-body-args)