@@ -1,147 +1,312 @@
1+/% kelvin %kelvin
12=, clay
23=* dude dude:gall
34|%
4−:: $snap: kiln snapshot
5++$ pike
6+ $: sync=(unit [=ship =desk])
7+ hash=@uv
8+ =zest
9+ wic=(set weft)
10+ ==
511::
6−+$ snap (map desk arak)
7−:: $diff: subscription update
12++$ pikes (map desk pike)
13+:: $jump: changes to update source change requests
814::
9−+$ diff
10− $% [%block =desk =arak =weft blockers=(set desk)]
11− [%reset =desk =arak]
12− [%commit =desk =arak]
13− [%merge-sunk =desk =arak =tang]
14− [%merge-fail =desk =arak =tang]
15− [%suspend =desk =arak]
16− [%revive =desk =arak]
15++$ jump
16+ $% [%all all=(map dock dock)] :: pending requests
17+ [%add old=dock new=dock] :: new request
18+ [%yea old=dock new=dock] :: approved
19+ [%nay old=dock new=dock] :: denied
1720 ==
18−:: $arak: foreign vat tracker
21+:: $rung: reference to upstream commit
1922::
20−:: .rail: upstream tracking state, if any
21−:: .rein: configuration for agents
23++$ rung [=aeon =weft]
24+:: #sync-record: source and destination of a kiln sync
2225::
23−+$ arak
24− $: rail=(unit rail)
25− =rein
26++$ sync-record ::
27+ $: syd=desk :: local desk
28+ her=ship :: foreign ship
29+ sud=desk :: foreign desk
2630 ==
27−:: $rail: upstream tracking state
2831::
29−:: .publisher: Ship that originally published desk, if available
30−:: .paused: is tracking paused? or live
31−:: .ship: upstream ship (could be .our)
32−:: .desk: name of upstream desk
33−:: .aeon: next aeon to pull from upstream
34−:: .next: list of pending commits with future kelvins
32++$ sync-state ::
33+ $: nun=@ta :: nonce
34+ kid=(unit desk) :: has kids desk too?
35+ let=@ud :: next revision
36+ nit=(unit ?) :: automerge or default
37+ hav=(unit @ud) :: update available
38+ yea=? :: update approved
39+ ==
3540::
36−+$ rail
37− $: publisher=(unit ship)
38− paused=?
39− =ship
40− =desk
41− =aeon
42− next=(list rung)
41++$ sync-update
42+ $% [%new for=sync-record rev=@ud]
43+ [%done for=sync-record rev=@ud]
44+ [%drop for=sync-record rev=@ud]
45+ [%pending pending=(set [for=sync-record rev=@ud])]
4346 ==
44−:: $rung: reference to upstream commit
4547::
46−+$ rung [=aeon =weft]
47−:: $rein: diff from desk manifest
48++$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud])
49+:: +truncate-hash: get last 5 digits of hash and convert to tape
4850::
49−:: .liv: suspended? if suspended, no agents should run
50−:: .add: agents not in manifest that should be running
51−:: .sub: agents in manifest that should not be running
51+++ truncate-hash
52+ |= hash=@uv
53+ ^- tape
54+ (slag 2 <`@uv`(mod hash 0v1.00000)>)
55+:: +report-prep: get data required for reports
5256::
53−+$ rein
54− $: liv=_&
55− add=(set dude)
56− sub=(set dude)
57+++ report-prep
58+ |= [our=@p now=@da]
59+ =/ ego (scot %p our)
60+ =/ wen (scot %da now)
61+ :* .^(rock:tire %cx /[ego]//[wen]/tire)
62+ .^(cone %cx /[ego]//[wen]/domes)
63+ .^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun)
64+ .^ (map [desk ship desk] sync-state) %gx
65+ /[ego]/hood/[wen]/kiln/syncs/noun
66+ ==
5767 ==
58−::
59−+$ vat [=desk hash=@uv =cass =arak]
6068:: +report-vats: report on all desk installations
6169::
6270++ report-vats
63− |= [our=@p now=@da]
71+ |= [our=@p now=@da desks=(list desk) filt=@tas verb=?]
6472 ^- tang
65− =+ .^ raz=(list vat)
66− %gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun
73+ =/ ego (scot %p our)
74+ =/ wen (scot %da now)
75+ =+ prep=[tyr cone sor zyn]=(report-prep our now)
76+ ?: =(%$ filt)
77+ %- zing
78+ %+ turn
79+ ?^ desks
80+ (flop desks)
81+ %+ sort ~(tap in ~(key by tyr.prep))
82+ |= [a=desk b=desk]
83+ ?: |(=(a %kids) =(b %base)) &
84+ ?: |(=(a %base) =(b %kids)) |
85+ (aor b a)
86+ |=(syd=@tas (report-vat prep our now syd verb))
87+ =/ deks=(list [=desk =zest wic=(set weft)])
88+ ?~ desks
89+ %+ sort ~(tap by tyr.prep)
90+ |= [[a=desk *] [b=desk *]]
91+ ?: |(=(a %kids) =(b %base)) &
92+ ?: |(=(a %base) =(b %kids)) |
93+ (aor b a)
94+ %+ murn (flop desks)
95+ |= des=desk
96+ ^- (unit [=desk =zest wic=(set weft)])
97+ ?~ got=(~(get by tyr.prep) des)
98+ ~
99+ `[des u.got]
100+ ?: =(filt %blocking)
101+ =/ base-weft=(unit weft)
102+ %- ~(rep in wic:(~(got by tyr.prep) %base))
103+ |= [=weft out=(unit weft)]
104+ ?~ out
105+ `weft
106+ ?: (lth num.weft num.u.out)
107+ out
108+ `weft
109+ ?~ base-weft ~['%base already up-to-date']
110+ =/ blockers=(list desk)
111+ %+ sort
112+ ^- (list desk)
113+ %+ murn deks
114+ |= [=desk =zest wic=(set weft)]
115+ ^- (unit ^desk)
116+ ?. =(%live zest)
117+ ~
118+ ?: (~(has in wic) u.base-weft)
119+ ~
120+ `desk
121+ aor
122+ ?~ blockers ~['No desks blocking upgrade']
123+ %- zing
124+ ^- (list tang)
125+ :- :~ %+ rap 3
126+ :~ 'These desks are blocking upgrade to [%zuse '
127+ (scot %ud num.u.base-weft)
128+ ']:'
129+ == ==
130+ %+ turn blockers
131+ |=(syd=desk (report-vat prep our now syd verb))
132+ ::
133+ %- zing
134+ %+ turn
135+ ?+ filt !!
136+ %exists
137+ %+ skip deks
138+ |= [syd=desk *]
139+ ?~ got=(~(get by cone.prep) our syd)
140+ &
141+ =(0 let.u.got)
142+ ::
143+ %running
144+ %+ skim deks
145+ |=([* [zest=@tas *]] =(zest %live))
146+ ::
147+ %suspended
148+ %+ skip deks
149+ |= [syd=@tas [zest=@tas *]]
150+ ?| =(syd %kids)
151+ =(zest %live)
152+ ?~ got=(~(get by cone.prep) our syd)
153+ &
154+ =(0 let.u.got)
67155 ==
68− :- (report-kids our now)
69− (turn raz |=(v=vat (report-vat our now v)))
156+ ::
157+ %exists-not
158+ %+ skim deks
159+ |= [syd=desk *]
160+ ?~ got=(~(get by cone.prep) our syd)
161+ |
162+ =(0 let.u.got)
163+ ==
164+ |=([syd=desk *] (report-vat prep our now syd verb))
70165:: +report-vat: report on a single desk installation
71166::
72167++ report-vat
73− |= [our=ship now=@da vat]
74− ^- tank
75− ?: =(ud.cass 0)
76− leaf+"desk does not yet exist: {<desk>}"
77− =/ kel-path
78− /(scot %p our)/[desk]/(scot %da now)/sys/kelvin
168+ |= $: $: tyr=rock:tire =cone sor=(map desk (pair ship desk))
169+ zyn=(map [desk ship desk] sync-state)
170+ ==
171+ our=ship now=@da syd=desk verb=?
172+ ==
173+ |^ ^- tang
174+ =/ ego (scot %p our)
175+ =/ wen (scot %da now)
176+ ?. ((sane %tas) syd)
177+ ~[(cat 3 'insane desk: %' syd)]
178+ ?. (~(has by cone) our syd)
179+ ~[(cat 3 'desk does not yet exist: %' syd)]
180+ =/ hash .^(@uv %cz /[ego]/[syd]/[wen])
181+ ?: =(%kids syd)
182+ ~[(cat 3 '%kids %cz hash: ' (scot %uv hash))]
183+ =/ kel-path /[ego]/[syd]/[wen]/sys/kelvin
79184 ?. .^(? %cu kel-path)
80− leaf+"bad desk: {<desk>}"
81− =+ .^(=weft %cx kel-path)
82− :+ %rose ["" "{<desk>}" "::"]
185+ ~[(cat 3 'bad desk: %' syd)]
186+ =+ .^(=waft %cx kel-path)
83187 ^- tang
84− =/ meb (mergebase-hashes our desk now arak)
85− =/ poz
86− ?~ rail.arak "local"
87− ?:(paused.u.rail.arak "paused" "tracking")
88− =/ sat ?:(liv.rein.arak "running" "suspended")
89− =/ pen
90− ?~ rail.arak "~"
91− <(turn next.u.rail.arak |=([@ lal=@tas num=@] [lal num]))>
92− :~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
93− leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
94− leaf/"%cz hash: {<hash>}"
95− ::
96− leaf/"app status: {sat}"
97− leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
98− leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
99− ::
100− leaf/"publishing ship: {?~(rail.arak <~> <publisher.u.rail.arak>)}"
101− leaf/"updates: {poz}"
102− leaf/"source ship: {?~(rail.arak <~> <ship.u.rail.arak>)}"
103− leaf/"source desk: {?~(rail.arak <~> <desk.u.rail.arak>)}"
104− leaf/"source aeon: {?~(rail.arak <~> <aeon.u.rail.arak>)}"
105− leaf/"pending updates: {pen}"
188+ =/ =sink
189+ ?~ s=(~(get by sor) syd)
190+ ~
191+ ?~ z=(~(get by zyn) syd u.s)
192+ ~
193+ `[p.u.s q.u.s [kid let]:u.z]
194+ =/ meb=(list @uv)
195+ ?~ sink ~[hash]
196+ %+ turn
197+ .^ (list tako) %cs
198+ /[ego]/[syd]/[wen]/base/(scot %p her.u.sink)/[sud.u.sink]
199+ ==
200+ |=(=tako .^(@uv %cs /[ego]/[syd]/[wen]/hash/(scot %uv tako)))
201+ =/ dek (~(got by tyr) syd)
202+ =/ sat
203+ ?- zest.dek
204+ %live 'running'
205+ %dead 'suspended'
206+ %held 'suspended until next update'
207+ ==
208+ =/ kul=cord (print-wefts (waft-to-wefts waft))
209+ =/ ese=cord
210+ ?:(.^(? %cx /[ego]//[wen]/esse/[syd]) 'yes' 'no')
211+ =/ pax=path /(scot %p our)/[syd]/(scot %da now)
212+ ?. verb
213+ :~ '::'
214+ =+ .^(exist=? cu+(weld pax /desk/bill))
215+ ?. exist ' /desk/bill: missing'
216+ =+ .^(dudes=(list dude:gall) cx+(weld pax /desk/bill))
217+ (cat 3 ' /desk/bill: ' (crip "{<dudes>}"))
218+ (cat 3 ' pending updates: ' (print-wefts wic.dek))
219+ (cat 3 ' source ship: ' ?~(sink '~' (scot %p her.u.sink)))
220+ (cat 3 ' app status: ' sat)
221+ (cat 3 ' essential desk: ' ese)
222+ (cat 3 ' %cz hash ends in: ' (print-shorthash hash))
223+ (cat 3 ' /sys/kelvin: ' (print-wefts (waft-to-wefts waft)))
224+ (cat 3 '%' syd)
225+ ==
226+ ::
227+ =/ [on=(list @tas) of=(list @tas)]
228+ =/ [on=(list @tas) of=(list @tas)]
229+ %- ~(rep by ren:(~(got by cone) our syd))
230+ |= [[=dude:gall is-on=?] on=(list @tas) of=(list @tas)]
231+ ?: is-on
232+ [[dude on] of]
233+ [on [dude of]]
234+ [(sort on aor) (sort of aor)]
235+ :~ '::'
236+ (cat 3 ' pending updates: ' (print-wefts wic.dek))
237+ %^ cat 3 ' kids desk: ' ?~ sink '~'
238+ ?~ kid.u.sink '~'
239+ (cat 3 '%' u.kid.u.sink)
240+ (cat 3 ' source aeon: ' ?~(sink '~' (scot %ud let.u.sink)))
241+ (cat 3 ' source desk: ' ?~(sink '~' (cat 3 '%' sud.u.sink)))
242+ (cat 3 ' source ship: ' ?~(sink '~' (scot %p her.u.sink)))
243+ (cat 3 ' updates: ' ?~(sink 'local' 'remote'))
244+ %^ cat 3 ' publishing ship: ' ?~ got=(get-publisher our syd now)
245+ '~'
246+ (scot %p u.got)
247+ ::
248+ (cat 3 ' force off: ' (print-agents of))
249+ (cat 3 ' force on: ' (print-agents on))
250+ (cat 3 ' app status: ' sat)
251+ (cat 3 ' essential desk: ' ese)
252+ ::
253+ (cat 3 ' %cz hash: ' (scot %uv hash))
254+ (cat 3 ' base hash: ' (print-mergebases meb))
255+ (cat 3 ' /sys/kelvin: ' (print-wefts (waft-to-wefts waft)))
256+ (cat 3 '%' syd)
106257 ==
258+ ++ print-wefts
259+ |= wefts=(set weft)
260+ ^- @t
261+ ?: =(~ wefts)
262+ '~'
263+ %+ roll (sort ~(tap in wefts) aor)
264+ |= [=weft out=@t]
265+ ?: =('' out)
266+ (rap 3 '[%' lal.weft ' ' (scot %ud num.weft) ']' ~)
267+ (rap 3 out ' [%' lal.weft ' ' (scot %ud num.weft) ']' ~)
268+ ::
269+ ++ print-shorthash
270+ |= hash=@uv
271+ ^- @t
272+ (crip ((v-co:co 5) (end [0 25] hash)))
273+ ::
274+ ++ print-mergebases
275+ |= hashes=(list @uv)
276+ ^- @t
277+ ?~ hashes
278+ '~'
279+ ?~ t.hashes
280+ (scot %uv i.hashes)
281+ %+ roll `(list @uv)`hashes
282+ |= [hash=@uv out=@t]
283+ ?: =('' out)
284+ (print-shorthash hash)
285+ (rap 3 out ' ' (print-shorthash hash) ~)
286+ ::
287+ ++ print-agents
288+ |= agents=(list @tas)
289+ ^- @t
290+ ?~ agents
291+ '~'
292+ %+ roll `(list @tas)`agents
293+ |= [agent=@tas out=@tas]
294+ ?: =('' out)
295+ (cat 3 '%' agent)
296+ (rap 3 out ' %' agent ~)
297+ --
107298:: +report-kids: non-vat cz hash report for kids desk
108299::
109300++ report-kids
110301 |= [our=ship now=@da]
111302 ^- tank
112− =/ dek %kids
303+ =/ syd %kids
113304 =/ ego (scot %p our)
114305 =/ wen (scot %da now)
115− ?. (~(has in .^((set desk) %cd /[ego]//[wen])) dek)
116− leaf/"no %kids desk"
117− =+ .^(hash=@uv %cz /[ego]/[dek]/[wen])
118− leaf/"%kids %cz hash: {<hash>}"
119−:: +read-kelvin-foreign: read /sys/kelvin from a foreign desk
120−::
121−++ read-kelvin-foreign
122− |= [=ship =desk =aeon]
123− ^- weft
124− ~| read-foreign-kelvin/+<
125− =/ her (scot %p ship)
126− =/ syd (scot %tas desk)
127− =/ yon (scot %ud aeon)
128− ::
129− =/ dom .^(dome cv/~[her syd yon])
130− =/ tak (scot %uv (~(got by hit.dom) let.dom))
131− =/ yak .^(yaki cs/~[her syd yon %yaki tak])
132− =/ lob (scot %uv (~(got by q.yak) /sys/kelvin))
133− =/ peg .^(page cs/~[her syd yon %blob lob])
134− ;;(weft q.peg)
135−:: +read-kelvin-local: read /sys/kelvin from a local desk
136−::
137−++ read-kelvin-local
138− |= [our=ship =desk now=@da]
139− ^- (unit weft)
140− ~| read-kelvin-local+desk
141− =/ pax (en-beam [our desk da+now] /sys/kelvin)
142− ?. .^(? cu/pax)
143− ~
144− [~ .^(weft cx/pax)]
306+ ?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd)
307+ 'no %kids desk'
308+ =+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
309+ (cat 3 '%kids %cz hash: ' (scot %uv hash))
145310:: +read-bill-foreign: read /desk/bill from a foreign desk
146311::
147312++ read-bill-foreign
@@ -152,7 +317,7 @@
152317 =/ syd (scot %tas desk)
153318 =/ yon (scot %ud aeon)
154319 ::
155− =/ dom .^(dome cv/~[her syd yon])
320+ =/ dom .^(domo cv/~[her syd yon])
156321 =/ tak ~| aeons=~(key by hit.dom)
157322 (scot %uv (~(got by hit.dom) aeon))
158323 =/ yak .^(yaki cs/~[her syd yon %yaki tak])
@@ -169,21 +334,6 @@
169334 ?. .^(? cu/pax)
170335 *(list dude)
171336 .^((list dude) cx/pax)
172−:: +adjust-dudes: which agents should be started and stopped
173−::
174−:: Will ask Gall to start agents that it's already running
175−:: but that should be ok, and might be safer in case other
176−:: unprocessed moves would have turned them off.
177−::
178−++ adjust-dudes
179− |= $: local=[our=ship =desk now=@da]
180− =rein
181− ==
182− ^- [jolt=(list dude) idle=(list dude)]
183− =/ all=(list dude) (read-bill local)
184− =/ want (get-apps-want local all rein)
185− =/ have (get-apps-live local)
186− [want (skip have ~(has in (sy want)))]
187337::
188338++ get-remote-diff
189339 |= [our=ship here=desk now=@da her=ship there=desk when=aeon]
@@ -209,39 +359,19 @@
209359 |= [our=ship =desk now=@da]
210360 ^- (list [=dude live=?])
211361 %~ tap in
212− .^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now))
213−:: +get-apps-want: find which apps should be running on a desk
214−::
215−++ get-apps-want
216− |= [local=[our=ship =desk now=@da] duz=(list dude) =rein]
217− ^- (list dude)
218− ?. liv.rein ~
219− ?. |(=(`zuse+zuse (read-kelvin-local local)) =(%base desk.local)) ~
220− =. duz (skip duz ~(has in sub.rein))
221− =. duz (weld duz (skip ~(tap in add.rein) ~(has in (sy duz))))
222− duz
362+ .^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now)/$)
223363::
224364++ mergebase-hashes
225− |= [our=@p =desk now=@da =arak]
226− ?~ rail.arak
227− ~
228− =/ her (scot %p ship.u.rail.arak)
365+ |= [our=@p syd=desk now=@da her=ship sud=desk]
366+ =/ her (scot %p her)
229367 =/ ego (scot %p our)
230368 =/ wen (scot %da now)
231− %+ turn .^((list tako) %cs ~[ego desk wen %base her desk.u.rail.arak])
232− |=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
369+ %+ turn .^((list tako) %cs /[ego]/[syd]/[wen]/base/[her]/[sud])
370+ |=(=tako .^(@uv %cs /[ego]/[syd]/[wen]/hash/(scot %uv tako)))
233371::
234372++ enjs
235373 =, enjs:format
236374 |%
237− ++ vats
238− |= v=(list ^vat)
239− ^- json
240− %- pairs
241− %+ turn v
242− |= va=^vat
243− [desk.va (vat va)]
244− ::
245375 ++ tim
246376 |= t=@
247377 ^- json
@@ -254,15 +384,6 @@
254384 da+(tim da.c)
255385 ==
256386 ::
257− ++ vat
258− |= v=^vat
259− %- pairs
260− :~ desk+s+desk.v
261− hash+s+(scot %uv hash.v)
262− cass+(cass cass.v)
263− arak+(arak arak.v)
264− ==
265− ::
266387 ++ weft
267388 |= w=^weft
268389 %- pairs
@@ -276,30 +397,5 @@
276397 :~ aeon+(numb aeon.r)
277398 weft+(weft weft.r)
278399 ==
279− ::
280− ++ rein
281− |= r=^rein
282− %- pairs
283− :~ add+a+(turn ~(tap in add.r) (lead %s))
284− sub+a+(turn ~(tap in sub.r) (lead %s))
285− ==
286− ::
287− ++ arak
288− |= a=^arak
289− %- pairs
290− :~ rail+?~(rail.a ~ (rail u.rail.a))
291− rein+(rein rein.a)
292− ==
293− ::
294− ++ rail
295− |= r=^rail
296− %- pairs
297− :~ ship+s+(scot %p ship.r)
298− publisher+?~(publisher.r ~ s+(scot %p u.publisher.r))
299− desk+s+desk.r
300− paused+b+paused.r
301− aeon+(numb aeon.r)
302− next+a+(turn next.r rung)
303− ==
304400 --
305401--