8sync.git
22 months agoactors: Reflect removal of choice of whether to cleanup in self-destruct fibers
Christopher Allan Webber [Wed, 1 Nov 2017 19:04:17 +0000 (14:04 -0500)]
actors: Reflect removal of choice of whether to cleanup in self-destruct

* 8sync/actors.scm (self-destruct): The option of whether or not to
all cleanup on an actor was removed; reflect that in arguments and
documentation.

22 months agoweb: Various updates to web-server-client-loop
Christopher Allan Webber [Wed, 1 Nov 2017 18:57:03 +0000 (13:57 -0500)]
web: Various updates to web-server-client-loop

* 8sync/systems/web.scm (web-server-client-loop): More carefully
scoped catch, more verbose exceptions, and wrap handlers with
false-if-exception.

22 months agowebsocket: Fix use of with-actor-nonblocking-ports
Christopher Allan Webber [Wed, 1 Nov 2017 17:52:20 +0000 (12:52 -0500)]
websocket: Fix use of with-actor-nonblocking-ports

* 8sync/systems/websocket/server.scm (websocket-client-loop):
Accidentally did not wrap body in a lambda.

22 months agoactors: Have actors attach class name as cookie to actor address by default.
Christopher Allan Webber [Wed, 1 Nov 2017 00:59:21 +0000 (19:59 -0500)]
actors: Have actors attach class name as cookie to actor address by default.

* 8sync/actors.scm (*debug-actor-ids*): New parameter.
(create-actor): If `*debug-actor-ids*' is #t, add class name as cookie
to actor address.

22 months agoactors: Make addresses into a srfi-9 record.
Christopher Allan Webber [Wed, 1 Nov 2017 00:53:52 +0000 (19:53 -0500)]
actors: Make addresses into a srfi-9 record.

* 8sync/actors.scm (<address>, address-equal?): New record type and printer.
(%<-, make-address, address?, address-actor-id, address-hive-id)
(address-channel, address-dead?): Adjust to use <address> record structure.

22 months agowebsocket: Ping client occasionally to prevent timeoiuts.
Christopher Allan Webber [Thu, 26 Oct 2017 03:16:37 +0000 (22:16 -0500)]
websocket: Ping client occasionally to prevent timeoiuts.

Technically we aren't observing currently whether or not we get a
pong.

* 8sync/systems/websocket/server.scm (websocket-client-loop)
(websocket-server-send): Occasionally ping client ot prevent timeouts.

22 months agoactors: Fix handling errors on resuming.
Christopher Allan Webber [Tue, 24 Oct 2017 21:51:11 +0000 (16:51 -0500)]
actors: Fix handling errors on resuming.

* 8sync/actors.scm (<-wait): Look at the correct action on the message
when checking for error when resuming.

2 years agoguix.scm: Update commit of guile-fibers-git.
Christopher Allan Webber [Mon, 14 Aug 2017 14:56:46 +0000 (09:56 -0500)]
guix.scm: Update commit of guile-fibers-git.

* guix.scm: Update commit of guile-fibers-git.

2 years agorepl: Add spawn-repl, a simpler cooperative repl interface using spawn-fiber.
Christopher Allan Webber [Sat, 12 Aug 2017 15:21:53 +0000 (10:21 -0500)]
repl: Add spawn-repl, a simpler cooperative repl interface using spawn-fiber.

Keeping around the old actor for now because it's displaying
memory leak problems, and I want to figure out what those are.

* 8sync/repl.scm (spawn-repl): New variable.

2 years agoRemove stray `pk' from web.scm.
Christopher Allan Webber [Fri, 11 Aug 2017 20:44:28 +0000 (15:44 -0500)]
Remove stray `pk' from web.scm.

* 8sync/systems/web.scm (web-server-socket-loop): Remove stray `pk'.

2 years agoFix unnecessary conditional check.
Christopher Allan Webber [Thu, 10 Aug 2017 22:00:26 +0000 (17:00 -0500)]
Fix unnecessary conditional check.

* 8sync/actors.scm (actor-main-loop): Remove accidental double-when.

2 years agoAllow sending messages to put to-actor as an actual actor instance.
Christopher Allan Webber [Thu, 10 Aug 2017 21:56:43 +0000 (16:56 -0500)]
Allow sending messages to put to-actor as an actual actor instance.

This reduces a common error and also allows for cleaner code when an
actor wants to send a message to itself.

* 8sync/actors.scm (%<-): Allow sending messages to put to-actor as an
actual actor instance.

2 years agoRemove actor-alive?.
Christopher Allan Webber [Wed, 9 Aug 2017 17:40:30 +0000 (12:40 -0500)]
Remove actor-alive?.

`actor-alive?' was actully returning the boolean opposite of what it
should have.  It turns out we don't need it anyway, so removed.

* 8sync/actors.scm (condition-signalled?, actor-alive?): Removed.
* 8sync/repl.scm (repl-manager-main-loop): Just loop on #t, since
daydream won't resume anyway if our actor dies.

2 years agoExport *current-actor*.
Christopher Allan Webber [Wed, 9 Aug 2017 15:09:57 +0000 (10:09 -0500)]
Export *current-actor*.

* 8sync/actors.scm: Export *current-actor*.

2 years agoRename wrap -> live-wrap and use in websocket server module.
Christopher Allan Webber [Tue, 8 Aug 2017 20:43:14 +0000 (15:43 -0500)]
Rename wrap -> live-wrap and use in websocket server module.

* 8sync/actors.scm (live-wrap): Rename from `wrap' for clarity.
(build-actions): Update call to `live-wrap'.
* 8sync/systems/websocket/server.scm (<websocket-server>):
Re-wrap `websocket-client-loop' in `upgrade-paths' slot, now with
`live-wrap'.

2 years agoactors.scm: Rename `wrap-apply' to `wrap' and export.
Christopher Allan Webber [Tue, 8 Aug 2017 20:31:18 +0000 (15:31 -0500)]
actors.scm: Rename `wrap-apply' to `wrap' and export.

