kiln: first stab at ota inside +vats
::
++ reset
^+ vats
+ ~> %slog.0^leaf/"kiln: resetting tracking for {here}"
=. ark (~(del by ark) loc)
(install loc [ship desk]:rak)
:: +bump: handle kernel kelvin upgrade
~> %slog.0^leaf/"kiln: desks blocked upgrade {<ded>}"
!!
=/ liv (skip ~(tap by ark) |=([d=desk *] (~(has in except) d)))
+ ~> %slog.0^leaf/"kiln: bump {<liv>}"
=< kiln
|- ^+ vats
?~ liv vats
reset
~> %slog.0^leaf/"kiln: finished downloading update for {here}"
=. aeon.rak +(aeon.rak)
+ ::
+ ?. =(%base loc)
=/ kel (get-kelvin (get-ankh u.p.syn))
?. =(kel [%zuse zuse])
~> %slog.0^leaf/"kiln: future version {<kel>}, enqueueing"
- =. next.rak :_(next.rak [(dec aeon.rak) kel])
+ =. next.rak (snoc next.rak [(dec aeon.rak) kel])
(emit sync:pass)
~> %slog.0^leaf/"kiln: merging into {here}"
(emil ~[merge sync]:pass)
::
+ =/ old-ankh ank:.^(dome cv+/(scot %p our)/base/(scot %da now))
+ =/ old-weft (get-kelvin old-ankh)
+ ::
+ =/ new-ankh (get-ankh u.p.syn)
+ =/ new-weft (get-kelvin new-ankh)
+ ::
+ =/ blockers
+ ?: =(new-weft old-weft)
+ ~
+ (get-blockers new-weft)
+ ::
+ ?. =(~ blockers)
+ ~> %slog.0^leaf/"kiln: OTA blocked on {<blockers>}"
+ =- (emil sync:pass - ~)
+ :* %give %fact [/vats]~ %kiln-vats-diff
+ !>([%blocked arak=rak weft=new-weft blockers=blockers])
+ ==
+ ~> %slog.0^leaf/"kiln: applying OTA to {here}"
+ (emil ~[merge sync]:pass)
+ ::
++ take-merge
|= syn=sign-arvo
?> ?=(%mere +<.syn)
=+ "kiln: merge into {here} failed, waiting for next revision"
%- (slog leaf/- p.p.syn)
vats
+ =. vats
~> %slog.0^leaf/"merge into {here} succeeded; reviving agents"
%- emil
%+ turn (get-apps loc)
|= =dude:gall
[%pass /kiln/fade/[dude] %arvo %g %fade dude %jolt]
+ ?. =(%base loc)
+ vats
+ vats(kiln (bump (sy %base ~)))
--
:: +get-ankh: extract $ankh from clay %v response $rant
::
