#: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
actor-id-hive
actor-id-string
+ actor-am-i-alive?
+
build-actions
define-simple-actor
call-with-message msg-receive msg-val
- ez-run-hive
+ run-hive
bootstrap-message
serialize-message write-message
;; @@: 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 <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.
(define %current-actor
(make-parameter #f))
+(define (actor-am-i-alive? actor)
+ (hive-resolve-local-actor (actor-hive actor) (actor-id actor)))
+
\f
;;; Actor utilities
;;; 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)