actors: Rename *clean-up* back to *cleanup.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 2 Jan 2017 21:38:23 +0000 (15:38 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 2 Jan 2017 21:38:23 +0000 (15:38 -0600)
By popular intarwebs opinion.

* 8sync/actors.scm (<actor>, <hive>, hive-handle-cleanup-all)
(self-destruct, run-hive): Rename all references of clean-up to cleanup.
(hive-handle-cleanup-all, run-hive-cleanup): Rename name from clean-up
version.
* tests/test-actors.scm: Likewise.

8sync/actors.scm
tests/test-actors.scm

index 2c9870ce26aef93a51655e4206772dd632fce4f3..bf1093ab542d1101328bc83a9449ee49c35fcfde 100644 (file)
@@ -309,8 +309,8 @@ to come after class definition."
 
   ;; This is the default, "simple" way to inherit and process messages.
   (actions #:init-value (build-actions
-                         ;; Default clean-up method is to do nothing.
-                         (*clean-up* (const #f)))
+                         ;; Default cleanup method is to do nothing.
+                         (*cleanup* (const #f)))
            #:allocation #:each-subclass))
 
 ;;; So these are the nicer representations of addresses.
@@ -406,13 +406,13 @@ to come after class definition."
             ;; This is in the case of an ambassador failing to forward a
             ;; message... it reports it back to the hive
             (*failed-forward* hive-handle-failed-forward)
-            (*clean-up-all* hive-handle-clean-up-all))))
+            (*cleanup-all* hive-handle-cleanup-all))))
 
 (define-method (hive-handle-failed-forward (hive <hive>) message)
   "Handle an ambassador failing to forward a message"
   'TODO)
 
-(define-method (hive-handle-clean-up-all (hive <hive>) message)
+(define-method (hive-handle-cleanup-all (hive <hive>) message)
   "Send a message to all actors in our registry to clean themselves up."
   ;; Unfortunately we have to do this hack and run over the list
   ;; twice, because hash-for-each would result in an unrewindable
@@ -421,7 +421,7 @@ to come after class definition."
     (hash-map->list (lambda (actor-id actor) actor-id)
                     (hive-actor-registry hive)))
   (for-each (lambda (actor-id)
-              (<- hive actor-id '*clean-up*))
+              (<- hive actor-id '*cleanup*))
             actor-ids))
 
 (define* (make-hive #:key hive-id)
@@ -707,13 +707,13 @@ Like create-actor, but permits supplying an id-cookie."
                       init id-cookie))
 
 
-(define* (self-destruct actor #:key (clean-up #t))
+(define* (self-destruct actor #:key (cleanup #t))
   "Remove an actor from the hive.
 
-Unless #:clean-up is set to #f, this will first have the actor handle
-its '*clean-up* action handler."
-  (when clean-up
-    (<-wait actor (actor-id actor) '*clean-up*))
+Unless #:cleanup is set to #f, this will first have the actor handle
+its '*cleanup* action handler."
+  (when cleanup
+    (<-wait actor (actor-id actor) '*cleanup*))
   (hash-remove! (hive-actor-registry (actor-hive actor))
                 (actor-id actor)))
 
@@ -723,7 +723,7 @@ its '*clean-up* action handler."
 ;;; =========================
 
 (define* (run-hive hive initial-tasks
-                   #:key (clean-up #t))
+                   #:key (cleanup #t))
   "Start up an agenda and run HIVE in it with INITIAL-TASKS."
   (dynamic-wind
     (const #f)
@@ -732,14 +732,14 @@ its '*clean-up* action handler."
              (agenda (make-agenda #:pre-unwind-handler print-error-and-continue
                                   #:queue queue)))
         (start-agenda agenda)))
-    ;; Run clean-up
+    ;; Run cleanup
     (lambda ()
-      (when clean-up
-        (run-hive-clean-up hive)))))
+      (when cleanup
+        (run-hive-cleanup hive)))))
 
-(define (run-hive-clean-up hive)
+(define (run-hive-cleanup hive)
   (let ((queue (list->q (list (bootstrap-message hive (actor-id hive)
-                                                 '*clean-up-all*)))))
+                                                 '*cleanup-all*)))))
     (start-agenda
      (make-agenda #:queue queue))))
 
index 53dc884b117d5ed487fc3fc604fde92de1d0cd0e..ea0324cd0bed6206be783a4e8755857c16b843b9 100644 (file)
@@ -143,9 +143,9 @@ customer> Whaaaaat?  I can't believe I got voice mail!\n"
 ;;; Cleanup tests
 
 (define-simple-actor <cleanly>
-  (*clean-up* test-call-clean-up))
+  (*cleanup* test-call-cleanup))
 
-(define (test-call-clean-up actor message)
+(define (test-call-cleanup actor message)
   (speak "Hey, I'm cleanin' up here!\n"))
 
 (with-fresh-speaker
@@ -155,29 +155,29 @@ customer> Whaaaaat?  I can't believe I got voice mail!\n"
  (test-equal '("Hey, I'm cleanin' up here!\n")
    (get-spoken)))
 
-;; won't work if we turn off #:clean-up though
+;; won't work if we turn off #:cleanup though
 
 (with-fresh-speaker
  (let ((hive (make-hive)))
    (hive-create-actor hive <cleanly>)
-   (run-hive hive '() #:clean-up #f))
+   (run-hive hive '() #:cleanup #f))
  (test-equal '()
    (get-spoken)))
 
-;; The exploder self-destructs, even though run-hive has clean-up
+;; The exploder self-destructs, even though run-hive has cleanup
 ;; disabled, because it cleans up on self-destruct.
 
 (define-simple-actor <exploder>
   (explode (lambda (exploder message)
              (speak "POOF\n")
              (self-destruct exploder)))
-  (*clean-up* (lambda _ (speak "Cleaning up post-explosion\n"))))
+  (*cleanup* (lambda _ (speak "Cleaning up post-explosion\n"))))
 
 (with-fresh-speaker
  (let ((hive (make-hive)))
    (define exploder (hive-create-actor hive <exploder>))
    (run-hive hive (list (bootstrap-message hive exploder 'explode))
-             #:clean-up #f))
+             #:cleanup #f))
  (get-spoken))