Merge branch 'm/vane-unversion' into m/modern-hoon

* m/vane-unversion:
  ames: remove old state versions & conversions
  gall: rename fading styles
  vanes: remove old load types and logic
  gall: refresh clay subscription on fade
  gall: add nonce to agent wires
  gall: add %doze-style fade
  gall: fade initial commit
This commit is contained in:
Joe Bryan 2020-11-30 21:04:16 -08:00
commit 072e2c8101
13 changed files with 217 additions and 933 deletions

View File

@ -0,0 +1,4 @@
:- %say
|= [^ [dap=term wake=$@(~ [%wake ~])] ~]
=/ mode ?@(wake %idle %jolt)
[%helm-pass %g %fade dap mode]

View File

@ -0,0 +1,17 @@
:: Drum: destroy app
::
:::: /hoon/fade/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=[@ $@(~ [@ ~])] ~]
==
:- %drum-fade
?> ((sane %tas) -.arg)
?@ +.arg [q.bec -.arg]
?> ((sane %tas) +<.arg)
[-.arg +<.arg]

View File

@ -0,0 +1,3 @@
:- %say
|= [^ [=note-arvo ~] ~]
[%helm-pass note-arvo]

View File

@ -182,6 +182,11 @@
=< se-abet =< se-view
(se-born & wel)
::
++ poke-fade :: fade app
|= wel/well:gall
=< se-abet =< se-view
(se-fade wel)
::
++ poke-link :: connect app
|= gyl=gill:gall
=< se-abet =< se-view
@ -210,6 +215,7 @@
%drum-put =;(f (f !<(_+<.f vase)) poke-put)
%drum-set-boot-apps =;(f (f !<(_+<.f vase)) poke-set-boot-apps)
%drum-start =;(f (f !<(_+<.f vase)) poke-start)
%drum-fade =;(f (f !<(_+<.f vase)) poke-fade)
%drum-unlink =;(f (f !<(_+<.f vase)) poke-unlink)
==
::
@ -321,7 +327,7 @@
:: :: ::
++ se-abet :: resolve
^- (quip card:agent:gall state)
=. . se-subze:se-adze:se-adit
=. . se-subze:se-adze:se-subit:se-adit
:_ sat(bin (~(put by bin) ost dev))
^- (list card:agent:gall)
?~ biz (flop moz)
@ -386,6 +392,17 @@
$(priorities t.priorities)
--
::
++ se-subit :: downdate servers
=/ ruf=(list term) ~(tap in ~(key by fur))
|- ^+ this
?~ ruf
this
?: (~(has in ray) [%home i.ruf])
$(ruf t.ruf)
=/ wire [%drum %fade i.ruf ~]
=. this (se-emit %pass wire %arvo %g %fade i.ruf %slay)
$(ruf t.ruf, fur (~(del by fur) i.ruf))
::
++ se-adze :: update connections
^+ .
%+ roll
@ -481,6 +498,15 @@
eel (~(put in eel) [our.hid q.wel])
==
::
++ se-fade :: delete server
|= wel=well:gall
^+ +>
?. (~(has in ray) wel)
(se-text "[fade not running {<p.wel>}/{<q.wel>}]")
%= +>
ray (~(del in ray) wel)
==
::
++ se-drop :: disconnect
|= [pej=? gyl=gill:gall]
^+ +>

View File

@ -108,6 +108,10 @@
|= ~ =< abet
(emit %pass /pack %arvo %d %flog %pack ~)
::
++ poke-pass
|= =note-arvo =< abet
(emit %pass /helm/pass %arvo note-arvo)
::
++ take-wake-automass
|= [way=wire error=(unit tang)]
?^ error
@ -247,6 +251,7 @@
%helm-meld =;(f (f !<(_+<.f vase)) poke-meld)
%helm-moon =;(f (f !<(_+<.f vase)) poke-moon)
%helm-pack =;(f (f !<(_+<.f vase)) poke-pack)
%helm-pass =;(f (f !<(_+<.f vase)) poke-pass)
%helm-rekey =;(f (f !<(_+<.f vase)) poke-rekey)
%helm-reload =;(f (f !<(_+<.f vase)) poke-reload)
%helm-reload-desk =;(f (f !<(_+<.f vase)) poke-reload-desk)
@ -276,5 +281,6 @@
?>(?=(%wake +<.sign-arvo) +>.sign-arvo)
[%serv *] %+ take-bound t.wire
?>(?=(%bound +<.sign-arvo) +>.sign-arvo)
[%pass *] abet
==
--

View File

