2021-09-02 00:37:56 +03:00
|
|
|
=, clay
|
|
|
|
=* dude dude:gall
|
|
|
|
|%
|
2021-09-28 22:33:16 +03:00
|
|
|
:: $snap: kiln snapshot
|
|
|
|
::
|
|
|
|
+$ snap (map desk arak)
|
2021-09-02 00:37:56 +03:00
|
|
|
:: $diff: subscription update
|
|
|
|
::
|
|
|
|
+$ diff
|
|
|
|
$% [%block =desk =arak =weft blockers=(set desk)]
|
|
|
|
[%reset =desk =arak]
|
2021-09-15 22:57:08 +03:00
|
|
|
[%commit =desk =arak]
|
2021-09-02 00:37:56 +03:00
|
|
|
[%merge-sunk =desk =arak =tang]
|
|
|
|
[%merge-fail =desk =arak =tang]
|
|
|
|
[%suspend =desk =arak]
|
|
|
|
[%revive =desk =arak]
|
|
|
|
==
|
|
|
|
:: $arak: foreign vat tracker
|
|
|
|
::
|
2021-09-06 17:27:17 +03:00
|
|
|
:: .rail: upstream tracking state, if any
|
|
|
|
:: .rein: configuration for agents
|
2021-09-02 00:37:56 +03:00
|
|
|
::
|
|
|
|
+$ arak
|
2021-09-16 19:25:02 +03:00
|
|
|
$: rail=(unit rail)
|
2021-09-06 17:27:17 +03:00
|
|
|
=rein
|
|
|
|
==
|
|
|
|
:: $rail: upstream tracking state
|
|
|
|
::
|
2021-09-29 06:26:30 +03:00
|
|
|
:: .publisher: Ship that originally published desk, if available
|
2021-09-16 19:25:02 +03:00
|
|
|
:: .paused: is tracking paused? or live
|
|
|
|
:: .ship: upstream ship (could be .our)
|
|
|
|
:: .desk: name of upstream desk
|
|
|
|
:: .aeon: next aeon to pull from upstream
|
|
|
|
:: .next: list of pending commits with future kelvins
|
|
|
|
::
|
2021-09-06 17:27:17 +03:00
|
|
|
+$ rail
|
2021-09-29 06:26:30 +03:00
|
|
|
$: publisher=(unit ship)
|
|
|
|
paused=?
|
2021-09-06 17:27:17 +03:00
|
|
|
=ship
|
2021-09-02 00:37:56 +03:00
|
|
|
=desk
|
|
|
|
=aeon
|
2021-09-16 19:25:02 +03:00
|
|
|
next=(list rung)
|
2021-09-02 00:37:56 +03:00
|
|
|
==
|
2021-09-06 17:27:17 +03:00
|
|
|
:: $rung: reference to upstream commit
|
|
|
|
::
|
|
|
|
+$ rung [=aeon =weft]
|
2021-09-02 00:37:56 +03:00
|
|
|
:: $rein: diff from desk manifest
|
|
|
|
::
|
2021-09-16 19:25:02 +03:00
|
|
|
:: .liv: suspended? if suspended, no agents should run
|
2021-09-02 00:37:56 +03:00
|
|
|
:: .add: agents not in manifest that should be running
|
|
|
|
:: .sub: agents in manifest that should not be running
|
|
|
|
::
|
|
|
|
+$ rein
|
|
|
|
$: liv=_&
|
|
|
|
add=(set dude)
|
|
|
|
sub=(set dude)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ vat [=desk hash=@uv =cass =arak]
|
|
|
|
:: +report-vats: report on all desk installations
|
|
|
|
::
|
|
|
|
++ report-vats
|
|
|
|
|= [our=@p now=@da]
|
|
|
|
^- tang
|
|
|
|
=+ .^ raz=(list vat)
|
|
|
|
%gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun
|
|
|
|
==
|
2021-10-01 15:14:10 +03:00
|
|
|
:- (report-kids our now)
|
2021-09-02 00:37:56 +03:00
|
|
|
(turn raz |=(v=vat (report-vat our now v)))
|
|
|
|
:: +report-vat: report on a single desk installation
|
|
|
|
::
|
|
|
|
++ report-vat
|
|
|
|
|= [our=ship now=@da vat]
|
|
|
|
^- tank
|
2021-09-29 03:17:28 +03:00
|
|
|
?: =(ud.cass 0)
|
|
|
|
leaf+"desk does not yet exist: {<desk>}"
|
2021-09-22 06:20:05 +03:00
|
|
|
=/ kel-path
|
|
|
|
/(scot %p our)/[desk]/(scot %da now)/sys/kelvin
|
|
|
|
?. .^(? %cu kel-path)
|
|
|
|
leaf+"bad desk: {<desk>}"
|
|
|
|
=+ .^(=weft %cx kel-path)
|
2021-09-02 00:37:56 +03:00
|
|
|
:+ %rose ["" "{<desk>}" "::"]
|
|
|
|
^- tang
|
|
|
|
=/ meb (mergebase-hashes our desk now arak)
|
2021-09-16 19:25:02 +03:00
|
|
|
=/ poz
|
|
|
|
?~ rail.arak "local"
|
|
|
|
?:(paused.u.rail.arak "paused" "tracking")
|
2021-09-02 00:37:56 +03:00
|
|
|
=/ sat ?:(liv.rein.arak "running" "suspended")
|
2021-09-16 19:25:02 +03:00
|
|
|
=/ pen
|
|
|
|
?~ rail.arak "~"
|
|
|
|
<(turn next.u.rail.arak |=([@ lal=@tas num=@] [lal num]))>
|
2021-09-25 23:15:55 +03:00
|
|
|
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
|
|
|
|
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
|
|
|
|
leaf/"%cz hash: {<hash>}"
|
|
|
|
::
|
|
|
|
leaf/"app status: {sat}"
|
|
|
|
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
|
|
|
|
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
|
|
|
|
::
|
2021-09-29 06:26:30 +03:00
|
|
|
leaf/"publishing ship: {?~(rail.arak <~> <publisher.u.rail.arak>)}"
|
2021-09-25 23:15:55 +03:00
|
|
|
leaf/"updates: {poz}"
|
|
|
|
leaf/"source ship: {?~(rail.arak <~> <ship.u.rail.arak>)}"
|
|
|
|
leaf/"source desk: {?~(rail.arak <~> <desk.u.rail.arak>)}"
|
|
|
|
leaf/"source aeon: {?~(rail.arak <~> <aeon.u.rail.arak>)}"
|
|
|
|
leaf/"pending updates: {pen}"
|
2021-09-02 00:37:56 +03:00
|
|
|
==
|
2021-10-01 15:08:11 +03:00
|
|
|
:: +report-kids: non-vat cz hash report for kids desk
|
|
|
|
::
|
|
|
|
++ report-kids
|
|
|
|
|= [our=ship now=@da]
|
|
|
|
^- tank
|
|
|
|
=/ dek %kids
|
|
|
|
=/ ego (scot %p our)
|
|
|
|
=/ wen (scot %da now)
|
2021-10-01 15:31:18 +03:00
|
|
|
?. (~(has in .^((set desk) %cd /[ego]//[wen])) dek)
|
2021-10-01 15:08:11 +03:00
|
|
|
leaf/"no %kids desk"
|
|
|
|
=+ .^(hash=@uv %cz /[ego]/[dek]/[wen])
|
|
|
|
leaf/"%kids %cz hash: {<hash>}"
|
2021-09-02 00:37:56 +03:00
|
|
|
:: +read-kelvin-foreign: read /sys/kelvin from a foreign desk
|
|
|
|
::
|
|
|
|
++ read-kelvin-foreign
|
|
|
|
|= [=ship =desk =aeon]
|
|
|
|
^- weft
|
2021-09-29 21:59:13 +03:00
|
|
|
~| read-foreign-kelvin/+<
|
2021-09-02 00:37:56 +03:00
|
|
|
=/ her (scot %p ship)
|
|
|
|
=/ syd (scot %tas desk)
|
|
|
|
=/ yon (scot %ud aeon)
|
|
|
|
::
|
|
|
|
=/ dom .^(dome cv/~[her syd yon])
|
|
|
|
=/ tak (scot %uv (~(got by hit.dom) let.dom))
|
|
|
|
=/ yak .^(yaki cs/~[her syd yon %yaki tak])
|
|
|
|
=/ lob (scot %uv (~(got by q.yak) /sys/kelvin))
|
|
|
|
=/ bob .^(blob cs/~[her syd yon %blob lob])
|
|
|
|
::
|
|
|
|
;; weft
|
|
|
|
?- -.bob
|
|
|
|
%direct q.q.bob
|
|
|
|
%delta q.r.bob
|
clay: Add support for representing tombstones
This adds support for tombstoned files to clay. It does not include any
way to actually tombstone them; that is left for later.
This allows tombstoning at the level of a file. Precisely, this expands
+blob:clay by adding a %dead case:
+$ blob :: fs blob
$% [%delta p=lobe q=[p=mark q=lobe] r=page] :: delta on q
[%direct p=lobe q=page] :: immediate
[%dead p=lobe ~] :: tombstone
== ::
Thus, we maintain the invariant that every lobe corresponds to a blob,
but now a blob may be an explicit tombstone.
Details:
- This has not been tested at all, except that it compiles and boots.
- This does not have a state adapter from master. The only state change
is the definition of +cach.
- Additionally, out-of-date ships may unexpectedly receive a %dead blob
from a foreign clay which would interfere with their ability to download
that desk. No code changes necessary, but sponsors should avoid
tombstoning files in %base for a while so their children can get the
update.
- A merge will only fail if the tombstoned file conflicts with another
change. Note that as written, merging from a past desk *can* bring a
tombstoned file to the head of a desk. Possibly this shouldn't be
allowed.
This also includes a couple refactors that were made possible by ford
fusion (since everything is synchronous now) but never got done. In
both cases we get to remove a monad, which simplifies the code
considerably.
- refactor +merge's error handling to use !!/mule instead of threading
through errors
- refactor all +read-* functions and related parts of +try-fill-sub to
eagerly convert lobes to cages.
We also add support reading %a/b/c/e/f/r/x from past and foreign desks,
when possible. Apologies that all of these are in one commit, it was
all a single chunk of work.
This is a draft until we have a way to tombstone. I suspect we'll want
to have a mechanism of keeping track of gc roots and trace to remove,
but this PR doesn't suggest any particular strategy.
2021-11-08 09:17:02 +03:00
|
|
|
%dead ~|(%tombstoned-kelvin !!)
|
2021-09-02 00:37:56 +03:00
|
|
|
==
|
|
|
|
:: +read-kelvin-local: read /sys/kelvin from a local desk
|
|
|
|
::
|
|
|
|
++ read-kelvin-local
|
|
|
|
|= [our=ship =desk now=@da]
|
|
|
|
^- (unit weft)
|
2021-09-27 00:03:26 +03:00
|
|
|
~| read-kelvin-local+desk
|
2021-09-02 00:37:56 +03:00
|
|
|
=/ pax (en-beam [our desk da+now] /sys/kelvin)
|
2021-09-16 19:25:02 +03:00
|
|
|
?. .^(? cu/pax)
|
2021-09-02 00:37:56 +03:00
|
|
|
~
|
|
|
|
[~ .^(weft cx/pax)]
|
2021-09-13 01:35:17 +03:00
|
|
|
:: +read-bill-foreign: read /desk/bill from a foreign desk
|
|
|
|
::
|
|
|
|
++ read-bill-foreign
|
|
|
|
|= [=ship =desk =aeon]
|
2021-09-27 00:03:26 +03:00
|
|
|
^- (list dude)
|
2021-09-27 23:57:38 +03:00
|
|
|
~| +<
|
2021-09-13 01:35:17 +03:00
|
|
|
=/ her (scot %p ship)
|
|
|
|
=/ syd (scot %tas desk)
|
|
|
|
=/ yon (scot %ud aeon)
|
|
|
|
::
|
|
|
|
=/ dom .^(dome cv/~[her syd yon])
|
2021-09-27 23:57:38 +03:00
|
|
|
=/ tak ~| aeons=~(key by hit.dom)
|
|
|
|
(scot %uv (~(got by hit.dom) aeon))
|
2021-09-13 01:35:17 +03:00
|
|
|
=/ yak .^(yaki cs/~[her syd yon %yaki tak])
|
2021-09-27 04:54:36 +03:00
|
|
|
=/ fil (~(get by q.yak) /desk/bill)
|
|
|
|
?~ fil ~
|
|
|
|
=/ lob (scot %uv u.fil)
|
2021-09-13 01:35:17 +03:00
|
|
|
=/ bob .^(blob cs/~[her syd yon %blob lob])
|
|
|
|
::
|
2021-09-27 00:03:26 +03:00
|
|
|
;; (list dude)
|
2021-09-13 01:35:17 +03:00
|
|
|
?- -.bob
|
|
|
|
%direct q.q.bob
|
|
|
|
%delta q.r.bob
|
clay: Add support for representing tombstones
This adds support for tombstoned files to clay. It does not include any
way to actually tombstone them; that is left for later.
This allows tombstoning at the level of a file. Precisely, this expands
+blob:clay by adding a %dead case:
+$ blob :: fs blob
$% [%delta p=lobe q=[p=mark q=lobe] r=page] :: delta on q
[%direct p=lobe q=page] :: immediate
[%dead p=lobe ~] :: tombstone
== ::
Thus, we maintain the invariant that every lobe corresponds to a blob,
but now a blob may be an explicit tombstone.
Details:
- This has not been tested at all, except that it compiles and boots.
- This does not have a state adapter from master. The only state change
is the definition of +cach.
- Additionally, out-of-date ships may unexpectedly receive a %dead blob
from a foreign clay which would interfere with their ability to download
that desk. No code changes necessary, but sponsors should avoid
tombstoning files in %base for a while so their children can get the
update.
- A merge will only fail if the tombstoned file conflicts with another
change. Note that as written, merging from a past desk *can* bring a
tombstoned file to the head of a desk. Possibly this shouldn't be
allowed.
This also includes a couple refactors that were made possible by ford
fusion (since everything is synchronous now) but never got done. In
both cases we get to remove a monad, which simplifies the code
considerably.
- refactor +merge's error handling to use !!/mule instead of threading
through errors
- refactor all +read-* functions and related parts of +try-fill-sub to
eagerly convert lobes to cages.
We also add support reading %a/b/c/e/f/r/x from past and foreign desks,
when possible. Apologies that all of these are in one commit, it was
all a single chunk of work.
This is a draft until we have a way to tombstone. I suspect we'll want
to have a mechanism of keeping track of gc roots and trace to remove,
but this PR doesn't suggest any particular strategy.
2021-11-08 09:17:02 +03:00
|
|
|
%dead ~|(%tombstoned-bill !!)
|
2021-09-13 01:35:17 +03:00
|
|
|
==
|
2021-09-02 00:37:56 +03:00
|
|
|
:: +read-bill: read contents of /desk/bill manifest
|
|
|
|
::
|
|
|
|
++ read-bill
|
2021-09-27 23:57:38 +03:00
|
|
|
|= [our=ship =desk now=@da]
|
2021-09-02 00:37:56 +03:00
|
|
|
=/ pax (en-beam [our desk da+now] /desk/bill)
|
2021-09-16 19:25:02 +03:00
|
|
|
?. .^(? cu/pax)
|
2021-09-27 00:03:26 +03:00
|
|
|
*(list dude)
|
|
|
|
.^((list dude) cx/pax)
|
|
|
|
:: +adjust-dudes: which agents should be started and stopped
|
|
|
|
::
|
|
|
|
:: Will ask Gall to start agents that it's already running
|
|
|
|
:: but that should be ok, and might be safer in case other
|
|
|
|
:: unprocessed moves would have turned them off.
|
|
|
|
::
|
|
|
|
++ adjust-dudes
|
|
|
|
|= $: local=[our=ship =desk now=@da]
|
|
|
|
=rein
|
|
|
|
==
|
|
|
|
^- [jolt=(list dude) idle=(list dude)]
|
2021-09-28 02:34:15 +03:00
|
|
|
=/ all=(list dude) (read-bill local)
|
2021-11-11 09:17:05 +03:00
|
|
|
=/ want (get-apps-want local all rein)
|
2021-09-27 00:03:26 +03:00
|
|
|
=/ have (get-apps-live local)
|
|
|
|
[want (skip have ~(has in (sy want)))]
|
2021-09-02 00:37:56 +03:00
|
|
|
::
|
2021-09-27 21:50:58 +03:00
|
|
|
++ get-remote-diff
|
|
|
|
|= [our=ship here=desk now=@da her=ship there=desk when=aeon]
|
|
|
|
=+ .^(our-hash=@uv cz/[(scot %p our) here (scot %da now) ~])
|
|
|
|
=+ .^(her-hash=@uv cz/[(scot %p her) there (scot %ud when) ~])
|
|
|
|
!=(our-hash her-hash)
|
|
|
|
::
|
2021-09-29 06:26:30 +03:00
|
|
|
++ get-publisher
|
|
|
|
|= [our=ship =desk now=@da]
|
|
|
|
^- (unit ship)
|
|
|
|
=/ pax /(scot %p our)/[desk]/(scot %da now)/desk/ship
|
|
|
|
?. .^(? %cu pax) ~
|
|
|
|
`.^(ship %cx pax)
|
|
|
|
::
|
2021-09-02 00:37:56 +03:00
|
|
|
++ get-apps-live
|
|
|
|
|= [our=ship =desk now=@da]
|
|
|
|
^- (list dude)
|
|
|
|
%+ murn (get-apps-have our desk now)
|
|
|
|
|=([=dude live=?] ?.(live ~ `dude))
|
|
|
|
:: +get-apps-have: find which apps Gall is running on a desk
|
|
|
|
::
|
|
|
|
++ get-apps-have
|
|
|
|
|= [our=ship =desk now=@da]
|
|
|
|
^- (list [=dude live=?])
|
|
|
|
%~ tap in
|
|
|
|
.^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now))
|
|
|
|
:: +get-apps-want: find which apps should be running on a desk
|
|
|
|
::
|
|
|
|
++ get-apps-want
|
2021-11-11 09:17:05 +03:00
|
|
|
|= [local=[our=ship =desk now=@da] duz=(list dude) =rein]
|
2021-09-02 00:37:56 +03:00
|
|
|
^- (list dude)
|
2021-11-09 01:43:48 +03:00
|
|
|
?. liv.rein ~
|
2021-11-11 09:17:05 +03:00
|
|
|
?. |(=(`zuse+zuse (read-kelvin-local local)) =(%base desk.local)) ~
|
2021-09-02 00:37:56 +03:00
|
|
|
=. duz (skip duz ~(has in sub.rein))
|
|
|
|
=. duz (weld duz (skip ~(tap in add.rein) ~(has in (sy duz))))
|
|
|
|
duz
|
|
|
|
::
|
|
|
|
++ mergebase-hashes
|
|
|
|
|= [our=@p =desk now=@da =arak]
|
2021-09-24 01:07:13 +03:00
|
|
|
?~ rail.arak
|
|
|
|
~
|
2021-09-16 19:25:02 +03:00
|
|
|
=/ her (scot %p ship.u.rail.arak)
|
2021-09-02 00:37:56 +03:00
|
|
|
=/ ego (scot %p our)
|
|
|
|
=/ wen (scot %da now)
|
2021-09-16 19:25:02 +03:00
|
|
|
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.u.rail.arak])
|
2021-09-02 00:37:56 +03:00
|
|
|
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
|
|
|
|
::
|
|
|
|
++ enjs
|
|
|
|
=, enjs:format
|
|
|
|
|%
|
|
|
|
++ vats
|
|
|
|
|= v=(list ^vat)
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
%+ turn v
|
|
|
|
|= va=^vat
|
|
|
|
[desk.va (vat va)]
|
|
|
|
::
|
|
|
|
++ tim
|
|
|
|
|= t=@
|
|
|
|
^- json
|
|
|
|
(numb (fall (mole |.((unm:chrono:userlib t))) 0))
|
|
|
|
::
|
|
|
|
++ cass
|
|
|
|
|= c=^cass
|
|
|
|
%- pairs
|
|
|
|
:~ ud+(numb ud.c)
|
|
|
|
da+(tim da.c)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ vat
|
|
|
|
|= v=^vat
|
|
|
|
%- pairs
|
|
|
|
:~ desk+s+desk.v
|
|
|
|
hash+s+(scot %uv hash.v)
|
|
|
|
cass+(cass cass.v)
|
|
|
|
arak+(arak arak.v)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ weft
|
|
|
|
|= w=^weft
|
|
|
|
%- pairs
|
|
|
|
:~ name+s+lal.w
|
|
|
|
kelvin+(numb num.w)
|
|
|
|
==
|
|
|
|
::
|
2021-09-07 07:37:36 +03:00
|
|
|
++ rung
|
|
|
|
|= r=^rung
|
2021-09-02 00:37:56 +03:00
|
|
|
%- pairs
|
2021-09-07 07:37:36 +03:00
|
|
|
:~ aeon+(numb aeon.r)
|
|
|
|
weft+(weft weft.r)
|
2021-09-02 00:37:56 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ rein
|
|
|
|
|= r=^rein
|
|
|
|
%- pairs
|
|
|
|
:~ add+a+(turn ~(tap in add.r) (lead %s))
|
|
|
|
sub+a+(turn ~(tap in sub.r) (lead %s))
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ arak
|
|
|
|
|= a=^arak
|
|
|
|
%- pairs
|
2021-09-16 19:25:02 +03:00
|
|
|
:~ rail+?~(rail.a ~ (rail u.rail.a))
|
2021-09-02 00:37:56 +03:00
|
|
|
rein+(rein rein.a)
|
|
|
|
==
|
2021-09-16 19:25:02 +03:00
|
|
|
::
|
|
|
|
++ rail
|
|
|
|
|= r=^rail
|
|
|
|
%- pairs
|
|
|
|
:~ ship+s+(scot %p ship.r)
|
2021-09-29 06:26:30 +03:00
|
|
|
publisher+?~(publisher.r ~ s+(scot %p u.publisher.r))
|
2021-09-16 19:25:02 +03:00
|
|
|
desk+s+desk.r
|
|
|
|
paused+b+paused.r
|
|
|
|
aeon+(numb aeon.r)
|
|
|
|
next+a+(turn next.r rung)
|
|
|
|
==
|
2021-09-02 00:37:56 +03:00
|
|
|
--
|
|
|
|
--
|