* 8sync/actors.scm (wrap): Renamed from wrap-apply and exported.
(build-actions): Update call to `wrap'.

2 years agoRemove the wrap-apply surrounding websocket-client-loop in <websocket-server>
Christopher Allan Webber [Tue, 8 Aug 2017 20:26:15 +0000 (15:26 -0500)]
Remove the wrap-apply surrounding websocket-client-loop in <websocket-server>

* 8sync/systems/websocket/server.scm (<websocket-server>):
Remove the wrap-apply surrounding websocket-client-loop in <websocket-server>'s
upgrade-paths slot.

2 years agoirc: Remove import of (8sync agenda) module.
Christopher Allan Webber [Tue, 8 Aug 2017 20:09:04 +0000 (15:09 -0500)]
irc: Remove import of (8sync agenda) module.

* 8sync/systems/irc.scm: Remove import of (8sync agenda) module.

2 years ago8sync.scm: Remove agenda from %public-modules.
Christopher Allan Webber [Tue, 8 Aug 2017 19:54:04 +0000 (14:54 -0500)]
8sync.scm: Remove agenda from %public-modules.

* 8sync.scm: Remove agenda from %public-modules.

2 years agoUpdated actors unit tests.
Christopher Allan Webber [Tue, 8 Aug 2017 19:45:52 +0000 (14:45 -0500)]
Updated actors unit tests.

Significantly cut down... we'll have to repopulate it.

* tests/test-actors.scm: Removed old unit tests and added a new one.

2 years agoUpdate actor io behavior to not break on new fibers/scheduling system.
Christopher Allan Webber [Tue, 8 Aug 2017 18:45:39 +0000 (13:45 -0500)]
Update actor io behavior to not break on new fibers/scheduling system.

* 8sync/actors.scm (%suspend-io-to-actor, suspend-read-to-actor)
(suspend-write-to-actor): Update to be a bit more agnostic about the
underlying scheduling system now... instead, we simply spawn a fiber
and use the underlying wait-for-readable/wait-for-writeable mechanisms.

2 years agoguix.scm: Add git checkout of guile-fibers.
Christopher Allan Webber [Tue, 8 Aug 2017 18:40:28 +0000 (13:40 -0500)]
guix.scm: Add git checkout of guile-fibers.

* guix.scm: Add git checkout of guile-fibers.

2 years agoRemove deprecated files and clean up files in Makefile.am.
Christopher Allan Webber [Fri, 4 Aug 2017 16:15:56 +0000 (11:15 -0500)]
Remove deprecated files and clean up files in Makefile.am.

* Makefile.am (SOURCES, TESTS): Re-enable modules which are used and
remove those which have been removed.
* 8sync/agenda.scm:
* 8sync/debug.scm:
* tests/test-agenda.scm: Deleted files.

2 years agoUpdate web, websocket servers for recent actor changes.
Christopher Allan Webber [Thu, 3 Aug 2017 15:29:39 +0000 (10:29 -0500)]
Update web, websocket servers for recent actor changes.

* 8sync/systems/web.scm (<web-server>): Remove *init* and *cleanup*
action handlers.
(actor-init!, actor-cleanup!): Add method definitions for <web-server>.
(web-server-socket-loop, web-server-client-loop): Use
with-actor-nonblocking-ports.
(web-server-client-loop): Removed.
* 8sync/systems/websocket/server.scm (websocket-client-loop)
(websocket-server-send): Wrap I/O behavior in with-actor-nonblocking-ports.

2 years agoUpdate users of bootstrap-actor -> create-actor, and update arguments.
Christopher Allan Webber [Thu, 3 Aug 2017 15:27:18 +0000 (10:27 -0500)]
Update users of bootstrap-actor -> create-actor, and update arguments.

* 8sync/daydream.scm (daydream):
* demos/ircbot.scm (run-bot):
* tests/test-actors.scm: Update users of bootstrap-actor ->
create-actor, and update arguments.

2 years agoFix resuming from actor-suspended io.
Christopher Allan Webber [Thu, 3 Aug 2017 15:10:33 +0000 (10:10 -0500)]
Fix resuming from actor-suspended io.

* 8sync/actors.scm (actor-main-loop): Fix resuming from
actor-suspended io by wrapping the resumed io in a prompt handler.

2 years agoUpdate reference to hive to be dynamic state, simplify create-actor.
Christopher Allan Webber [Tue, 1 Aug 2017 16:30:38 +0000 (11:30 -0500)]
Update reference to hive to be dynamic state, simplify create-actor.

This also eliminates bootstrap-actor.

* 8sync/actors.scm (<actor>, actor-hive-channel): Removed hive-channel
slot from <actor>.
(*hive-id*, *hive-channel*): New variables.
(spawn-hive): Update to parameterize *hive-id* and *hive-channel*.
(%create-actor): No longer take hive-channel and hive-id as arguments.
(bootstrap-actor, bootstrap-actor*): Removed since these are now
unified with create-actor.
(create-actor, create-actor*): Updated to remove argument of
from-actor and update argument calls to %create-actor.
(self-destruct): Use *hive-channel* parameter.
* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm: Update calls to create-actor and
remove bootstrap-actor references.

2 years agoAdd TODO to inbox for adding backpressure.
Christopher Allan Webber [Tue, 1 Aug 2017 16:23:36 +0000 (11:23 -0500)]
Add TODO to inbox for adding backpressure.

* 8sync/inbox.scm: Add TODO Comment.

2 years agoRemove spawn-inbox.
Christopher Allan Webber [Tue, 1 Aug 2017 16:21:44 +0000 (11:21 -0500)]
Remove spawn-inbox.

* 8sync/inbox.scm (spawn-inbox): Removed.

2 years agoUse `with-actor-nonblocking-ports' in irc.scm.
Christopher Allan Webber [Mon, 31 Jul 2017 22:31:28 +0000 (17:31 -0500)]
Use `with-actor-nonblocking-ports' in irc.scm.

* 8sync/systems/irc.scm (irc-bot-main-loop): Use
`with-actor-nonblocking-ports'.

2 years agoAdd with-actor-nonblocking-ports and related tooling.
Christopher Allan Webber [Mon, 31 Jul 2017 21:14:16 +0000 (16:14 -0500)]
Add with-actor-nonblocking-ports and related tooling.

This permits actors to not block their handling of correspondence on
I/O by handling the suspendable-ports functionality themselves rather
than through the normal fibers route.  This is useful for actors that
might be needing to exclusively control a port

* 8sync/actors.scm (<-wait): Add '<-wait symbol to arguments of
aborting to the prompt to distinguish it from the 'run-me action.
(actor-main-loop): Support handling suspendable ports on actor level
to support correspondence during I/O.
(%suspend-io-to-actor, suspend-read-to-actor, suspend-write-to-actor)
(with-actor-nonblocking-ports, actor-spawn-fiber)
(*resume-io-channel*): New variables.

2 years agoRemove (8sync agenda) as an import from actors.scm and add wrap-apply.
Christopher Allan Webber [Mon, 31 Jul 2017 17:04:15 +0000 (12:04 -0500)]
Remove (8sync agenda) as an import from actors.scm and add wrap-apply.

* 8sync/actors.scm: Remove (8sync agenda) as an import.
(wrap-apply): Added, ported from agenda.scm, and which is necessary
for actors.scm to function without it.

2 years agoIrcbot WIP.
Christopher Allan Webber [Mon, 31 Jul 2017 16:58:13 +0000 (11:58 -0500)]
Ircbot WIP.

* demos/ircbot.scm (run-bot): Updated to use new 8sync-fibers
semantics.

2 years agoAdd 8syncfibers'ified REPL.
Christopher Allan Webber [Mon, 31 Jul 2017 16:57:56 +0000 (11:57 -0500)]
Add 8syncfibers'ified REPL.

* 8sync/repl.scm (<repl-manager>): Remove `*cleanup*' and `*init*'
actions.
(actor-cleanup!, actor-init!): Method handlers for `<repl-manager>',
converted from previous `repl-manager-cleanup' and `repl-manager-init'
procedures.
(repl-manager-main-loop): New procedure, borrowing from
`repl-manager-init'.

2 years agoCleaning up exports.
Christopher Allan Webber [Mon, 31 Jul 2017 16:54:12 +0000 (11:54 -0500)]
Cleaning up exports.

* 8sync/actors.scm: Clean up exports.

2 years agoAdd daydream.scm and re-enable some files in Makefile.am.
Christopher Allan Webber [Mon, 31 Jul 2017 15:56:35 +0000 (10:56 -0500)]
Add daydream.scm and re-enable some files in Makefile.am.

* 8sync/daydream.scm: New file.
* Makefile.am (SOURCES): Adjust for modules which currently do compile.

2 years agoBig refactor for 8sync on fibers in progress.
Christopher Allan Webber [Fri, 14 Jul 2017 19:36:16 +0000 (14:36 -0500)]
Big refactor for 8sync on fibers in progress.

* 8sync/actors.scm (%random-state, *random-state*, big-random-number):
Removed %random-state in favor of mutating *random-state* variable.
(<message>, make-message): Remove replied slot from <message>.
(message-auto-reply?, message-needs-reply?): Removed.
(%<-, <-, <-wait): Update to make use of new inbox channels.  These
are now the only two message-sending operators.
(send-message, <-*, <-wait*, <-reply, <-auto-reply, <-reply-wait)
(wait-maybe-handle-errors): Removed.  The <-reply mechanisms in
particular are no longer necessary since the returned values of the
called procedure are automatically the return value's reply.
(<actor>): Actors no longer have access to the hive itself, and
instead have access to the hive's channel through the new
`hive-channel' slot.
Actors also generate their own message ids through their
`msg-id-generator' slot, since the hive is no longer responsible
for generating these messages.
Likewise, actors no longer communicate to other actors through the
hive (though relays/ambassadors will be coordinated through there).
Instead, addresses now contain the actor's channel and stop-condition,
unless the actor is remote, in which case a relay will be looked up
via the hive (well, eventually).
New slot named `inbox-deq' which is what the actor's main loop
actually reads from to get messages from the delivery-agent.
The `*init*' and `*cleanup*' actions have been removed.
(actor-init!, actor-cleanup!): New methods; these are how actors may
initialize and clean themselves up, taking the place of the previous
special-case `*init*' and `*cleanup*' actions.
(make-address): Update to support `channel' and `dead?' slots.
(address-channel, address-dead?): New getters.
(address-equal?): New procedure for comparing two addresses.
(actor-id-actor, actor-id-hive, actor-id-string): Move from being
methods to normal procedures.
(*current-actor*): Renamed from %current-actor.
(actor-inbox-enq, *actor-prompt*, actor-main-loop): New variables.
(hive-handle-failed-forward): Removed.
(<hive>): No longer a subtype of <actor> since this runs in its
own loop.  Removed several slots and added the `id', `channel', and
`halt?' slots.
(make-hive): Updated to reflect new design.
(hive-handle-init-all, hive-handle-failed-forward, hive-handle-cleanup-all)
(hive-id, hive-gen-actor-id, hive-gen-message-id, hive-resolve-local-actor)
(hive-resolve-ambassador, make-forward-request, hive-reply-with-error)
(<waiting-on-reply>, hive-process-message, hive-actor-local?)
(hive-register-actor!, %hive-create-actor): Removed.
(gen-actor-id, hive-main-loop, *current-hive*, spawn-hive, run-hive)
(%create-actor, condition-signalled?, actor-alive?): New variables.
(bootstrap-actor, bootstrap-actor*, create-actor, create-actor*):
Updated to use %create-actor.
(call-with-message, mbody-receive, mbody-val): Removed.
(self-destruct): Updated behavior to signal `address-dead?' condition
and message the hive via the hive-channel, along with running
`actor-cleanup!'.
(run-hive, run-hive-cleanup, bootstrap-message, serialize-message)
(write-message, serialize-message-pretty, pprint-message, read-message):
(read-message-from-string): Removed.

* 8sync/inbox.scm: New file.  Provides the delivery-agent procedure
which is run in its own fiber as a buffered queue.

* 8sync/systems/irc.scm (<irc-bot>): Remove `*init*' and `*cleanup*'
action handlers.
(actor-init!, actor-cleanup!): Add method handlers for `<irc-bot>'
based off of former `irc-bot-init' and `irc-bot-cleanup' respectively.

* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm: Update to use new semantics.

* Makefile.am (SOURCES): Comment out a bunch of modules which aren't
ready to be built with WIP 8sync-fibers branch.  Also add inbox.scm.

* guix.scm: Add `guile-fibers' to `propagated-inputs' and switch
guile reference from `guile-next' to `guile-2.2' package variable.

2 years ago8sync 0.4.2 v0.4.2
Christopher Allan Webber [Sat, 18 Mar 2017 05:54:27 +0000 (00:54 -0500)]
8sync 0.4.2

2 years agoAdd NEWS for 8sync 0.4.2
Christopher Allan Webber [Sat, 18 Mar 2017 05:07:58 +0000 (00:07 -0500)]
Add NEWS for 8sync 0.4.2

2 years agobuild: guix.scm: Use git-predicate procedure from Guix proper.
Christopher Allan Webber [Tue, 14 Feb 2017 20:16:37 +0000 (14:16 -0600)]
build: guix.scm: Use git-predicate procedure from Guix proper.

* guix.scm: Use git-predicate procedure from Guix to define source.

2 years agoweb: Remove web-deprecated.scm.
Christopher Allan Webber [Thu, 9 Feb 2017 21:28:22 +0000 (15:28 -0600)]
web: Remove web-deprecated.scm.

* 8sync/systems/web-deprecated.scm: Removed file.

2 years agowebsocket: Preventing some eof-object related errors.
Christopher Allan Webber [Thu, 9 Feb 2017 20:44:05 +0000 (14:44 -0600)]
websocket: Preventing some eof-object related errors.

* 8sync/systems/websocket/server.scm (websocket-client-loop):
Prevent some errors where eof-objects appear as the frame by
the time we hit the cond.

2 years agoactors: Avoid building up stack of error handlers when resuming coroutines.
Christopher Allan Webber [Mon, 30 Jan 2017 05:10:13 +0000 (23:10 -0600)]
actors: Avoid building up stack of error handlers when resuming coroutines.

However it's not clear that we're not still building up a stack of
prompts. :\

* 8sync/actors.scm (hive-process-message): Avoid building up stack of
error handlers when resuming coroutines.

2 years agoagenda: Always set sec/usec to exact time.
Christopher Allan Webber [Mon, 30 Jan 2017 05:08:22 +0000 (23:08 -0600)]
agenda: Always set sec/usec to exact time.

* 8sync/agenda.scm (delayed-time): Always set sec/usec to exact time.

2 years agormeta-slot: Rename wrap-rmeta-slot to build-rmeta-slot.
Christopher Allan Webber [Sun, 29 Jan 2017 22:14:56 +0000 (16:14 -0600)]
rmeta-slot: Rename wrap-rmeta-slot to build-rmeta-slot.

* 8sync/rmeta-slot.scm (build-rmeta-slot): Renamed from wrap-rmeta-slot.
(make-rmeta-slot): Removed.
* 8sync/actors.scm (build-actions): Update caller to build-rmeta-slot.
* tests/test-rmeta-slot.scm: Update tests.

2 years agoactors: Switch over to using wrap-rmeta-slot for build-actions.
Christopher Allan Webber [Wed, 25 Jan 2017 17:42:20 +0000 (11:42 -0600)]
actors: Switch over to using wrap-rmeta-slot for build-actions.

* 8sync/rmeta-slot.scm (wrap-rmeta-slot): New variable.

* 8sync/actors.scm (build-actions): Switch from using make-rmeta-slot
to using wrap-rmeta-slot.

* doc/8sync.texi (Writing our own actors): Update documentation
to use #:init-thunk.

* 8sync/actors.scm (<actor>, define-actor, <hive>):
* 8sync/systems/irc.scm (<irc-bot>):
* demos/actors/robotscanner.scm (<warehouse-room>, <droid>):
* tests/test-actors.scm (<hi-on-init>):
* tests/test-rmeta-slot.scm (<kah-lassy>, <sub-lassy>): Update to
use #:init-thunk instead of #:init-value on actions slot.

2 years agoactors: Use rmeta-slot for actions dispatch.
Christopher Allan Webber [Wed, 25 Jan 2017 00:06:58 +0000 (18:06 -0600)]
actors: Use rmeta-slot for actions dispatch.

* 8sync/actors.scm (actor-inheritable-message-handler, build-actions):
Use rmeta-slot tooling for action dispatch.

2 years agormeta-slot: Make equal? type hash table access the default.
Christopher Allan Webber [Tue, 24 Jan 2017 23:41:16 +0000 (17:41 -0600)]
rmeta-slot: Make equal? type hash table access the default.

This is the more general case, so we may as well.

* 8sync/rmeta-slot.scm (class-rmeta-ref): Set #:equals?, #:cache-set!,
and #:cache-ref all to equal? type access rather than eq? by default.

2 years agormeta-slot: New module for recursive meta-slot access.
Christopher Allan Webber [Tue, 24 Jan 2017 23:27:14 +0000 (17:27 -0600)]
rmeta-slot: New module for recursive meta-slot access.

This is an abstraction around the core idea driving the actor actions
system.  It turns out I need this abstraction for mudsync as well, so
I'm breaking it out.  Pleasantly, it should be much faster now, since
a cache is built for each class regarding what key should resolve to
what value.

* 8sync/rmeta-slot.scm:
* tests/test-rmeta-slot.scm: New modules.
* Makefile.am: Add them.

2 years agowebsocket: Adding myself to server copyright lines.
Christopher Allan Webber [Tue, 24 Jan 2017 17:19:57 +0000 (11:19 -0600)]
websocket: Adding myself to server copyright lines.

* 8sync/systems/websocket/server.scm: Adjust copyright lines.

2 years agowebsockets: Initial websocket support.
Christopher Allan Webber [Sun, 15 Jan 2017 00:24:34 +0000 (18:24 -0600)]
websockets: Initial websocket support.

* 8sync/contrib/base64.scm:
* 8sync/contrib/sha-1.scm:
* 8sync/ports.scm:
* 8sync/systems/websocket.scm:
* 8sync/systems/websocket/client.scm:
* 8sync/systems/websocket/frame.scm:
* 8sync/systems/websocket/server.scm:
* 8sync/systems/websocket/utils.scm: New files.

* Makefile.am (SOURCES): Add them.

* 8sync/systems/web.scm (<web-server>): Rename upgrade slot to
upgrade-paths and use it.
(.upgrade-paths, maybe-upgrade-request): New variables.
(web-server-client-loop): Upgrade protocol if appropriate.

2 years agoactors: Allow actors to specify whether to handle an *init* action.
Christopher Allan Webber [Sat, 21 Jan 2017 06:53:48 +0000 (00:53 -0600)]
actors: Allow actors to specify whether to handle an *init* action.

* 8sync/actors.scm (<actor>): New should-init slot.
(hive-handle-init-all, %hive-create-actor): Respect 'should-init slot.

2 years agoactors: Don't reply to a message when the messsage doesn't need a reply.
Christopher Allan Webber [Fri, 20 Jan 2017 23:58:20 +0000 (17:58 -0600)]
actors: Don't reply to a message when the messsage doesn't need a reply.

* 8sync/actors.scm (<-reply, <-reply*, <-reply-wait, <-reply-wait*):
Only reply to messages if they're waiting on a reply still.
This avoids the challenges of actors never having requested a
reply in the first place resulting in trying to resume a waiting
coroutine that doesn't exist, as well as maybe the bonus one of not
replying multiple times to a message.

2 years agorepl: Publish notification about repl updates to subscribers.
Christopher Allan Webber [Thu, 19 Jan 2017 17:10:08 +0000 (11:10 -0600)]
repl: Publish notification about repl updates to subscribers.

* 8sync/repl.scm (<repl-manager>): Convert to use define-class.
Switch all getters accessors from `repl-manager-' prefix to
dot-prefix.
Add subscribers slot.
Add action handlers for add-subscriber and remove-subscriber.
(repl-manager-cleanup, repl-manager-init): Use dot-prefix
getters/accessors.
(repl-manager-init): Update to inform subscribers after every time
we poll the REPL.
(repl-manager-add-subscriber, repl-manager-remove-subscriber): New
procedures.

2 years agoweb: Rename getters / accessors to use dot prefix.
Christopher Allan Webber [Sun, 15 Jan 2017 15:29:16 +0000 (09:29 -0600)]
web: Rename getters / accessors to use dot prefix.

* 8sync/systems/web.scm (<web-server>, .host, .family, .port-num)
(.addr, .socket, .http-handler): Rename getters/accessors from
web-server- prefix to dot prefix.
(web-server-socket-loop, web-server-handle-request, web-server-cleanup):
Update callers.

2 years agoweb: Rename handler slot to http-handler.
Christopher Allan Webber [Sun, 15 Jan 2017 15:26:27 +0000 (09:26 -0600)]
web: Rename handler slot to http-handler.

* 8sync/systems/web.scm (<web-server>, web-server-handle-request):
Rename handler slot to http-handler.

2 years agoAdd define-method-star.
Christopher Allan Webber [Wed, 11 Jan 2017 17:09:01 +0000 (11:09 -0600)]
Add define-method-star.

* 8sync/systems/define-method-star.scm: New file.

2 years agoUpdate copyrights.
Christopher Allan Webber [Wed, 11 Jan 2017 17:02:34 +0000 (11:02 -0600)]
Update copyrights.

* 8sync/actors.scm:
* 8sync/agenda.scm:
* 8sync/debug.scm:
* 8sync/repl.scm:
* 8sync/systems/irc.scm:
* 8sync/systems/web.scm:
* Makefile.am:
* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* demos/ircbot.scm: Update copyright lines.

2 years agoweb: New actorified version of the web server.
Christopher Allan Webber [Wed, 11 Jan 2017 16:54:14 +0000 (10:54 -0600)]
web: New actorified version of the web server.

* 8sync/systems/web.scm: New file.

2 years agoactors: Update comments on addresses.
Christopher Allan Webber [Mon, 9 Jan 2017 17:17:38 +0000 (11:17 -0600)]
actors: Update comments on addresses.

* 8sync/actors.scm: Updated comments on addresses.

2 years agobuild: Releasing 8sync 0.4.1. v0.4.1
Christopher Allan Webber [Sun, 8 Jan 2017 21:27:32 +0000 (15:27 -0600)]
build: Releasing 8sync 0.4.1.

* configure.ac: Bumping verison number to 0.4.1.

2 years agobuild: Fix install targets to point to Guile 2.2 instead of 2.0.
Christopher Allan Webber [Sun, 8 Jan 2017 21:26:43 +0000 (15:26 -0600)]
build: Fix install targets to point to Guile 2.2 instead of 2.0.

* Makefile.am (modir, godir): Fix install targets to point to Guile 2.2
instead of 2.0.

2 years agopackaging: Updating guix.scm to GPLv3+, setting source to checkout.
Christopher Allan Webber [Sun, 8 Jan 2017 20:08:17 +0000 (14:08 -0600)]
packaging: Updating guix.scm to GPLv3+, setting source to checkout.

I talked to Jan Nieuwenhuizen, who agreed to license their
contributions to this file under GPLv3+, simplifying the licensing.
The rest of 8sync is still LGPLv3+... this just applies to the Guix
packaging.  We also borrow some code from guile-sdl2 to set our source
to be from the package itself, making testing the package from
guix.scm easier.

* guix.scm: Switch license to GPLv3+.
Switch source to be from the local directory, borrowed from
guile-sdl2.

2 years agobuild: Releasing version 0.4.0. v0.4.0
Christopher Allan Webber [Sun, 8 Jan 2017 00:53:57 +0000 (18:53 -0600)]
build: Releasing version 0.4.0.

* configure.ac: Update version number to 0.4.0.

2 years agobuild: Update and comment on hash in guix.scm.
Christopher Allan Webber [Sun, 8 Jan 2017 00:57:15 +0000 (18:57 -0600)]
build: Update and comment on hash in guix.scm.

* guix.scm: Update hash, but also acknowledge that updating the hash
here is futile since releasing will have a different hash!  In the
future we'll have nicer code here that can use the code from the git
checkout.

2 years agobuild: Add guix.scm to tarball.
Christopher Allan Webber [Sun, 8 Jan 2017 00:56:08 +0000 (18:56 -0600)]
build: Add guix.scm to tarball.

Makefile.am (EXTRA_DIST): Add guix.scm.

2 years agobuild: Rename package.scm to guix.scm and update.
Christopher Allan Webber [Sun, 8 Jan 2017 00:52:34 +0000 (18:52 -0600)]
build: Rename package.scm to guix.scm and update.

* guix.scm: Renamed from package.scm and updated for v0.4.0.

2 years agobuild: Include bootstrap.sh in tarball.
Christopher Allan Webber [Sun, 8 Jan 2017 00:50:50 +0000 (18:50 -0600)]
build: Include bootstrap.sh in tarball.

* Makefile.am (EXTRA_DIST): Add bootstrap.sh.

2 years agoNEWS: Updating news for v0.4.0.
Christopher Allan Webber [Sun, 8 Jan 2017 00:18:37 +0000 (18:18 -0600)]
NEWS: Updating news for v0.4.0.

* NEWS: New 8sync 0.4 section.

2 years agobuild: Add gendocs.
Christopher Allan Webber [Sat, 7 Jan 2017 23:13:27 +0000 (17:13 -0600)]
build: Add gendocs.

* doc/gendocs.sh:
* doc/gendocs_template: New files.

* .gitignore: Update to ignore files built by gendocs.sh.

2 years agodoc: Move content from doc/8sync-new-manual.org to doc/8sync.texi.
Christopher Allan Webber [Sat, 7 Jan 2017 17:58:29 +0000 (11:58 -0600)]
doc: Move content from doc/8sync-new-manual.org to doc/8sync.texi.

* doc/8sync-new-manual.org: Deleted.
* doc/8sync.texi: Move content exported from doc/8sync-new-manual.org to
here.

2 years agodoc: Delete trailing whitespace.
Christopher Allan Webber [Fri, 6 Jan 2017 23:17:55 +0000 (17:17 -0600)]
doc: Delete trailing whitespace.

* doc/8sync-new-manual.org: Delete trailing whitespace.

2 years agodoc: Last minute cleanups to the tutorial before we move to texinfo.
Christopher Allan Webber [Fri, 6 Jan 2017 23:15:52 +0000 (17:15 -0600)]
doc: Last minute cleanups to the tutorial before we move to texinfo.

* doc/8sync-new-manual.org: Last minute cleanups to the tutorial before
we move to texinfo.

2 years agodoc: Add a note about actor-alive? being likely to be deprecated.
Christopher Allan Webber [Fri, 6 Jan 2017 22:23:50 +0000 (16:23 -0600)]
doc: Add a note about actor-alive? being likely to be deprecated.

* doc/8sync-new-manual.org: Add footnote about future deprecation of
actor-alive?.

2 years agodoc: Have telcmd tutorial example send itself a message for line handling.
Christopher Allan Webber [Fri, 6 Jan 2017 22:19:42 +0000 (16:19 -0600)]
doc: Have telcmd tutorial example send itself a message for line handling.

* doc/8sync-new-manual.org: Have telcmd tutorial example send itself a
message for line handling.

2 years agoirc: Convert handle-line to a message handler.
Christopher Allan Webber [Fri, 6 Jan 2017 21:58:16 +0000 (15:58 -0600)]
irc: Convert handle-line to a message handler.

* 8sync/systems/irc.scm (<irc-bot>): Add 'handle-line action handler,
which points to handle-line generic.
(dispatch-raw-line): Send message to our own actor to call handle-line.
(handle-line): Convert to be an action handler.

* demos/ircbot.scm:
* doc/8sync-new-manual.org: Update implementers of handle-line generic
method.

2 years agodoc: Reordering some paragraphs in the tutorial.
Christopher Allan Webber [Fri, 6 Jan 2017 18:21:44 +0000 (12:21 -0600)]
doc: Reordering some paragraphs in the tutorial.

* doc/8sync-new-manual.org: Reordering some paragraphs in the tutorial.

2 years agodoc: Remove stray #+END_SRC.
Christopher Allan Webber [Fri, 6 Jan 2017 18:19:00 +0000 (12:19 -0600)]
doc: Remove stray #+END_SRC.

* doc/8sync-new-manual.org: Remove stray #+END_SRC.

2 years agoagenda: Remove deprecated comment.
Christopher Allan Webber [Fri, 6 Jan 2017 17:29:27 +0000 (11:29 -0600)]
agenda: Remove deprecated comment.

* 8sync/agenda.scm (run-agenda): Remove comment, since we did the thing
it suggested doing in the future.

2 years agodoc: Some tutorial tweaks.
Christopher Allan Webber [Fri, 6 Jan 2017 16:11:54 +0000 (10:11 -0600)]
doc: Some tutorial tweaks.

* doc/8sync-new-manual.org: Small tutorial tweaks.

2 years agodoc: Move the "live hacking intermission" to the bottom.
Christopher Allan Webber [Thu, 5 Jan 2017 03:38:23 +0000 (21:38 -0600)]
doc: Move the "live hacking intermission" to the bottom.

* doc/8sync-new-manual.org: Move the "live hacking intermission" to
the bottom of the tutorial.

2 years agodoc: Tutorial additions.
Christopher Allan Webber [Thu, 5 Jan 2017 03:36:31 +0000 (21:36 -0600)]
doc: Tutorial additions.

* doc/8sync-new-manual.org: Add "Writing our own network-enabled
actor" section.  Clean up other sections, including moving the intro
to the tutorial blathering about IRC systems to a footnote.

2 years agoUse *init* and *cleanup* in existing actors.
Christopher Allan Webber [Thu, 5 Jan 2017 02:02:13 +0000 (20:02 -0600)]
Use *init* and *cleanup* in existing actors.

* 8sync/repl.scm (<repl-manager>):
* 8sync/systems/irc.scm (<irc-bot>): Switch from an 'init action to the
implicit '*init* action.

* 8sync/systems/irc.scm (<irc-bot>, irc-bot-cleanup): Add *cleanup*
handler.

* demos/ircbot.scm:
* doc/8sync-new-manual.org: Drop some calls to 'init when
bootstrapping-messages since we now use '*init*.

2 years agodemos: Switch botherbotherbother demo over to use define-actor.
Christopher Allan Webber [Wed, 4 Jan 2017 22:53:55 +0000 (16:53 -0600)]
demos: Switch botherbotherbother demo over to use define-actor.

* demos/actors/botherbotherbother.scm: Switch to use define-actor.

2 years agoactors: Cleanup on signals.
Christopher Allan Webber [Wed, 4 Jan 2017 20:12:15 +0000 (14:12 -0600)]
actors: Cleanup on signals.

* 8sync/actors.scm (run-hive): Handle signals, currently SIGINT and
SIGTERM, in a friendly way.  Will still run cleanup on actors.

2 years agoactors: Remove define-simple-actor, add define-actor.
Christopher Allan Webber [Wed, 4 Jan 2017 17:41:30 +0000 (11:41 -0600)]
actors: Remove define-simple-actor, add define-actor.

define-simple-actor wasn't very useful, whereas define-actor is
moderately helpful.

* 8sync/actors.scm (define-simple-actor): Remove.
(define-actor): New macro.

* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* tests/test-actors.scm: Convert to use define-simple-actor instead of
define-actor.

2 years agodoc: Add a note about the calls to display.
Christopher Allan Webber [Wed, 4 Jan 2017 17:41:22 +0000 (11:41 -0600)]
doc: Add a note about the calls to display.

* doc/8sync-new-manual.org: Add paragraph.

2 years agodoc: Tweak and fix the "Writing our own actors" section.
Christopher Allan Webber [Wed, 4 Jan 2017 17:31:57 +0000 (11:31 -0600)]
doc: Tweak and fix the "Writing our own actors" section.

* doc/8sync-new-manual.org: Fixed some errors and made things a bit
clearer.

2 years agoactors: Rename msg-receive, msg-val to mbody-receive, mbody-val.
Christopher Allan Webber [Wed, 4 Jan 2017 16:28:18 +0000 (10:28 -0600)]
actors: Rename msg-receive, msg-val to mbody-receive, mbody-val.

* 8sync/actors.scm (mbody-receive, mbody-val): Rename from msg-receive,
msg-val.  Update all callers.

2 years agoactors: Add auto-init feature to actors.
Christopher Allan Webber [Wed, 4 Jan 2017 01:57:50 +0000 (19:57 -0600)]
actors: Add auto-init feature to actors.

* 8sync/actors.scm (<actor>): Add '*init* action to actions slot.
(<hive>, hive-handle-init-all): Add '*init-all* action.
(hive-handle-cleanup-all): Adjust comment.
(%hive-create-actor): Add send-init? argument, and when supplied
call <-wait on the actor's '*init* method.
(bootstrap-actor, bootstrap-actor*): Rename from hive-create-actor,
hive-create-actor*.  Switch init argument to init-args and pass in #f to
%hive-create-actor's send-init? argument.
(create-actor, create-actor*): Switch init argument to init-args
and pass in #t to %hive-create-actor's send-init? argument.
(run-hive): Add '*init-all* action call to the hive on the initial
queue.

* 8sync/debug.scm (bootstrap-actor-gimmie, bootstrap-actor-gimmie*):
Rename from hive-create-actor-gimmie, hive-create-actor-gimmie*.

* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* demos/ircbot.scm:
* doc/8sync-new-manual.org:
* tests/test-actors.scm: Change calls from hive-create-actor to
bootstrap-actor.

* tests/test-actors.scm: Add actor *init*'ing tests.

2 years agodoc: Add addendum section on relationship between 8sync and Fibers.
Christopher Allan Webber [Tue, 3 Jan 2017 17:48:28 +0000 (11:48 -0600)]
doc: Add addendum section on relationship between 8sync and Fibers.

* doc/8sync-new-manual.org: Add "8sync and Fibers" section.

2 years agoactors: Implicit from-actor argument <-foo methods, and add rest of <-foo*.
Christopher Allan Webber [Tue, 3 Jan 2017 01:20:58 +0000 (19:20 -0600)]
actors: Implicit from-actor argument <-foo methods, and add rest of <-foo*.

* 8sync/actors.scm (<-, <-wait, <-reply, <-reply-wait): from-actor is
now implicitly supplied via %current-actor parameter.
(<-*, <-reply*): New procedures.
(<-wait*, <-reply-wait*): Now pull from-actor from #:actor.

* 8sync/actors.scm:
* 8sync/systems/irc.scm:
* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* demos/ircbot.scm:
* tests/test-actors.scm: Update all callers of <-foo procedures to drop
from-actor argument.

* doc/8sync-new-manual.org: Update documentation of <-foo procedures to
drop from-actor argument.

2 years agoagenda: Rename start-agenda to run-agenda.
Christopher Allan Webber [Mon, 2 Jan 2017 22:33:10 +0000 (16:33 -0600)]
agenda: Rename start-agenda to run-agenda.

* 8sync/agenda.scm (run-agenda): Renamed from start-agenda.
* 8sync/actors.scm:
* tests/test-agenda.scm: Update all callers.

2 years agoactors: Rename *clean-up* back to *cleanup.
Christopher Allan Webber [Mon, 2 Jan 2017 21:38:23 +0000 (15:38 -0600)]
actors: Rename *clean-up* back to *cleanup.

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.

2 years agoactors: Rename actor-am-i-alive? to actor-alive?.
Christopher Allan Webber [Mon, 2 Jan 2017 21:15:59 +0000 (15:15 -0600)]
actors: Rename actor-am-i-alive? to actor-alive?.

* 8sync/actors.scm (actor-alive?): Rename from actor-am-i-alive?.
* 8sync/actors.scm:
* 8sync/repl.scm:
* doc/8sync-new-manual.org: Update all references to actor-alive?.

2 years agoactors: Automatically add cookie by default in hive-create-actor.
Christopher Allan Webber [Mon, 2 Jan 2017 21:15:29 +0000 (15:15 -0600)]
actors: Automatically add cookie by default in hive-create-actor.

Also switch separator in cookie from "-" to ":".

* 8sync/actors.scm (hive-gen-actor-id): Switch separator from "-" to ":".
(hive-create-actor): Automatically add a cookie based on the class name.
(hive-create-actor*): Tweak docstring.

2 years agotests: Fix broken test in test-actors.
Christopher Allan Webber [Mon, 2 Jan 2017 18:23:52 +0000 (12:23 -0600)]
tests: Fix broken test in test-actors.

* tests/test-actors.scm: Fix broken test, forgot to update expected output.

2 years agotests: Oops, forgot to add <exploder> to test-actors.
Christopher Allan Webber [Mon, 2 Jan 2017 18:21:23 +0000 (12:21 -0600)]
tests: Oops, forgot to add <exploder> to test-actors.

* tests/test-actors.scm: Add <exploder>.

2 years agoactors: Update self-destruct to run *clean-up* message handler.
Christopher Allan Webber [Mon, 2 Jan 2017 18:17:15 +0000 (12:17 -0600)]
actors: Update self-destruct to run *clean-up* message handler.

* 8sync/actors.scm (self-destruct): Wait on *clean-up* action before
self-destructing by default.
(run-hive): Add parameter to specify whether or not to clean-up after
the hive finishes its tasks.
* tests/test-actors.scm: Add tests for disabling #:clean-up on run-tasks
and ensuring that *clean-up* runs on self-destruct.

2 years agoactors: Rename *cleanup* action to *clean-up*.
Christopher Allan Webber [Mon, 2 Jan 2017 17:54:03 +0000 (11:54 -0600)]
actors: Rename *cleanup* action to *clean-up*.

* 8sync/actors.scm (<actor>, <hive>, hive-handle-clean-up-all, run-hive):
Rename *cleanup* to *clean-up* and *cleanup-all* to *clean-up-all*.
* tests/test-actors.scm: Likewise.