gall: add %doze-style fade

This commit is contained in:
Philip Monk 2020-11-17 12:53:05 -08:00
parent 1c8d229fb7
commit a7cc18072a
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
5 changed files with 115 additions and 65 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b5d3225b222544eae6f78d18a4a2343ff4c746fbcb72914760b79598ff90813d
size 6278785
oid sha256:5abdec8bcb76937c12e784a67d596ecfe58ecad0d04b466ebd3eeb6caa41aa79
size 6513179

View File

@ -110,7 +110,7 @@
::
++ poke-pass
|= =note-arvo =< abet
(emit %pass /pass %arvo note-arvo)
(emit %pass /helm/pass %arvo note-arvo)
::
++ take-wake-automass
|= [way=wire error=(unit tang)]
@ -281,5 +281,7 @@
?>(?=(%wake +<.sign-arvo) +>.sign-arvo)
[%serv *] %+ take-bound t.wire
?>(?=(%bound +<.sign-arvo) +>.sign-arvo)
[%pass *] ~& [%pass-response [- +<]:sign-arvo]
abet
==
--

View File

@ -1748,7 +1748,7 @@
=/ additions=(set path) (~(dif in upsert-set) old-set)
?~ hun
~
?: =(0 let.dom)
?: (lte let.dom 1)
~
|^
;: weld
@ -1765,7 +1765,7 @@
::
++ path-to-tank
|= =path
=/ pre=^path ~[(scot %p our) syd (scot %ud +(let.dom))]
=/ pre=^path ~[(scot %p our) syd (scot %ud let.dom)]
:+ %rose ["/" "/" ~]
%+ turn (weld pre path)
|= a=cord

View File

