27438e5f51a08cc26a520d614c0a538d1351ace4
[8sync.git] / 8sync / debug.scm
1 ;;; 8sync --- Asynchronous programming for Guile
2 ;;; Copyright (C) 2016 Christopher Allan Webber <cwebber@dustycloud.org>
3 ;;;
4 ;;; This file is part of 8sync.
5 ;;;
6 ;;; 8sync is free software: you can redistribute it and/or modify it
7 ;;; under the terms of the GNU Lesser General Public License as
8 ;;; published by the Free Software Foundation, either version 3 of the
9 ;;; License, or (at your option) any later version.
10 ;;;
11 ;;; 8sync is distributed in the hope that it will be useful,
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;;; GNU Lesser General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU Lesser General Public
17 ;;; License along with 8sync.  If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (8sync debug)
20   #:use-module (oop goops)
21   #:use-module (8sync actors)
22   #:export (hive-resolve-local-actor
23             actor-hive
24
25             bootstrap-actor-gimmie
26             bootstrap-actor-gimmie*))
27
28 \f
29 ;;; Expose not normally exposed methods
30 ;;; ===================================
31
32 ;; "private" kind of a misnomer
33 (define-syntax-rule (expose private-var)
34   (define private-var
35     (@@ (8sync actors) private-var)))
36
37 (expose hive-resolve-local-actor)
38 (expose actor-hive)
39
40
41 \f
42 ;;; Some utilities
43 ;;; =============
44
45 (define (bootstrap-actor-gimmie hive actor-class . init)
46   "Create an actor on the hive, and give us that actor.
47 Uses bootstrap-actor* arguments."
48   (let ((actor-id (apply bootstrap-actor hive actor-class init)))
49     (hive-resolve-local-actor hive actor-id)))
50
51 (define (bootstrap-actor-gimmie* hive actor-class id-cookie . init)
52   "Create an actor on the hive, and give us that actor.
53 Uses bootstrap-actor* arguments."
54   (let ((actor-id (apply bootstrap-actor*
55                          hive actor-class id-cookie init)))
56     (hive-resolve-local-actor hive actor-id)))
57
58