Big refactor for 8sync on fibers in progress.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 14 Jul 2017 19:36:16 +0000 (14:36 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 3 Aug 2017 20:42:43 +0000 (15:42 -0500)
commit57b7dfc7a351017e09bd158889ed45fa57e51289
tree445147c489632dbdc515a51c905bd523c2d55ae0
parent8cbb7f22227c0afdd3b0bd758ebec0efba2fa1e1
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.
8sync/actors.scm
8sync/inbox.scm [new file with mode: 0644]
8sync/systems/irc.scm
Makefile.am
demos/actors/botherbotherbother.scm
demos/actors/robotscanner.scm
demos/actors/simplest-possible.scm
guix.scm