@ -56,13 +56,13 @@
live=?
=stats
=watches
=agent
agent=(each agent vase)
=beak
marks=(map duct mark)
==
:: $blocked-move: enqueued move to an agent
::
+$ blocked-move [=duct =routes =deal]
+$ blocked-move [=duct =routes move=(each deal sign:agent)]
:: $stats: statistics
::
:: change: how many moves this agent has processed
@ -126,7 +126,7 @@
live=?
=stats
=watches
old-state=vase
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
@ -166,9 +166,11 @@
?~ apps mo-core
~> %slog.[0 leaf+"gall: upgrading {<dap.i.apps>}"]
=/ ap-core (ap-abut:ap:mo-core i.apps)
=^ tan ap-core (ap-install:ap-core `old-state.egg.i.apps)
=? ap-core ?=(%& -.old-state.egg.i.apps)
=^ tan ap-core (ap-install:ap-core `p.old-state.egg.i.apps)
?^ tan
(mean u.tan)
ap-core
=? ap-core wipe-eyre-subs.spore
=/ ducts=(list ^duct)
%+ skim ~(tap in ~(key by inbound.watches.egg.i.apps))
@ -270,7 +272,8 @@
- %6
outstanding ~ :: TODO: do we need to process these somehow?
running
(~(run by running.s) |=(y=yoke-0 +:y(agent on-save:agent.y)))
:: XXX &+ should be in next state adapter
(~(run by running.s) |=(y=yoke-0 +:y(agent &+on-save:agent.y)))
==
::
++ state-4-to-5 |=(s=state-4 `state-5`s(- %5, outstanding ~))
@ -419,12 +422,13 @@
=/ =routes [disclosing=~ attributing=our]
=/ ap-core (ap-abed:ap dap routes)
=. ap-core (ap-reinstall:ap-core agent)
ap-abet:ap-core
=. mo-core ap-abet:ap-core
(mo-clear-queue dap)
::
=. yokes.state
%+ ~(put by yokes.state) dap
=/ default-yoke *yoke
default-yoke(control-duct hen, beak bek, agent agent)
default-yoke(control-duct hen, beak bek, agent &+agent)
::
=/ old mo-core
=/ wag
@ -461,10 +465,12 @@
[%z /sys/arvo/hoon]
[%z /sys/zuse/hoon]
[%z /sys/vane/gall/hoon]
%+ turn ~(tap in ~(key by yokes.state))
|= dap=term
^- [care:clay path]
[%a /app/[dap]/hoon]
%+ murn ~(tap by yokes.state)
|= [dap=term =yoke]
^- (unit [care:clay path])
?: ?=(%| -.agent.yoke)
~
`[%a /app/[dap]/hoon]
==
(mo-pass wire %c %warp our %home ~ %mult mool)
:: +mo-scry-agent-cage: read $agent core from clay
@ -789,22 +795,38 @@
~& [%mo-handle-use-bad-path path]
!!
::
=/ dap=term i.path
=/ yoke (~(get by yokes.state) dap)
?~ yoke
%- (slog leaf+"gall: {<dap>} dead, got {<+<.sign-arvo>}" ~)
mo-core
?. ?=([?(%g %b) %unto *] sign-arvo)
?: ?=(%| -.agent.u.yoke)
%- (slog leaf+"gall: {<dap>} dozing, dropping {<+<.sign-arvo>}" ~)
mo-core
=/ app
=/ =term i.path
=/ =ship (slav %p i.t.path)
=/ =routes [disclosing=~ attributing=ship]
(ap-abed:ap term routes)
(ap-abed:ap dap routes)
::
=. app (ap-generic-take:app t.t.path sign-arvo)
ap-abet:app
=/ =sign:agent +>.sign-arvo
=/ app
?> ?=([%out @ @ *] t.t.path)
=/ =term i.path
=/ =ship (slav %p i.t.t.t.path)
=/ =routes [disclosing=~ attributing=ship]
(ap-abed:ap term routes)
=/ =sign:agent +>.sign-arvo
?: ?=(%| -.agent.u.yoke)
=/ blocked=(qeu blocked-move)
=/ waiting (~(get by blocked.state) dap)
=/ deals (fall waiting *(qeu blocked-move))
=/ deal [hen routes |+sign]
(~(put to deals) deal)
::
%- (slog leaf+"gall: {<dap>} dozing, got {<-.sign>}" ~)
%_ mo-core
blocked.state (~(put by blocked.state) dap blocked)
==
=/ app (ap-abed:ap dap routes)
=. app
(ap-specific-take:app t.t.path sign)
ap-abet:app
@ -822,10 +844,14 @@
?: =(~ blocked)
=. blocked.state (~(del by blocked.state) dap)
mo-core
=^ [=duct =routes =deal] blocked ~(get to blocked)
=/ move
=^ [=duct =routes blocker=(each deal sign:agent)] blocked
~(get to blocked)
=/ =move
=/ =sock [attributing.routes our]
=/ card [%slip %g %deal sock dap deal]
=/ card
?: ?=(%& -.blocker)
[%slip %g %deal sock dap p.blocker]
[%pass /clear-huck %b %huck %g %unto p.blocker]
[duct card]
$(moves [move moves])
:: +mo-filter-queue: remove all blocked tasks from ship.
@ -854,15 +880,15 @@
:: +mo-fade: put app to sleep
::
++ mo-fade
|= [dap=term style=?(%rest %doze %gone)]
|= [dap=term style=?(%gone %doze %wake)]
^+ mo-core
=/ =routes [disclosing=~ attributing=our]
=/ app (ap-abed:ap dap routes)
=. mo-core ap-abet:(ap-fade:app style)
?- style
%gone mo-core(yokes.state (~(del by yokes.state) dap))
%rest !!
%doze !!
%doze mo-core
%wake (mo-boot dap our %home)
==
:: +mo-beak: assemble a beak for the specified agent.
::
@ -943,22 +969,23 @@
ap-abet:app
:: +mo-handle-local: handle locally.
::
:: If the agent is running or blocked, assign it the supplied +deal.
:: Otherwise simply apply the action to the agent.
:: If the agent is not running or blocked, assign it the supplied
:: +deal. Otherwise simply apply the action to the agent.
::
++ mo-handle-local
|= [=ship agent=term =deal]
^+ mo-core
::
=/ =routes [disclosing=~ attributing=ship]
=/ is-running (~(has by yokes.state) agent)
=/ running (~(get by yokes.state) agent)
=/ is-running ?~(running %| ?=(%& -.agent.u.running))
=/ is-blocked (~(has by blocked.state) agent)
::
?: |(!is-running is-blocked)
=/ blocked=(qeu blocked-move)
=/ waiting (~(get by blocked.state) agent)
=/ deals (fall waiting *(qeu blocked-move))
=/ deal [hen routes deal]
=/ deal [hen routes &+deal]
(~(put to deals) deal)
::
%- (slog leaf+"gall: not running {<agent>} yet, got {<-.deal>}" ~)
@ -1049,10 +1076,13 @@
++ ap-abut
|= [dap=term =egg]
^+ ap-core
=/ =yoke
?: ?=(%| -.old-state.egg)
egg
=/ res (mo-scry-agent-cage dap da+now)
?: ?=(%| -.res)
(mean p.res)
=/ =yoke egg(old-state `agent`p.res)
egg(p.old-state `agent`p.res)
=/ =routes [disclosing=~ attributing=our]
(ap-yoke dap routes yoke)
:: +ap-yoke: initialize agent state, starting from a $yoke
@ -1089,9 +1119,15 @@
:: For %gone, remove all incoming and outgoing subscriptions.
::
++ ap-fade
|= style=?(%rest %doze %gone)
|= style=?(%gone %doze %wake)
^+ ap-core
?> ?=(%gone style)
?- style
%doze
=. agent.current-agent |+on-save:ap-agent-core
ap-core
::
%wake ap-core
%gone
=/ out=(list [[=wire =ship =term] ? =path])
~(tap by outbound.watches.current-agent)
=/ inbound-paths=(set path)
@ -1107,8 +1143,9 @@
%+ turn ~(tap by outbound.watches.current-agent)
|= [[=wire =ship =term] ? =path]
[%pass wire %agent [ship term] %leave ~]
=^ maybe-tang ap-core (ap-ingest ~ |.([will agent.current-agent]))
=^ maybe-tang ap-core (ap-ingest ~ |.([will *agent]))
ap-core
==
:: +ap-from-internal: internal move to move.
::
:: We convert from cards to duct-indexed moves when resolving
@ -1238,7 +1275,8 @@
:: +ap-agent-core: agent core with current bowl and state
::
++ ap-agent-core
~(. agent.current-agent ap-construct-bowl)
?> ?=(%& -.agent.current-agent)
~(. p.agent.current-agent ap-construct-bowl)
:: +ap-ducts-from-paths: get ducts subscribed to paths
::
++ ap-ducts-from-paths
@ -1372,9 +1410,12 @@
~/ %ap-reinstall
|= =agent
^+ ap-core
=/ old-state=vase ~(on-save agent.current-agent ap-construct-bowl)
=/ old-state=vase
?: ?=(%& -.agent.current-agent)
on-save:ap-agent-core
p.agent.current-agent
=^ error ap-core
(ap-install(agent.current-agent agent) `old-state)
(ap-install(agent.current-agent &+agent) `old-state)
?~ error
ap-core
(mean >%load-failed< u.error)
@ -1641,7 +1682,7 @@
?: ?=(%| -.result)
`ap-core
::
=. agent.current-agent +.p.result
=. agent.current-agent &++.p.result
=/ moves (zing (turn -.p.result ap-from-internal))
=. inbound.watches.current-agent
(ap-handle-kicks moves)
@ -1800,7 +1841,14 @@
^- spore
=; eggs=(map term egg) [- | +]:state(yokes eggs)
%- ~(run by yokes.state)
|=(=yoke `egg`yoke(agent on-save:agent.yoke))
|= =yoke
^- egg
%= yoke
agent
?: ?=(%& -.agent.yoke)
[%& on-save:p.agent.yoke]
[%| p.agent.yoke]
==
:: +take: response
::
++ take

View File

@ -1723,7 +1723,7 @@
[$deal p=sock q=term r=deal] :: full transmission
[%goad force=? agent=(unit dude)] :: rebuild agent(s)
[%sear =ship] :: clear pending queues
[%fade dap=term style=?(%rest %doze %gone)] :: put app to sleep
[%fade dap=term style=?(%gone %doze %wake)] :: put app to sleep
$>(%init vane-task) :: set owner
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade