kiln: get updates into %home, remove %base

We need to get updates directly into %home in case the marks depend on
changes to hoon.hoon.  %base has no reason to exist.

Our ota strategy is now to merge from parent/kids to home, then
parent/kids to kids.
This commit is contained in:
Philip Monk 2020-05-21 23:05:42 -07:00
parent 13f6b84b76
commit 4aff4d74e2
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
13 changed files with 265 additions and 38 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae3add505f1c37c3d10f2781bca3c9fc5032c11c9b9b8a6218d4301e462d4ccc
size 16089760
oid sha256:4bd63360c1b2fab69a35f71d360db6b9c71a796965d1826f919cf271e990bad2
size 15816973

View File

@ -387,7 +387,7 @@
%g %gall
==
=/ pax
/(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane]
/(scot %p our.hid)/work/(scot %da now.hid)/sys/vane/[vane]
=/ txt .^(@ %cx (weld pax /hoon))
[/vane/[vane] [%veer v pax txt]]
=> .(this ^+(this this))
@ -401,7 +401,7 @@
:_ ~
%- unix-event
%- %*(. file-ovum:pill-lib directories slim-dirs)
/(scot %p our.hid)/home/(scot %da now.hid)
/(scot %p our.hid)/work/(scot %da now.hid)
=^ ms all-state (poke-pill pil)
(emit-cards ms)
::

View File

@ -0,0 +1,14 @@
:: Kiln: Continuously merge local desk from (optionally-)foreign one
::
:::: /hoon/ota/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=?(~ [her=@p sud=@tas ~]) ~]
==
:- %kiln-ota
?~(arg ~ `[her sud]:arg)

View File

@ -1,3 +1,3 @@
:- %say
|= *
|= [^ ~ ~]
[%spider-kill ~]

View File

@ -7,7 +7,7 @@
:- %noun
=<
:~
[%base-hash .^(@uv %cz (pathify ~.base ~))]
[%kids-hash .^(@uv %cz (pathify ~.kids ~))]
[%home-hash .^(@uv %cz (pathify ~.home ~))]
::
(info %our our)

View File

@ -11,14 +11,10 @@
|% :: ::
++ part {$kiln $0 pith} :: kiln state
++ pith :: ::
$: rem/(map desk per-desk) ::
syn/(map kiln-sync let/@ud) ::
autoload-on/? ::
cur-hoon/@uvI ::
cur-arvo/@uvI ::
cur-zuse/@uvI ::
cur-vanes/(map @tas @uvI) ::
commit-timer/{way/wire nex/@da tim/@dr mon=term}
$: rem=(map desk per-desk) ::
syn=(map kiln-sync let/@ud) ::
ota=(unit [=ship =desk =aeon]) ::
commit-timer=[way=wire nex=@da tim=@dr mon=term]
== ::
++ per-desk :: per-desk state
$: auto/? :: escalate on failure
@ -127,6 +123,168 @@
abet:(spam (render "already tracking" [sud her syd]:hos) ~)
abet:abet:start-track:(auto hos)
::
++ update
|%
++ make-wire
|= =path
?> ?=(^ ota)
%- welp
:_ path
/kiln/ota/(scot %p ship.u.ota)/[desk.u.ota]/(scot %ud aeon.u.ota)
::
++ check-ota
|= =wire
?~ ota
|
~! ota=ota
?& ?=([@ @ @ *] wire)
=(i.wire (scot %p ship.u.ota))
=(i.t.wire desk.u.ota)
=(i.t.t.wire (scot %ud aeon.u.ota))
==
::
++ render
|= [mez=tape error=(unit (pair term tang))]
%+ spam
?~ ota
leaf+mez
:^ %palm [" " ~ ~ ~] leaf+(weld "kiln: " mez)
~[leaf+"from {<desk.u.ota>}" leaf+"on {<ship.u.ota>}"]
?~ error
~
[>p.u.error< q.u.error]
::
++ render-ket
|= [mez=tape error=(unit (pair term tang))]
?> ?=(^ ota)
=< ?>(?=(^ ota) .)
%+ spam
:^ %palm [" " ~ ~ ~] leaf+(weld "kiln: " mez)
~[leaf+"from {<desk.u.ota>}" leaf+"on {<ship.u.ota>}"]
?~ error
~
[>p.u.error< q.u.error]
::
++ poke
|= arg=(unit [=ship =desk])
abet:(poke-internal arg)
::
++ poke-internal
|= arg=(unit [=ship =desk])
^+ ..abet
=? ..abet =(arg (bind ota |=([=ship =desk =aeon] [ship desk])))
(render "restarting OTA sync" ~)
=? ..abet ?=(^ ota)
=. ..abet (render-ket "cancelling OTA sync" ~)
..abet(ota ~)
?~ arg
..abet
=. ota `[ship.u.arg desk.u.arg *aeon]
=. ..abet (render "starting OTA sync" ~)
%: emit
%pass (make-wire /find) %arvo %c
%warp ship.u.arg desk.u.arg `[%sing %y ud+1 /]
==
::
++ take
|= [=wire =sign-arvo]
^+ ..abet
?> ?=(^ ota)
?. (check-ota wire)
..abet
?. ?=([@ @ @ @ *] wire)
..abet
?+ i.t.t.t.wire ~&([%strange-ota-take t.t.t.wire] ..abet)
%find (take-find sign-arvo)
%sync (take-sync sign-arvo)
%merge-home (take-merge-home sign-arvo)
%merge-kids (take-merge-kids sign-arvo)
==
::
++ take-find
|= =sign-arvo
?> ?=(%writ +<.sign-arvo)
?> ?=(^ ota)
=. ..abet (render-ket "activated OTA" ~)
%: emit
%pass (make-wire /sync) %arvo %c
%warp ship.u.ota desk.u.ota `[%sing %w da+now /]
==
::
++ take-sync
|= =sign-arvo
^+ ..abet
?> ?=(%writ +<.sign-arvo)
?> ?=(^ ota)
?~ p.sign-arvo
=. ..abet (render-ket "OTA cancelled, retrying" ~)
(poke-internal `[ship desk]:u.ota)
=? aeon.u.ota ?=($w p.p.u.p.sign-arvo)
ud:;;(cass:clay q.q.r.u.p.sign-arvo)
=/ =germ
=+ .^(=cass:clay %cw /(scot %p our)/home/(scot %da now))
?: =(0 ud.cass)
%init
?:((gth 2 ud.cass) %that %mate)
=. ..abet (render-ket "beginning OTA to %home" ~)
%: emit
%pass (make-wire /merge-home) %arvo %c
%merg %home ship.u.ota desk.u.ota ud+aeon.u.ota germ
==
::
++ take-merge-home
|= =sign-arvo
?> ?=(%mere +<.sign-arvo)
?> ?=(^ ota)
?: ?=([%| %ali-unavailable *] p.sign-arvo)
=. ..abet
=/ =tape "OTA to %home failed, maybe because sunk; restarting"
(render-ket tape `p.p.sign-arvo)
(poke-internal `[ship desk]:u.ota)
::
?: ?=(%| -.p.sign-arvo)
=. ..abet
=/ =tape "OTA to %home failed, waiting for next revision"
(render-ket tape `p.p.sign-arvo)
=. aeon.u.ota +(aeon.u.ota)
%: emit
%pass (make-wire /sync) %arvo %c
%warp ship.u.ota desk.u.ota `[%sing %y ud+aeon.u.ota /]
==
=. ..abet (render-ket "OTA to %home succeeded" ~)
=. ..abet (render-ket "beginning OTA to %kids" ~)
=/ =germ
=+ .^(=cass:clay %cw /(scot %p our)/kids/(scot %da now))
?: =(0 ud.cass)
%init
?:((gth 2 ud.cass) %that %mate)
%: emit
%pass (make-wire /merge-kids) %arvo %c
%merg %kids ship.u.ota desk.u.ota ud+aeon.u.ota germ
==
::
++ take-merge-kids
|= =sign-arvo
?> ?=(%mere +<.sign-arvo)
?> ?=(^ ota)
?: ?=([%| %ali-unavailable *] p.sign-arvo)
=. ..abet
=/ =tape "OTA to %kids failed, maybe because sunk; restarting"
(render-ket tape `p.p.sign-arvo)
(poke-internal `[ship desk]:u.ota)
::
=. ..abet
?- -.p.sign-arvo
%& (render-ket "OTA to %kids succeeded" ~)
%| (render-ket "OTA to %kids failed" `p.p.sign-arvo)
==
=. aeon.u.ota +(aeon.u.ota)
%: emit
%pass (make-wire /sync) %arvo %c
%warp ship.u.ota desk.u.ota `[%sing %y ud+aeon.u.ota /]
==
--
::
++ poke-sync ::
|= hos/kiln-sync
?: (~(has by syn) hos)
@ -136,6 +294,7 @@
++ poke-syncs :: print sync config
|= ~
=< abet %- spam
:- [%leaf "OTAs from {<ota>}"]
?: =(0 ~(wyt by syn))
[%leaf "no syncs configured"]~
%+ turn ~(tap in ~(key by syn))
@ -203,6 +362,7 @@
%kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule)
%kiln-track =;(f (f !<(_+<.f vase)) poke-track)
%kiln-sync =;(f (f !<(_+<.f vase)) poke-sync)
%kiln-ota =;(f (f !<(_+<.f vase)) poke:update)
%kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs)
%kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall)
%kiln-unmount =;(f (f !<(_+<.f vase)) poke-unmount)
@ -241,6 +401,7 @@
?>(?=(%writ +<.sign-arvo) +>.sign-arvo)
[%autocommit *] %+ take-wake-autocommit t.wire
?>(?=(%wake +<.sign-arvo) +>.sign-arvo)
[%ota *] abet:(take:update t.wire sign-arvo)
*
?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo] !!)
%done %+ done wire
@ -388,7 +549,7 @@
::
++ mere
|= mes=(each (set path) (pair term tang))
?: ?=([%| %bad-fetch-ali *] mes)
?: ?=([%| %ali-unavailable *] mes)
=. +>.$
%^ spam
leaf+"merge cancelled, maybe because sunk; restarting"

View File

@ -228,8 +228,6 @@
;< ~ bind:m (mount her desk)
;< our=@p bind:m get-our
;< now=@da bind:m get-time
=/ host-pax
(weld /(scot %p our)/home/(scot %da now) pax)
=/ aqua-pax
;: weld
/i/(scot %p her)/cx/(scot %p her)/[desk]/(scot %da now)
@ -240,7 +238,7 @@
%^ cat 3 '=> . '
%^ cat 3 extra
(need (scry-aqua:util (unit @) our now aqua-pax))
;< ~ bind:m (send-events (insert-file:util her desk host-pax warped))
;< ~ bind:m (send-events (insert-files:util her desk [pax warped] ~))
(pure:m warped)
::
:: Check /sur/aquarium/hoon on the given has the given contents.

View File

@ -45,14 +45,16 @@
::
:: Inject a file into a ship
::
++ insert-file
|= [who=ship des=desk pax=path txt=@t]
++ insert-files
|= [who=ship des=desk files=(list [=path txt=@t])]
^- (list aqua-event)
?> ?=([@ @ @ *] pax)
=/ file [/text/plain (as-octs:mimes:html txt)]
=/ input
%+ turn files
|= [=path txt=@t]
[path ~ /text/plain (as-octs:mimes:html txt)]
%+ send-events-to who
:~
[//sync/0v1n.2m9vh %into des | [t.t.t.pax `file]~]
[//sync/0v1n.2m9vh %into des | input]
==
::
:: Checks whether the given event is a dojo output blit containing the

View File

@ -1,7 +1,6 @@
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: Postface ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
!:
~> %slog.[0 leaf+"arvo: assembly"]
~< %slog.[0 leaf+"arvo: assembled"]
=< ::

View File

@ -3671,7 +3671,7 @@
=/ bem/beam
?^ bem
u.bem
[[our %base %ud 1] ~]
[[our %home %ud 1] ~]
=/ dos (~(get by dos.rom.ruf) q.bem)
?~ dos
!! :: fire next in queue

View File

@ -260,7 +260,7 @@
[[151 %noun] %j our %sein da+now /(scot %p who)]
::
++ init :: initialize
(pass /merg/home [%c %merg %home our %base da+now %init])
(pass /merg/home [%c %merg %kids our %home da+now %init])
::
++ mere :: continue init
^+ .
@ -268,13 +268,11 @@
=/ can (clan:title our)
=. tem ~
=. +> (pass / %g %conf ram)
=. +> (sync %home our %base)
=? +> ?=(?($earl $duke $king) can)
(sync %base (sein our) %kids)
=? +> ?=(?($duke $king $czar) can)
:: make kids desk publicly readable, so syncs work.
::
(show %kids):(sync %kids our %base)
(ota (sein our) %kids)
:: make kids desk publicly readable, so syncs work.
::
=. +> (show %kids)
=. +> hood-set-boot-apps
=. +> peer
|- ^+ +>+
@ -284,7 +282,7 @@
++ into :: preinitialize
|= gyl/(list gill)
=. tem `(turn gyl |=(a/gill [%yow a]))
(pass / [%c %warp our %base `[%sing %y [%ud 1] /]])
(pass / [%c %warp our %home `[%sing %y [%ud 1] /]])
::
++ send :: send action
|= bet/dill-belt
@ -303,9 +301,9 @@
|= des/desk
(pass /show [%c %perm des / r+`[%black ~]])
::
++ sync
|= syn/{desk ship desk}
(deal /sync [%poke %hood-sync -:!>(syn) syn])
++ ota
|= syn=[ship desk]
(deal /sync %poke %kiln-ota !>(`syn))
::
++ take :: receive
|= {tea/wire sih/sign}

View File

@ -1,6 +1,7 @@
!: :: %gall, agent execution
:: :: %gall, agent execution
!? 163
!:
::
::::
|= pit=vase
=, gall

View File

@ -0,0 +1,54 @@
/- spider
/+ *ph-io
=, strand=strand:spider
^- thread:spider
|= vase
|^
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< ~ bind:m (raw-ship ~bud ~)
;< ~ bind:m (raw-ship ~marbud ~)
;< [path @t] bind:m (modify ~bud %home)
;< [=path file=@t] bind:m (modify ~bud %kids)
;< ~ bind:m (check-touched ~marbud %kids path file)
;< ~ bind:m end-simple
(pure:m *vase)
::
++ modify
|= [her=@p =desk]
=/ m (strand ,[path @t])
^- form:m
;< ~ bind:m (mount her desk)
;< our=@p bind:m get-our
;< now=@da bind:m get-time
|^
=/ zuse-contents
%^ cat 3 '=/ new-val 57 '
(get-val /sys/zuse/hoon)
=/ mar-contents
%^ cat 3 (get-val /mar/js/hoon)
' ~& > new-val=new-val .'
=/ js-contents
%^ cat 3 (get-val /app/publish/js/index/js)
'extra'
=/ files
:~ [/sys/zuse/hoon zuse-contents]
[/mar/js/hoon mar-contents]
[/app/publish/js/index/js js-contents]
==
;< ~ bind:m (send-events (insert-files:util her desk files))
(pure:m /app/publish/js/index/js js-contents)
::
++ aqua-path
|= =path
;: weld
/i/(scot %p her)/cx/(scot %p her)/[desk]/(scot %da now)
path
/noun
==
::
++ get-val
|= =path
(need (scry-aqua:util (unit @) our now (aqua-path path)))
--
--