gall: save highwater mark when nuking

This commit is contained in:
~wicrum-wicrun 2023-03-29 20:28:36 +02:00
parent 4084fe0e5c
commit 6524e85d0c

View File

@ -84,19 +84,21 @@
:: sky: scry bindings :: sky: scry bindings
:: ::
+$ yoke +$ yoke
$: control-duct=duct $% [%nuke sky=(map spur @ud)]
run-nonce=@t $: %live
sub-nonce=_1 control-duct=duct
=stats run-nonce=@t
=bitt sub-nonce=_1
=boat =stats
=boar =bitt
code=* =boat
agent=(each agent vase) =boar
=beak code=*
marks=(map duct mark) agent=(each agent vase)
sky=(map spur path-state) =beak
== marks=(map duct mark)
sky=(map spur path-state)
== ==
:: ::
+$ path-state +$ path-state
$: bob=(unit @ud) $: bob=(unit @ud)
@ -169,19 +171,21 @@
:: $egg: migratory agent state; $yoke with .old-state instead of .agent :: $egg: migratory agent state; $yoke with .old-state instead of .agent
:: ::
+$ egg +$ egg
$: control-duct=duct $% [%nuke sky=(map spur @ud)]
run-nonce=@t $: %live
sub-nonce=@ control-duct=duct
=stats run-nonce=@t
=bitt sub-nonce=@
=boat =stats
=boar =bitt
code=~ =boat
old-state=[%| vase] =boar
=beak code=~
marks=(map duct mark) old-state=[%| vase]
sky=(map spur path-state) =beak
== marks=(map duct mark)
sky=(map spur path-state)
== ==
-- --
:: adult gall vane interface, for type compatibility with pupa :: adult gall vane interface, for type compatibility with pupa
:: ::
@ -249,6 +253,7 @@
(drop (bind (~(get by yokes.state) u.dude) (lead u.dude))) (drop (bind (~(get by yokes.state) u.dude) (lead u.dude)))
|- ^+ mo-core |- ^+ mo-core
?~ apps mo-core ?~ apps mo-core
?: ?=(%nuke -.q.i.apps) $(apps t.apps)
=/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps) =/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps)
$(apps t.apps, mo-core ap-abet:(ap-doff:ap-core ship)) $(apps t.apps, mo-core ap-abet:(ap-doff:ap-core ship))
:: +mo-rake: send %cork's for old subscriptions if needed :: +mo-rake: send %cork's for old subscriptions if needed
@ -261,6 +266,7 @@
(drop (bind (~(get by yokes.state) u.dude) (lead u.dude))) (drop (bind (~(get by yokes.state) u.dude) (lead u.dude)))
|- ^+ mo-core |- ^+ mo-core
?~ apps mo-core ?~ apps mo-core
?: ?=(%nuke -.q.i.apps) $(apps t.apps)
=/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps) =/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps)
$(apps t.apps, mo-core ap-abet:(ap-rake:ap-core all)) $(apps t.apps, mo-core ap-abet:(ap-rake:ap-core all))
:: +mo-receive-core: receives an app core built by %ford. :: +mo-receive-core: receives an app core built by %ford.
@ -283,6 +289,7 @@
=/ yak (~(get by yokes.state) dap) =/ yak (~(get by yokes.state) dap)
=/ tex=(unit tape) =/ tex=(unit tape)
?~ yak `"installing" ?~ yak `"installing"
?: ?=(%nuke -.u.yak) `"unnuking" ::TODO good message here?
?- -.agent.u.yak ?- -.agent.u.yak
%| `"reviving" %| `"reviving"
%& %&
@ -293,7 +300,7 @@
=+ ?~ tex ~ =+ ?~ tex ~
~> %slog.[0 leaf+"gall: {u.tex} {<dap>}"] ~ ~> %slog.[0 leaf+"gall: {u.tex} {<dap>}"] ~
:: ::
?^ yak ?: ?=([~ %live *] yak)
?: &(=(q.beak.u.yak q.bek) =(code.u.yak agent) =(-.agent.u.yak &)) ?: &(=(q.beak.u.yak q.bek) =(code.u.yak agent) =(-.agent.u.yak &))
mo-core mo-core
:: ::
@ -306,12 +313,15 @@
:: ::
=. yokes.state =. yokes.state
%+ ~(put by yokes.state) dap %+ ~(put by yokes.state) dap
%* . *yoke %* . *$>(%live yoke)
control-duct hen control-duct hen
beak bek beak bek
code agent code agent
agent &+agent agent &+agent
run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) run-nonce (scot %uw (end 5 (shas %yoke-nonce eny)))
sky
?~ yak ~
(~(run by sky.u.yak) (corl (late ~) (lead ~)))
== ==
:: ::
=/ old mo-core =/ old mo-core
@ -604,7 +614,7 @@
:: ::
=/ dap=term i.wire =/ dap=term i.wire
=/ yoke (~(get by yokes.state) dap) =/ yoke (~(get by yokes.state) dap)
?~ yoke ?. ?=([~ %live *] yoke)
%- (slog leaf+"gall: {<dap>} dead, got {<+<.sign-arvo>}" ~) %- (slog leaf+"gall: {<dap>} dead, got {<+<.sign-arvo>}" ~)
mo-core mo-core
?. =(run-nonce.u.yoke i.t.wire) ?. =(run-nonce.u.yoke i.t.wire)
@ -705,7 +715,14 @@
mo-core mo-core
~> %slog.0^leaf/"gall: nuking {<dap>}" ~> %slog.0^leaf/"gall: nuking {<dap>}"
=. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our) =. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our)
mo-core(yokes.state (~(del by yokes.state) dap)) =- mo-core(yokes.state -)
%+ ~(jab by yokes.state) dap
|= =yoke
?: ?=(%nuke -.yoke) yoke
:- %nuke
%- ~(run by sky.yoke)
|= path-state
(fall (clap bob (bind (ram:on-path fan) head) max) 0)
:: +mo-load: install agents :: +mo-load: install agents
:: ::
++ mo-load ++ mo-load
@ -718,7 +735,8 @@
$(agents t.agents, mo-core (mo-receive-core i.agents)) $(agents t.agents, mo-core (mo-receive-core i.agents))
:: ::
=/ kil =/ kil
=/ lol (skim ~(tap by yokes.state) |=([term yoke] -.agent)) =/ lol
(skim ~(tap by yokes.state) |=([* y=yoke] &(?=(%live -.y) -.agent.y)))
=/ mol (~(gas by *(map term yoke)) lol) =/ mol (~(gas by *(map term yoke)) lol)
=/ sol ~(key by mol) =/ sol ~(key by mol)
=/ new (silt (turn agents head)) =/ new (silt (turn agents head))
@ -746,7 +764,8 @@
:: ::
%raw-poke %raw-poke
=/ =case:clay da+now =/ =case:clay da+now
=/ =desk q.beak:(~(got by yokes.state) dap) =/ yok (~(got by yokes.state) dap)
=/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion?
=/ sky (rof ~ %cb [our desk case] /[mark.deal]) =/ sky (rof ~ %cb [our desk case] /[mark.deal])
?- sky ?- sky
?(~ [~ ~]) ?(~ [~ ~])
@ -769,7 +788,8 @@
=/ =case:clay da+now =/ =case:clay da+now
=/ =mars:clay [p.cage mark]:deal =/ =mars:clay [p.cage mark]:deal
=/ mars-path /[a.mars]/[b.mars] =/ mars-path /[a.mars]/[b.mars]
=/ =desk q.beak:(~(got by yokes.state) dap) =/ yok (~(got by yokes.state) dap)
=/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion?
=/ sky (rof ~ %cc [our desk case] mars-path) =/ sky (rof ~ %cc [our desk case] mars-path)
?- sky ?- sky
?(~ [~ ~]) ?(~ [~ ~])
@ -806,7 +826,7 @@
:: ::
=/ =routes [disclosing=~ attributing=ship] =/ =routes [disclosing=~ attributing=ship]
=/ running (~(get by yokes.state) agent) =/ running (~(get by yokes.state) agent)
=/ is-running ?~(running %| ?=(%& -.agent.u.running)) =/ is-running &(?=([~ %live *] running) ?=(%& -.agent.u.running))
=/ is-blocked (~(has by blocked.state) agent) =/ is-blocked (~(has by blocked.state) agent)
:: agent is running; deliver move normally :: agent is running; deliver move normally
:: ::
@ -877,7 +897,7 @@
agent-duct=duct agent-duct=duct
agent-moves=(list move) agent-moves=(list move)
agent-config=(list (each suss tang)) agent-config=(list (each suss tang))
=yoke =$>(%live yoke)
== ==
:: ::
++ trace ++ trace
@ -902,11 +922,13 @@
~/ %ap-abed ~/ %ap-abed
|= [dap=term =routes] |= [dap=term =routes]
^+ ap-core ^+ ap-core
(ap-yoke dap routes (~(got by yokes.state) dap)) %^ ap-yoke dap routes
=< ?>(?=(%live -) .)
(~(got by yokes.state) dap)
:: +ap-yoke: initialize agent state, starting from a $yoke :: +ap-yoke: initialize agent state, starting from a $yoke
:: ::
++ ap-yoke ++ ap-yoke
|= [dap=term =routes yak=^yoke] |= [dap=term =routes yak=$>(%live ^yoke)]
^+ ap-core ^+ ap-core
=. stats.yak =. stats.yak
:+ +(change.stats.yak) :+ +(change.stats.yak)
@ -1998,7 +2020,7 @@
%- ~(urn by eggs.old) %- ~(urn by eggs.old)
|= [a=term e=egg-11] |= [a=term e=egg-11]
^- egg ^- egg
e(marks [marks.e sky:*egg]) live/e(marks [marks.e sky:*$>(%live egg)])
== ==
:: ::
:: removed live :: removed live
@ -2031,8 +2053,8 @@
:: ::
?: ?=(%a care) ?: ?=(%a care)
?. =(p.bem our) ~ ?. =(p.bem our) ~
=/ yok (~(get by yokes.state) q.bem) ?~ yok=(~(get by yokes.state) q.bem) ~
?~ yok ~ ?: ?=(%nuke -.u.yok) ~
=/ ski (~(get by sky.u.yok) s.bem) =/ ski (~(get by sky.u.yok) s.bem)
?~ ski ~ ?~ ski ~
=/ res=(unit (each noun @uvI)) =/ res=(unit (each noun @uvI))
@ -2079,7 +2101,7 @@
=; hav=? =; hav=?
[~ ~ noun+!>(hav)] [~ ~ noun+!>(hav)]
=/ yok=(unit yoke) (~(get by yokes.state) dap) =/ yok=(unit yoke) (~(get by yokes.state) dap)
?~(yok | -.agent.u.yok) &(?=([~ %live *] yok) -.agent.u.yok)
:: ::
?: ?& =(%d care) ?: ?& =(%d care)
=(~ path) =(~ path)
@ -2087,7 +2109,7 @@
=(our ship) =(our ship)
== ==
=/ yok=(unit yoke) (~(get by yokes.state) dap) =/ yok=(unit yoke) (~(get by yokes.state) dap)
?~ yok ?. ?=([~ %live *] yok)
[~ ~] [~ ~]
[~ ~ desk+!>(q.beak.u.yok)] [~ ~ desk+!>(q.beak.u.yok)]
:: ::
@ -2101,7 +2123,9 @@
=* syd=desk dap =* syd=desk dap
%+ roll ~(tap by yokes.state) %+ roll ~(tap by yokes.state)
|= [[=dude =yoke] acc=(set [=dude live=?])] |= [[=dude =yoke] acc=(set [=dude live=?])]
?. =(syd q.beak.yoke) ?. ?& ?=(%live -.yoke)
=(syd q.beak.yoke)
==
acc acc
(~(put in acc) [dude -.agent.yoke]) (~(put in acc) [dude -.agent.yoke])
:: ::
@ -2112,14 +2136,17 @@
== ==
:+ ~ ~ :+ ~ ~
:- %nonces !> ^- (map dude @) :- %nonces !> ^- (map dude @)
(~(run by yokes.state) |=(yoke sub-nonce)) %- malt %+ murn ~(tap by yokes.state)
|= [=dude =yoke]
?: ?=(%nuke -.yoke) ~ `[dude sub-nonce.yoke]
:: ::
?: ?& =(%n care) ?: ?& =(%n care)
?=([@ @ ^] path) ?=([@ @ ^] path)
=([%$ %da now] coin) =([%$ %da now] coin)
=(our ship) =(our ship)
== ==
?~ yok=(~(get by yokes.state) dap) =/ yok (~(get by yokes.state) dap)
?. ?=([~ %live *] yok)
[~ ~] [~ ~]
=/ [=^ship =term =wire] =/ [=^ship =term =wire]
[(slav %p i.path) i.t.path t.t.path] [(slav %p i.path) i.t.path t.t.path]
@ -2131,9 +2158,10 @@
=([%$ %da now] coin) =([%$ %da now] coin)
=(our ship) =(our ship)
== ==
?~ yok=(~(get by yokes.state) q.bem) ~ =/ yok (~(get by yokes.state) q.bem)
?~ ski=(~(get by sky.u.yok) s.bem) ~ ?. ?=([~ %live *] yok) [~ ~]
?~ lat=(ram:on-path fan.u.ski) ~ ?~ ski=(~(get by sky.u.yok) s.bem) [~ ~]
?~ lat=(ram:on-path fan.u.ski) [~ ~]
``case/!>(ud/key.u.lat) ``case/!>(ud/key.u.lat)
:: ::
?. =(our ship) ?. =(our ship)
@ -2156,6 +2184,7 @@
%- ~(run by yokes.state) %- ~(run by yokes.state)
|= =yoke |= =yoke
^- egg ^- egg
?: ?=(%nuke -.yoke) yoke
%= yoke %= yoke
code ~ code ~
agent agent