actors: Add debug module with useful utilities. wip-actors
authorChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 26 Apr 2016 18:30:11 +0000 (13:30 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 26 Apr 2016 18:30:11 +0000 (13:30 -0500)
* 8sync/systems/actors/debug.scm: New file.
* Makefile.am (SOURCES): Add it.

8sync/systems/actors/debug.scm [new file with mode: 0644]
Makefile.am

diff --git a/8sync/systems/actors/debug.scm b/8sync/systems/actors/debug.scm
new file mode 100644 (file)
index 0000000..61baf0c
--- /dev/null
@@ -0,0 +1,38 @@
+;;; 8sync --- Asynchronous programming for Guile
+;;; Copyright (C) 2016 Christopher Allan Webber <cwebber@dustycloud.org>
+;;;
+;;; This file is part of 8sync.
+;;;
+;;; 8sync is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; 8sync is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with 8sync.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (8sync systems actors debug)
+  #:use-module (oop goops)
+  #:use-module (8sync systems actors)
+  #:export (hive-resolve-local-actor
+            hive-create-actor-gimmie))
+
+(define hive-resolve-local-actor
+  (@@ (8sync systems actors) hive-resolve-local-actor))
+
+(define (hive-create-actor-gimmie . args)
+  "Create an actor on the hive, and give us that actor.
+Uses hive-create-actor* arguments."
+  (let ((actor-id (apply hive-create-actor args)))
+    (hive-resolve-local-actor hive actor-id)))
+
+(define-syntax-rule (hive-create-actor-gimmie* args ...)
+  "Create an actor on the hive, and give us that actor.
+Uses hive-create-actor* arguments."
+  (let ((actor-id (hive-create-actor* args ...)))
+    (hive-resolve-local-actor hive actor-id)))
index 51849a32768b47c41279b60b883a37551f4f98cf..552b62b22a494556c3e7c89fdf4fddcb8d11d26b 100644 (file)
@@ -49,7 +49,8 @@ SOURCES =  \
        8sync/repl.scm \
        8sync/systems/irc.scm \
        8sync/systems/web.scm \
-       8sync/systems/actors.scm
+       8sync/systems/actors.scm \
+       8sync/systems/actors/debug.scm
 
 TESTS =                                                        \
        tests/test-agenda.scm                           \