gall: reshuffle some +mo content

This commit is contained in:
Jared Tobin 2019-06-26 05:25:03 +08:00 committed by Jared Tobin
parent d9f32fe898
commit d618ac2904
No known key found for this signature in database
GPG Key ID: 0E4647D58F8A69E4

View File

@ -156,8 +156,7 @@
running=(map term agent) running=(map term agent)
:: waiting queue :: waiting queue
:: ::
:: FIXME rename to blocked blocked=(map term blocked)
waiting=(map term blocked)
== ==
:: ::
:: +routes: new cuff. :: +routes: new cuff.
@ -406,7 +405,7 @@
=/ =type p.u.maybe-vase =/ =type p.u.maybe-vase
(~(nest ut type) %.n inferred) (~(nest ut type) %.n inferred)
:: ::
:: +mo-handle-received-core: receives an app core built by %ford. :: +mo-receive-core: receives an app core built by %ford.
:: ::
:: Presuming we receive a good core, we first check to see if the agent :: Presuming we receive a good core, we first check to see if the agent
:: is already running. If so, we update its beak in %gall's state, :: is already running. If so, we update its beak in %gall's state,
@ -418,8 +417,8 @@
:: and then do more or less the same procedure as we did for the running :: and then do more or less the same procedure as we did for the running
:: agent case. :: agent case.
:: ::
++ mo-handle-received-core ++ mo-receive-core
~/ %mo-handle-received-core ~/ %mo-receive-core
|= [=term =beak =made-result:ford] |= [=term =beak =made-result:ford]
^+ mo-state ^+ mo-state
:: ::
@ -624,6 +623,23 @@
=/ =foreign (~(got by contacts.agents.gall) ship) =/ =foreign (~(got by contacts.agents.gall) ship)
(~(got by duct-map.foreign) index) (~(got by duct-map.foreign) index)
:: ::
:: +mo-handle-sys: handle a +sign incoming over /sys.
::
++ mo-handle-sys
~/ %mo-handle-sys
|= [=path =sign-arvo]
^+ mo-state
::
?+ -.path !!
%core (mo-handle-sys-core path sign-arvo)
%pel (mo-handle-sys-pel path sign-arvo)
%red (mo-handle-sys-red path sign-arvo)
%rep (mo-handle-sys-rep path sign-arvo)
%req (mo-handle-sys-req path sign-arvo)
%val (mo-handle-sys-val path sign-arvo)
%way (mo-handle-sys-way path sign-arvo)
==
::
:: +mo-handle-sys-core: receive a core from %ford. :: +mo-handle-sys-core: receive a core from %ford.
:: ::
++ mo-handle-sys-core ++ mo-handle-sys-core
@ -641,7 +657,7 @@
=/ =case [%da (slav %da i.t.t.beak-path)] =/ =case [%da (slav %da i.t.t.beak-path)]
[ship desk case] [ship desk case]
:: ::
(mo-handle-received-core i.t.path beak result.sign-arvo) (mo-receive-core i.t.path beak result.sign-arvo)
:: ::
:: +mo-handle-sys-pel: translated peer. :: +mo-handle-sys-pel: translated peer.
:: ::
@ -895,24 +911,6 @@
:: ::
(mo-handle-foreign-response foreign-response maybe-ares) (mo-handle-foreign-response foreign-response maybe-ares)
:: ::
:: +mo-handle-sys: handle a +sign incoming over /sys.
::
:: FIXME better docs, potentially rename +mo-handle-sign or something
++ mo-handle-sys
~/ %mo-handle-sys
|= [=path =sign-arvo]
^+ mo-state
::
?+ -.path !!
%core (mo-handle-sys-core path sign-arvo)
%pel (mo-handle-sys-pel path sign-arvo)
%red (mo-handle-sys-red path sign-arvo)
%rep (mo-handle-sys-rep path sign-arvo)
%req (mo-handle-sys-req path sign-arvo)
%val (mo-handle-sys-val path sign-arvo)
%way (mo-handle-sys-way path sign-arvo)
==
::
:: +mo-handle-use: handle a typed +sign incoming on /use. :: +mo-handle-use: handle a typed +sign incoming on /use.
:: ::
:: Initialises the specified agent and then performs an agent-level +take on :: Initialises the specified agent and then performs an agent-level +take on
@ -985,7 +983,7 @@
?. (~(has by running.agents.gall) term) ?. (~(has by running.agents.gall) term)
mo-state mo-state
:: ::
=/ maybe-blocked (~(get by waiting.agents.gall) term) =/ maybe-blocked (~(get by blocked.agents.gall) term)
:: ::
?~ maybe-blocked ?~ maybe-blocked
mo-state mo-state
@ -995,9 +993,9 @@
|- ^+ mo-state |- ^+ mo-state
:: ::
?: =(~ blocked) ?: =(~ blocked)
=/ waiting (~(del by waiting.agents.gall) term) =/ blocked (~(del by blocked.agents.gall) term)
%_ mo-state %_ mo-state
waiting.agents.gall waiting blocked.agents.gall blocked
== ==
:: ::
=^ task blocked [p q]:~(get to blocked) =^ task blocked [p q]:~(get to blocked)
@ -1088,18 +1086,18 @@
=/ =agent-action q.internal-task =/ =agent-action q.internal-task
:: ::
=/ is-running (~(has by running.agents.gall) term) =/ is-running (~(has by running.agents.gall) term)
=/ is-waiting (~(has by waiting.agents.gall) term) =/ is-blocked (~(has by blocked.agents.gall) term)
:: ::
?: |(!is-running is-waiting) ?: |(!is-running is-blocked)
:: ::
=/ =blocked =/ =blocked
=/ waiting (~(get by waiting.agents.gall) term) =/ waiting (~(get by blocked.agents.gall) term)
=/ tasks (fall waiting *blocked) =/ tasks (fall waiting *blocked)
=/ task [hen privilege agent-action] =/ task [hen privilege agent-action]
(~(put to tasks) task) (~(put to tasks) task)
:: ::
%_ mo-state %_ mo-state
waiting.agents.gall (~(put by waiting.agents.gall) term blocked) blocked.agents.gall (~(put by blocked.agents.gall) term blocked)
== ==
:: ::
(mo-apply term privilege agent-action) (mo-apply term privilege agent-action)
@ -2798,8 +2796,8 @@
:: ::
%wegh %wegh
:: ::
=/ waiting =/ blocked
=/ queued (~(run by waiting.agents.gall) |=(blocked [%.y +<])) =/ queued (~(run by blocked.agents.gall) |=(blocked [%.y +<]))
(sort ~(tap by queued) aor) (sort ~(tap by queued) aor)
:: ::
=/ running =/ running
@ -2809,7 +2807,7 @@
=/ =mass =/ =mass
:+ %gall %.n :+ %gall %.n
:~ [%foreign %.y contacts.agents.gall] :~ [%foreign %.y contacts.agents.gall]
[%blocked %.n waiting] [%blocked %.n blocked]
[%active %.n running] [%active %.n running]
[%dot %.y gall] [%dot %.y gall]
== ==