@ -364,58 +364,6 @@
$% [%memo =message-num message=*]
[%send =message-num =ack-meat]
==
:: previous state versions, for +stay/+load migrations
::
+| %plasmonics
::
+$ ames-state-2
$: peers=(map ship ship-state)
=unix=duct
=life
crypto-core=acru:ames
veb=_veb-all-off
==
::
+$ queued-event-1
$% [%call =duct type=* wrapped-task=(hobo task-1)]
[%take =wire =duct type=* =sign]
==
::
+$ task-1
$% [%wegh ~]
task
==
::
+$ ames-state-1
$: peers=(map ship ship-state-1)
=unix=duct
=life
crypto-core=acru:ames
==
+$ ship-state-1
$% [%alien alien-agenda]
[%known peer-state-1]
==
+$ peer-state-1
$: $: =symmetric-key
=life
=public-key
sponsor=ship
==
route=(unit [direct=? =lane])
qos=qos-1
=ossuary
snd=(map bone message-pump-state)
rcv=(map bone message-sink-state)
nax=(set [=bone =message-num])
heeds=(set duct)
==
+$ qos-1
$~ [%unborn ~]
$% [%live last-contact=@da]
[%dead last-contact=@da]
[%unborn ~]
==
--
:: external vane interface
::
@ -533,7 +481,6 @@
++ scry scry:adult-core
++ stay [%4 %larva queued-events ames-state.adult-gate]
++ load
|^
|= $= old
$% $: %4
$% $: %larva
@ -542,70 +489,16 @@
==
[%adult state=_ames-state.adult-gate]
== ==
::
$: %3
$% $: %larva
events=(qeu queued-event-1)
state=_ames-state.adult-gate
==
[%adult state=_ames-state.adult-gate]
== ==
::
$: %2
$% [%larva events=(qeu queued-event-1) state=ames-state-2]
[%adult state=ames-state-2]
== ==
::
$% [%larva events=(qeu queued-event-1) state=ames-state-1]
[%adult state=ames-state-1]
== ==
==
?- old
[%4 %adult *] (load:adult-core %4 state.old)
[%3 %adult *] (load:adult-core %3 state.old)
[%2 %adult *] (load:adult-core %2 state.old)
[%adult *] (load:adult-core %1 state.old)
::
[%4 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. queued-events events.old
=. adult-gate (load:adult-core %4 state.old)
larval-gate
::
[%3 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. queued-events (queued-events-1-to-4 events.old)
=. adult-gate (load:adult-core %3 state.old)
larval-gate
::
[%2 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. queued-events (queued-events-1-to-4 events.old)
=. adult-gate (load:adult-core %2 state.old)
larval-gate
::
[%larva *]
~> %slog.0^leaf/"ames: larva: load"
=. queued-events (queued-events-1-to-4 events.old)
=. adult-gate (load:adult-core %1 state.old)
larval-gate
==
::
++ queued-events-1-to-4
|= events=(qeu queued-event-1)
^- (qeu queued-event)
%- ~(gas to *(qeu queued-event))
^- (list queued-event)
%+ murn ~(tap to events)
|= e=queued-event-1
^- (unit queued-event)
?. ?=(%call -.e)
`e
?: ?=([%wegh ~] wrapped-task.e)
~
?: ?=([%soft %wegh ~] wrapped-task.e)
~
`e
--
--
:: adult ames, after metamorphosis from larva
::
@ -685,59 +578,9 @@
:: +load: load in old state after reload
::
++ load
|= $= old-state
$% [%1 ames-state-1]
[%2 ames-state-2]
[%3 ^ames-state]
[%4 ^ames-state]
==
|^ ^+ ames-gate
::
=? old-state ?=(%1 -.old-state) %2^(state-1-to-2 +.old-state)
=? old-state ?=(%2 -.old-state) %3^(state-2-to-3 +.old-state)
=? old-state ?=(%3 -.old-state) %4^+.old-state
::
?> ?=(%4 -.old-state)
ames-gate(ames-state +.old-state)
::
++ state-1-to-2
|= =ames-state-1
^- ames-state-2
::
=| =ames-state-2
=. +.ames-state-2
:* unix-duct.ames-state-1
life.ames-state-1
crypto-core.ames-state-1
veb=veb-all-off
==
=. peers.ames-state-2
%- ~(gas by *(map ship ship-state))
%+ turn ~(tap by peers.ames-state-1)
|= [peer=ship =ship-state-1]
^- [ship ship-state]
?: ?=(%alien -.ship-state-1)
[peer ship-state-1]
:+ peer %known
%= +.ship-state-1
qos
?+ -.qos.ship-state-1 qos.ship-state-1
%unborn [%unborn now]
==
==
ames-state-2
::
++ state-2-to-3
|= =ames-state-2
^- ^ames-state
::
:* peers.ames-state-2
unix-duct.ames-state-2
life.ames-state-2
crypto-core.ames-state-2
bug=[veb=veb.ames-state-2 ships=~]
==
--
|= old-state=[%4 ^ames-state]
^+ ames-gate
ames-gate(ames-state +.old-state)
:: +scry: dereference namespace
::
++ scry

View File

@ -296,80 +296,9 @@
:: +load: migrate an old state to a new behn version
::
++ load
|^
|= old=state
|= old=behn-state
^+ behn-gate
=? old ?=(^ -.old)
(ket-to-1 old)
=? old ?=(~ -.old)
(load-0-to-1 old)
=? old ?=(%1 -.old)
(load-1-to-2 old)
?> ?=(%2 -.old)
behn-gate(state old)
::
++ state
$^ behn-state-ket
$% behn-state-0
behn-state-1
behn-state
==
::
++ load-1-to-2
|= old=behn-state-1
^- behn-state
=; new-timers old(- %2, timers new-timers)
=/ timers=(list timer) ~(tap in ~(key by timers.old))
%+ roll timers
|= [t=timer acc=(tree [@da (qeu duct)])]
^+ acc
=| mock=behn-state
=. timers.mock acc
=/ event-core (per-event *[@p @da duct] mock)
(set-timer:event-core t)
::
++ timer-map-1
%- (ordered-map ,timer ,~)
|= [a=timer b=timer]
(lth date.a date.b)
::
+$ behn-state-1
$: %1
timers=(tree [timer ~])
unix-duct=duct
next-wake=(unit @da)
drips=drip-manager
==
::
+$ behn-state-0
$: ~
unix-duct=duct
next-wake=(unit @da)
drips=drip-manager
==
::
+$ behn-state-ket
$: timers=(list timer)
unix-duct=duct
next-wake=(unit @da)
drips=drip-manager
==
::
++ ket-to-1
|= old=behn-state-ket
^- behn-state-1
:- %1
%= old
timers
%+ gas:timer-map-1 *(tree [timer ~])
(turn timers.old |=(=timer [timer ~]))
==
::
++ load-0-to-1
|= old=behn-state-0
^- behn-state-1
[%1 old]
--
:: +scry: view timer state
::
:: TODO: not referentially transparent w.r.t. elapsed timers,

View File

@ -167,7 +167,6 @@
hez=(unit duct) :: sync duct
cez=(map @ta crew) :: permission groups
pud=(unit [=desk =yoki]) :: pending update
pun=(list move) :: upgrade moves
== ::
::
:: Object store.
@ -1759,7 +1758,7 @@
=/ additions=(set path) (~(dif in upsert-set) old-set)
?~ hun
~
?: =(0 let.dom)
?: (lte let.dom 1)
~
|^
;: weld
@ -1776,7 +1775,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
@ -3959,7 +3958,7 @@
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=| :: instrument state
$: ver=%5 :: vane version
$: ver=%6 :: vane version
ruf=raft :: revision tree
== ::
|= [our=ship now=@da eny=@uvJ rof=roof] :: current invocation
@ -4162,7 +4161,7 @@
=^ moves-1 ..^^$ $(desks t.desks)
=^ moves-2 ruf abet:wake:((de our now ski hen ruf) [ship desk]:i.desks)
[(weld moves-1 moves-2) ..^^$]
[(welp wake-moves pun.ruf) ..^$(pun.ruf ~)]
[wake-moves ..^$]
::
?(%warp %werp)
:: capture whether this read is on behalf of another ship
@ -4208,331 +4207,8 @@
==
::
++ load
!:
|^
|= old=any-state
~! [old=old new=*state-4]
=? old ?=(%2 -.old) (load-2-to-3 old)
=? old ?=(%3 -.old) (load-3-to-4 old)
=? old ?=(%4 -.old) (load-4-to-5 old)
?> ?=(%5 -.old)
..^^$(ruf +.old)
::
++ load-4-to-5
|= =state-4
^- state-5
state-4(- %5, pun ~)
::
++ load-3-to-4
|= =state-3
^- state-4
|^
=- state-3(- %4, hoy hoy.-, rom (room-3-to-4 rom.state-3))
^- hoy=(map ship rung)
%- ~(run by hoy.state-3)
|= =rung-3
^- rung
%- ~(run by rus.rung-3)
|= =rede-3
^- rede
=- rede-3(ref ref.-, qyx (cult-3-to-4 qyx.rede-3))
^- ref=(unit rind)
?~ ref.rede-3
~
=- `u.ref.rede-3(bom bom.-)
^- bom=(map @ud update-state)
%- ~(run by bom.u.ref.rede-3)
|= [=duct =rave]
^- update-state
[duct rave ~ ~ ~ |]
::
++ room-3-to-4
|= =room-3
^- room
=- room-3(dos dos.-)
^- dos=(map desk dojo)
%- ~(run by dos.room-3)
|= =dojo-3
^- dojo
dojo-3(qyx (cult-3-to-4 qyx.dojo-3))
::
++ cult-3-to-4
|= =cult-3
^- cult
%- malt
%+ turn ~(tap by cult-3)
|= [=wove-3 ducts=(set duct)]
^- [wove (set duct)]
:_ ducts :_ rove.wove-3
?~ for.wove-3
~
`[u.for.wove-3 %0]
--
::
++ load-2-to-3
|= =state-2
^- state-3
|^
=- state-2(- %3, rom rom.-, hoy hoy.-, |7 [pud=~ pun.-])
:+ ^- pun=(list move)
%+ welp
?~ act.state-2
~
?. =(%merge -.eval-data.u.act.state-2)
~
=/ err
:- %ford-fusion
[leaf+"active merge canceled due to upgrade to ford fusion" ~]
[hen.u.act.state-2 %slip %b %drip !>([%mere %| err])]~
^- (list move)
%+ murn ~(tap to cue.state-2)
:: use ^ so we don't have to track definition of +task
::
|= [=duct task=^]
^- (unit move)
?. =(%merg -.task)
~& "queued clay write canceled due to upgrade to ford fusion:"
~& [duct [- +<]:task]
~
=/ err
:- %ford-fusion
[leaf+"queued merge canceled due to upgrade to ford fusion" ~]
`[duct %slip %b %drip !>([%mere %| err])]
^- rom=room-3
:- hun.rom.state-2
%- ~(urn by dos.rom.state-2)
|= [=desk =dojo-2]
^- dojo-3
=- dojo-2(dom -)
^- dome
=/ fer=(unit reef-cache)
?~ let.dom.dojo-2
~
=/ =yaki
(~(got by hut.ran.state-2) (~(got by hit.dom.dojo-2) let.dom.dojo-2))
`(build-reef desk q.yaki)
[ank let hit lab mim fod=*ford-cache fer=fer]:[dom.dojo-2 .]
^- hoy=(map ship rung-3)
%- ~(run by hoy.state-2)
|= =rung-2
^- rung-3
%- ~(run by rus.rung-2)
|= =rede-2
^- rede-3
=- rede-2(ref ref.-, dom dom.-)
:- ^- dom=dome
[ank let hit lab mim fod=*ford-cache fer=~]:[dom.rede-2 .]
^- ref=(unit rind-3)
?~ ref.rede-2
~
:- ~
^- rind-3
=/ rin=rind-3 [nix bom fod haw]:u.ref.rede-2
=. rin
=/ pur=(list [inx=@ud =rand *]) ~(tap by pur.u.ref.rede-2)
|- ^+ rin
?~ pur rin
=/ =mood [p.p q.p q]:rand.i.pur
=: haw.rin (~(put by haw.rin) mood ~)
bom.rin (~(del by bom.rin) inx.i.pur)
fod.rin ?~ got=(~(get by bom.rin) inx.i.pur)
fod.rin
(~(del by fod.rin) p.u.got)
==
$(pur t.pur)
=/ pud ~(tap to waiting.pud.u.ref.rede-2)
|- ^+ rin
?~ pud rin
=: bom.rin (~(del by bom.rin) inx.i.pud)
fod.rin ?~ got=(~(get by bom.rin) inx.i.pud)
fod.rin
(~(del by fod.rin) p.u.got)
==
$(pud t.pud)
::
++ build-reef
|= [=desk data=(map path lobe)]
^- reef-cache
~> %slog.0^leaf+"clay: building reef on {<desk>}"
?: =(%home desk)
[!>(..ride) !>(..is) !>(..zuse)]
|^
=/ [home=? hoon=vase]
?: (same-as-home /sys/hoon/hoon)
&+!>(..ride)
|+build-hoon
:- hoon
=/ [home=? arvo=vase]
?: &(home (same-as-home /sys/arvo/hoon))
&+!>(..is)
|+(build-arvo hoon)
:- arvo
?: &(home (same-as-home /sys/zuse/hoon))
!>(..zuse)
(build-zuse arvo)
::
++ build-hoon
%- road |.
~> %slog.0^leaf+"clay: building hoon on {<desk>}"
=/ gen
~> %mean.%hoon-parse-fail
%+ rain /sys/hoon/hoon
(lobe-to-cord (~(got by data) /sys/hoon/hoon))
~> %mean.%hoon-compile-fail
(slot 7 (slap !>(0) gen))
::
++ build-arvo
|= hoon=vase
%- road |.
~> %slog.0^leaf+"clay: building arvo on {<desk>}"
=/ gen
~> %mean.%arvo-parse-fail
%+ rain /sys/arvo/hoon
(lobe-to-cord (~(got by data) /sys/arvo/hoon))
~> %mean.%arvo-compile-fail
(slap (slap hoon gen) !,(*^hoon ..is))
::
++ build-zuse
|= arvo=vase
%- road |.
~> %slog.0^leaf+"clay: building zuse on {<desk>}"
=/ gen
~> %mean.%zuse-parse-fail
%+ rain /sys/zuse/hoon
(lobe-to-cord (~(got by data) /sys/zuse/hoon))
~> %mean.%zuse-compile-fail
(slap arvo gen)
::
++ same-as-home
|= =path
^- ?
=/ our-lobe=lobe (~(got by data) path)
=/ =dome-2 dom:(~(got by dos.rom.state-2) %home)
=/ =yaki (~(got by hut.ran.state-2) (~(got by hit.dome-2) let.dome-2))
=(`our-lobe (~(get by q.yaki) path))
::
++ lobe-to-cord
|= =lobe
^- @t
=- ?:(?=(%& -<) p.- (of-wain:format p.-))
|- ^- (each @t wain)
=/ =blob (~(got by lat.ran.state-2) lobe)
?- -.blob
%direct [%& ;;(@t q.q.blob)]
%delta
:- %|
%+ lurk:differ
=- ?:(?=(%| -<) p.- (to-wain:format p.-))
$(lobe q.q.blob)
~| diff=r.blob
;;((urge cord) q.r.blob)
==
--
--
::
+$ any-state $%(state-5 state-4 state-3 state-2)
+$ state-5 [%5 raft]
+$ state-4
$: %4
rom=room
hoy=(map ship rung)
ran=rang
mon=(map term beam)
hez=(unit duct)
cez=(map @ta crew)
pud=(unit [=desk =yoki])
pun=(list *)
==
+$ state-3
$: %3
rom=room-3
hoy=(map ship rung-3)
ran=rang
mon=(map term beam)
hez=(unit duct)
cez=(map @ta crew)
pud=(unit [=desk =yoki])
pun=(list *)
==
+$ rung-3 rus=(map desk rede-3)
+$ rede-3
$: lim=@da
ref=(unit rind-3)
qyx=cult-3
dom=dome
per=regs
pew=regs
==
+$ rind-3
$: nix=@ud
bom=(map @ud [p=duct q=rave])
fod=(map duct @ud)
haw=(map mood (unit cage))
==
+$ room-3
$: hun=duct
dos=(map desk dojo-3)
==
++ dojo-3
$: qyx=cult-3
dom=dome
per=regs
pew=regs
==
+$ cult-3 (jug wove-3 duct)
+$ wove-3 [for=(unit ship) =rove]
+$ state-2
$: %2
rom=room-2 :: domestic
hoy=(map ship rung-2) :: foreign
ran=rang :: hashes
mon=(map term beam) :: mount points
hez=(unit duct) :: sync duct
cez=(map @ta crew) :: permission groups
cue=(qeu [=duct task=^]) :: queued requests
act=active-write-2 :: active write
== ::
+$ room-2
$: hun=duct :: terminal duct
dos=(map desk dojo-2) :: native desk
== ::
+$ dojo-2
$: qyx=cult-3 :: subscribers
dom=dome-2 :: desk state
per=regs :: read perms per path
pew=regs :: write perms per path
==
+$ dome-2
$: ank=ankh :: state
let=aeon :: top id
hit=(map aeon tako) :: versions by id
lab=(map @tas aeon) :: labels
mim=(map path mime) :: mime cache
== ::
+$ rung-2 rus=(map desk rede-2)
+$ rede-2
$: lim=@da :: complete to
ref=(unit rind-2) :: outgoing requests
qyx=cult-3 :: subscribers
dom=dome-2 :: revision state
per=regs :: read perms per path
pew=regs :: write perms per path
== ::
+$ rind-2
$: nix=@ud :: request index
bom=(map @ud [p=duct q=rave]) :: outstanding
fod=(map duct @ud) :: current requests
haw=(map mood (unit cage)) :: simple cache
pud=update-qeu-2 :: active updates
pur=request-map-2 :: active requests
== ::
+$ request-map-2 (map inx=@ud [=rand eval-form=*])
+$ update-qeu-2
$: waiting=(qeu [inx=@ud rut=(unit rand)])
eval-data=(unit [inx=@ud rut=(unit rand) eval-form=*])
==
+$ active-write-2 (unit [hen=duct req=* eval-data=^])
--
|= old=[%6 raft]
..^$(ruf +.old)
::
++ scry :: inspect
|= [lyc=gang cyr=term bem=beam]

View File

@ -410,79 +410,8 @@
[moz ..^$]
::
++ load :: import old state
=> |%
:: without .dog
::
++ axle-1
$: %1
hey=(unit duct)
dug=(map duct axon-3)
lit=?
$= hef
$: a=(unit mass)
b=(unit mass)
c=(unit mass)
e=(unit mass)
f=(unit mass)
g=(unit mass)
i=(unit mass)
j=(unit mass)
==
$= veb
$~ (~(put by *(map @tas log-level)) %hole %soft)
(map @tas log-level)
==
::
++ axle-2
$: %2
hey=(unit duct)
dug=(map duct axon-3)
lit=?
dog=_|
$= hef
$: a=(unit mass)
b=(unit mass)
c=(unit mass)
e=(unit mass)
f=(unit mass)
g=(unit mass)
i=(unit mass)
j=(unit mass)
==
$= veb
$~ (~(put by *(map @tas log-level)) %hole %soft)
(map @tas log-level)
==
::
+$ axle-3
$: %3
hey=(unit duct)
dug=(map duct axon-3)
lit=?
$= veb
$~ (~(put by *(map @tas log-level)) %hole %soft)
(map @tas log-level)
==
+$ axon-3
$: ram=term
tem=(unit (list dill-belt))
wid=_80
pos=@ud
see=(list @c)
==
::
+$ axle-any
$%(axle-1 axle-2 axle-3 axle)
--
::
|= old=axle-any
?- -.old
%1 $(old [%2 [hey dug lit dog=& hef veb]:old])
%2 $(old [%3 [hey dug lit veb]:old])
%3 =- $(old [%4 hey.old - ~ lit.old veb.old])
(~(run by dug.old) |=(a=axon-3 a(see lin+see.a)))
%4 ..^$(all old)
==
|= old=axle
..^$(all old)
::
++ scry
|= [lyc=gang cyr=term bem=beam]

View File

@ -2507,113 +2507,9 @@
:: +load: migrate old state to new state (called on vane reload)
::
++ load
=> |%
+$ axle-2020-9-30
[date=%~2020.9.30 server-state=server-state-2020-9-30]
::
+$ server-state-2020-9-30
$: bindings=(list [=binding =duct =action])
=cors-registry
connections=(map duct outstanding-connection)
=authentication-state
channel-state=channel-state-2020-9-30
domains=(set turf)
=http-config
ports=[insecure=@ud secure=(unit @ud)]
outgoing-duct=duct
==
::
+$ channel-state-2020-9-30
$: session=(map @t channel-2020-9-30)
duct-to-key=(map duct @t)
==
::
+$ channel-2020-9-30
$: state=(each timer duct)
next-id=@ud
events=(qeu [id=@ud lines=wall])
subscriptions=(map wire [ship=@p app=term =path duc=duct])
heartbeat=(unit timer)
==
::
+$ axle-2020-5-29
[date=%~2020.5.29 server-state=server-state-2020-5-29]
::
+$ server-state-2020-5-29
$: bindings=(list [=binding =duct =action])
connections=(map duct outstanding-connection)
=authentication-state
channel-state=channel-state-2020-9-30
domains=(set turf)
=http-config
ports=[insecure=@ud secure=(unit @ud)]
outgoing-duct=duct
==
+$ axle-2019-10-6
[date=%~2019.10.6 server-state=server-state-2019-10-6]
::
+$ server-state-2019-10-6
$: bindings=(list [=binding =duct =action])
connections=(map duct outstanding-connection)
authentication-state=sessions=(map @uv @da)
channel-state=channel-state-2020-9-30
domains=(set turf)
=http-config
ports=[insecure=@ud secure=(unit @ud)]
outgoing-duct=duct
==
--
|= old=$%(axle axle-2019-10-6 axle-2020-5-29 axle-2020-9-30)
|= old=axle
^+ ..^$
::
~! %loading
?- -.old
%~2020.10.18 ..^$(ax old)
::
%~2020.9.30
%_ $
date.old %~2020.10.18
::
::NOTE soft-breaks the reconnect case, but is generally less disruptive
:: than wiping channels entirely.
session.channel-state.server-state.old
%- ~(run by session.channel-state.server-state.old)
|= channel-2020-9-30
^- channel
=/ subscriptions
%- ~(gas by *(map @ud [@p term path duct]))
%+ turn ~(tap by subscriptions)
|= [=wire rest=[@p term path duct]]
[(slav %ud (snag 3 wire)) rest]
:* state next-id now
*(qeu [@ud @ud channel-event])
*(map @ud @ud)
subscriptions heartbeat
==
==
::
%~2020.5.29
%_ $
date.old %~2020.9.30
server-state.old [-.server-state.old *cors-registry +.server-state.old]
==
::
%~2019.10.6
=^ success bindings.server-state.old
%+ insert-binding
[[~ /~/logout] [/e/load/logout]~ [%logout ~]]
bindings.server-state.old
~? !success [%e %failed-to-setup-logout-endpoint]
=^ success bindings.server-state.old
%+ insert-binding
[[~ /~/scry] [/e/load/scry]~ [%scry ~]]
bindings.server-state.old
~? !success [%e %failed-to-setup-scry-endpoint]
%_ $
date.old %~2020.5.29
sessions.authentication-state.server-state.old ~
==
==
..^$(ax old)
:: +stay: produce current state
::
++ stay `axle`ax

View File

@ -1,4 +1,4 @@
:: :: %gall, agent execution
!: :: %gall, agent execution
!? 163
::
::::
@ -53,16 +53,17 @@
::
+$ yoke
$: control-duct=duct
nonce=@t
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,10 +127,11 @@
::
+$ egg
$: control-duct=duct
nonce=@t
live=?
=stats
=watches
old-state=vase
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
@ -170,9 +172,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)
?^ tan
(mean u.tan)
=? 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))
@ -221,119 +225,14 @@
(molt duct `[duct %pass wire %b %huck sign])
::
++ load
|^
|= old=all-state
=. spore (upgrade old)
|= old=^spore
=. spore old
?. =(~ eggs.spore)
pupal-gate
~> %slog.[0 leaf+"gall: direct morphogenesis"]
%_ adult-gate
state [- +>]:spore(eggs *(map term yoke))
==
::
++ upgrade
|= =all-state
^- spore-7
::
=? all-state ?=(%0 -.all-state)
(state-0-to-1 all-state)
::
=? all-state ?=(%1 -.all-state)
(state-1-to-2 all-state)
::
=? all-state ?=(%2 -.all-state)
(state-2-to-3 all-state)
::
=? all-state ?=(%3 -.all-state)
(state-3-to-4 all-state)
::
=? all-state ?=(%4 -.all-state)
(state-4-to-5 all-state)
::
=? all-state ?=(%5 -.all-state)
(state-5-to-spore-6 all-state)
::
=? all-state ?=(%6 -.all-state)
(spore-6-to-7 all-state)
::
?> ?=(%7 -.all-state)
all-state
:: +all-state: upgrade path
::
+$ all-state
$% state-0 state-1 state-2 state-3 state-4 state-5
spore-6 spore-7
==
::
++ spore-6-to-7 |=(s=spore-6 `spore-7`[%7 & +.s])
::
++ state-5-to-spore-6
|= s=state-5
^- spore-6
%= s
- %6
outstanding ~ :: TODO: do we need to process these somehow?
running
(~(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 ~))
++ state-3-to-4 |=(s=state-3 `state-4`s(- %4, outstanding ~))
++ state-2-to-3 |=(s=state-2 `state-3`s(- %3))
++ state-1-to-2 |=(s=state-1 `state-2`s(- %2, +< +<.s, +> `+>.s))
++ state-0-to-1 |=(s=state-0 `state-1`s(- %1))
::
+$ spore-7 ^spore
+$ spore-6 [%6 _+>:*spore-7]
+$ state-5 [%5 agents-2]
+$ state-4 [%4 agents-2]
+$ state-3 [%3 agents-2]
+$ state-2 [%2 agents-2]
+$ state-1 [%1 agents-0]
+$ state-0 [%0 agents-0]
::
+$ agents-2
$: system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
running=(map term yoke-0)
blocked=(map term (qeu blocked-move))
==
::
+$ agents-0
$: system-duct=duct
contacts=(set ship)
running=(map term yoke-0)
blocked=(map term (qeu blocked-move))
==
::
+$ yoke-0
$: cache=worm
control-duct=duct
live=?
=stats
=watches
agent=any-agent
=beak
marks=(map duct mark)
==
::
++ any-agent
$_
^|
|_ bowl
++ on-init **
++ on-save *vase
++ on-load **
++ on-poke **
++ on-watch **
++ on-leave **
++ on-peek **
++ on-agent **
++ on-arvo **
++ on-fail **
--
--
--
:: adult gall vane interface, for type compatibility with pupa
::
@ -424,12 +323,17 @@
=/ =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)
%* . *yoke
control-duct hen
beak bek
agent &+agent
nonce (scot %uw (end 5 1 (shas %yoke-nonce eny)))
==
::
=/ old mo-core
=/ wag
@ -466,10 +370,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
@ -793,26 +699,45 @@
|= [=path =sign-arvo]
^+ mo-core
::
?. ?=([@ @ *] path)
?. ?=([@ @ @ *] path)
~& [%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
?. =(nonce.u.yoke i.t.path)
%- (slog leaf+"gall: got old {<+<.sign-arvo>} for {<dap>}" ~)
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)
=/ =ship (slav %p i.t.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)
=. app (ap-generic-take:app t.t.t.path sign-arvo)
ap-abet:app
?> ?=([%out @ @ *] t.t.path)
=/ =ship (slav %p i.t.t.t.path)
=/ =routes [disclosing=~ attributing=ship]
=/ =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)
?: ?=(%| -.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
@ -830,10 +755,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.
@ -859,6 +788,22 @@
=? new-blocked !=(ship attributing.routes.mov)
(~(put to new-blocked) mov)
$
:: +mo-fade: put app to sleep
::
++ mo-fade
|= [dap=term style=?(%slay %idle %jolt)]
^+ mo-core
=/ =routes [disclosing=~ attributing=our]
=/ app (ap-abed:ap dap routes)
=. mo-core ap-abet:(ap-fade:app style)
=. mo-core
?- style
%slay mo-core(yokes.state (~(del by yokes.state) dap))
%idle mo-core
%jolt (mo-boot dap our %home)
==
=? mo-core !?=(%jolt style) (mo-subscribe-to-agent-builds now)
mo-core
:: +mo-beak: assemble a beak for the specified agent.
::
++ mo-beak
@ -938,22 +883,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>}" ~)
@ -1044,10 +990,13 @@
++ ap-abut
|= [dap=term =egg]
^+ ap-core
=/ res (mo-scry-agent-cage dap da+now)
?: ?=(%| -.res)
(mean p.res)
=/ =yoke egg(old-state `agent`p.res)
=/ =yoke
?: ?=(%| -.old-state.egg)
egg
=/ res (mo-scry-agent-cage dap da+now)
?: ?=(%| -.res)
(mean 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
@ -1079,6 +1028,38 @@
yokes.state running
moves moves
==
:: +ap-fade: put affairs in order.
::
:: For %gone, remove all incoming and outgoing subscriptions.
::
++ ap-fade
|= style=?(%slay %idle %jolt)
^+ ap-core
?- style
%jolt ap-core
%idle
=. agent.current-agent |+on-save:ap-agent-core
ap-core
::
%slay
=/ out=(list [[=wire =ship =term] ? =path])
~(tap by outbound.watches.current-agent)
=/ inbound-paths=(set path)
%- silt
%+ turn ~(tap by inbound.watches.current-agent)
|= [=duct =ship =path]
path
=/ will=(list card:agent:gall)
%+ welp
?: =(~ inbound-paths)
~
[%give %kick ~(tap in inbound-paths) ~]~
%+ 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]))
ap-core
==
:: +ap-from-internal: internal move to move.
::
:: We convert from cards to duct-indexed moves when resolving
@ -1145,13 +1126,9 @@
=/ =neat q.card
=. wire
?: ?=(%agent -.neat)
:: remove `our` in next breach after 2019/12 and reflect in
:: +mo-handle-use (non-unto case)
::
:- (scot %p our)
[%out (scot %p ship.neat) name.neat wire]
[(scot %p attributing.agent-routes) wire]
=. wire [%use agent-name wire]
=. wire [%use agent-name nonce.current-agent wire]
=/ =note-arvo
?- -.neat
%arvo note-arvo.neat
@ -1208,7 +1185,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
@ -1342,9 +1320,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)
@ -1611,7 +1592,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)
@ -1716,6 +1697,7 @@
mo-abet
::
%sear mo-abet:(mo-filter-queue:mo-core ship.task)
%fade mo-abet:(mo-fade:mo-core dap.task style.task)
%trim [~ gall-payload]
%vega [~ gall-payload]
==
@ -1776,7 +1758,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

@ -35,37 +35,11 @@
:: manage subscriptions efficiently.
::
=> |%
+$ any-state $%(state-0 state-1)
::
+$ state-0
$: %0
pki=state-pki-0 ::
etn=state-eth-node :: eth connection state
== ::
+$ state-1
$: %1
pki=state-pki-1 ::
etn=state-eth-node :: eth connection state
== ::
+$ state-pki-0 :: urbit metadata
$: $= own :: vault (vein)
$: yen=(set duct) :: trackers
sig=(unit oath) :: for a moon
tuf=(list turf) :: domains
boq=@ud :: boot block
nod=purl:eyre :: eth gateway
fak=_| :: fake keys
lyf=life :: version
jaw=(map life ring) :: private keys
== ::
$= zim :: public
$: yen=(jug duct ship) :: trackers
ney=(jug ship duct) :: reverse trackers
nel=(set duct) :: trackers of all
dns=dnses :: on-chain dns state
pos=(map ship point) :: on-chain ship state
== ::
== ::
+$ state-pki-1 :: urbit metadata
$: $= own :: vault (vein)
$: yen=(set duct) :: trackers
@ -1030,18 +1004,9 @@
[did ..^$]
:: :: ++load
++ load :: upgrade
|= $: :: old: previous state
::
:: old/*
old=any-state
==
|= old=state-1
^+ ..^$
=/ new=state-1
?- -.old
%0 old(- %1, |7.own.pki [step=0 |7.own.pki.old])
%1 old
==
..^$(lex new)
..^$(lex old)
:: :: ++scry
++ scry :: inspect
|= [lyc=gang cyr=term bem=beam]

View File

@ -1717,6 +1717,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=?(%slay %idle %jolt)] :: put app to sleep
$>(%init vane-task) :: set owner
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade