Merge branch 'develop' into next/kelvin/413

This commit is contained in:
Joe Bryan 2023-04-13 11:21:18 -04:00
commit f8305dee4b
12 changed files with 456 additions and 211 deletions

View File

@ -42,10 +42,9 @@
%- (slog leaf+"ping: strange state {<ship s>}" ~) %- (slog leaf+"ping: strange state {<ship s>}" ~)
`state `state
:: NAT timeouts are often pretty short for UDP entries. 5 :: NAT timeouts are often pretty short for UDP entries. 5
:: minutes is a common value. We use 30 seconds, which is fairly :: minutes is a common value. We use 25 seconds, same as Wireguard.
:: aggressive, but should be safe.
:: ::
=/ until (add ~s30 now) =/ until (add ~s25 now)
=. ships.state =. ships.state
(~(put by ships.state) ship u.s(ship-state [%waiting until])) (~(put by ships.state) ship u.s(ship-state [%waiting until]))
:_ state :_ state

View File

@ -5,7 +5,7 @@
:- %ask :- %ask
|= $: [now=@da eny=@uvJ bek=beak] |= $: [now=@da eny=@uvJ bek=beak]
[=desk ~] [=desk ~]
[from=$~(%base desk) hard=_|] [from=$~(%base desk) hard=_| gall=_|]
== ==
:: ::
=; make-new-desk =; make-new-desk
@ -27,12 +27,23 @@
%- ~(gas by *(map path page:clay)) %- ~(gas by *(map path page:clay))
|^ =- (turn - mage) |^ =- (turn - mage)
^- (list path) ^- (list path)
:~ /mar/noun/hoon =/ common-files=(list path) :~
/mar/noun/hoon
/mar/hoon/hoon /mar/hoon/hoon
/mar/txt/hoon /mar/txt/hoon
/mar/kelvin/hoon /mar/kelvin/hoon
/sys/kelvin /sys/kelvin
== ==
=/ extra-files=(list path) ?. gall [~]
:~
/mar/bill/hoon
/mar/mime/hoon
/mar/json/hoon
/lib/skeleton/hoon
/lib/default-agent/hoon
/lib/dbug/hoon
==
(weld common-files extra-files)
:: ::
++ mage ++ mage
|= =path |= =path

View File

@ -1,6 +1,11 @@
/- *hood /- *hood
:- %say :- %say
|= $: [now=@da eny=@uvJ bec=beak] |= $: [now=@da eny=@uvJ bec=beak]
[[=desk ~] ~] [syd=desk ~]
verb=?
== ==
[%tang ~[(report-vat (report-prep p.bec now) p.bec now desk)]] =+ ~(abed report-vats p.bec now)
=+ %+ report-vat
verb
%- vat-info syd
[%tang -]

View File

@ -1,6 +1,20 @@
/- *hood /- *hood
:- %say :- %say
|= $: [now=@da eny=@uvJ bec=beak] |= $: [now=@da eny=@uvJ bec=beak]
[arg=~ ~] $@(~ [?(%suspended %running %blocking %nonexistent) ~])
$: verb=?
show-suspended=?
show-running=?
show-blocking=?
show-nonexistent=?
== ==
[%tang (report-vats p.bec now)] ==
=+ :- verb
?~ +<+< +<+>+
?- -.+<+<
%suspended [& | | |]
%running [| & | |]
%blocking [| | & |]
%nonexistent [| | | &]
==
tang+((report-vats p.bec now) -)

View File

@ -773,6 +773,7 @@
:: ::
~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"] ~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"]
=/ compiler-tool =/ compiler-tool
~> %bout
.*([compiler-gate noun/hoon.log] [%9 2 %10 [6 %0 3] %0 2]) .*([compiler-gate noun/hoon.log] [%9 2 %10 [6 %0 3] %0 2])
:: ::
:: switch to the second-generation compiler. we want to be :: switch to the second-generation compiler. we want to be
@ -781,7 +782,7 @@
:: generate last-generation spans for `!>`, etc. :: generate last-generation spans for `!>`, etc.
:: ::
~> %slog.[0 leaf+"1-d"] ~> %slog.[0 leaf+"1-d"]
=. compiler-gate .*(0 +.compiler-tool) =. compiler-gate ~>(%bout .*(0 +.compiler-tool))
:: ::
:: get the span (type) of the kernel core, which is the context :: get the span (type) of the kernel core, which is the context
:: of the compiler gate. we just compiled the compiler, :: of the compiler gate. we just compiled the compiler,
@ -791,17 +792,20 @@
:: ::
~> %slog.[0 leaf+"1-e"] ~> %slog.[0 leaf+"1-e"]
=/ kernel-span =/ kernel-span
~> %bout
-:.*([compiler-gate -.compiler-tool '+>'] [%9 2 %10 [6 %0 3] %0 2]) -:.*([compiler-gate -.compiler-tool '+>'] [%9 2 %10 [6 %0 3] %0 2])
:: ::
:: compile the arvo source against the kernel core. :: compile the arvo source against the kernel core.
:: ::
~> %slog.[0 leaf+"1-f"] ~> %slog.[0 leaf+"1-f"]
=/ kernel-tool =/ kernel-tool
~> %bout
.*([compiler-gate kernel-span arvo.log] [%9 2 %10 [6 %0 3] %0 2]) .*([compiler-gate kernel-span arvo.log] [%9 2 %10 [6 %0 3] %0 2])
:: ::
:: create the arvo kernel, whose subject is the kernel core. :: create the arvo kernel, whose subject is the kernel core.
:: ::
~> %slog.[0 leaf+"1-g"] ~> %slog.[0 leaf+"1-g"]
~> %bout
[.*(+>.compiler-gate +.kernel-tool) epic.log] [.*(+>.compiler-gate +.kernel-tool) epic.log]
-- --
:: ::
@ -1046,6 +1050,7 @@
|= [cap=tape sub=vase pax=path txt=@t] |= [cap=tape sub=vase pax=path txt=@t]
^- vase ^- vase
~> %slog.[0 leaf/"{cap}: {(scow p+(mug txt))}"] ~> %slog.[0 leaf/"{cap}: {(scow p+(mug txt))}"]
~> %bout
%- road |. %- road |.
~_ leaf/"{cap}: build failed" ~_ leaf/"{cap}: build failed"
(slap sub (rain pax txt)) (slap sub (rain pax txt))
@ -1623,6 +1628,7 @@
?~ hun ?~ hun
=/ gat =/ gat
~> %slog.[0 'arvo: compiling next arvo'] ~> %slog.[0 'arvo: compiling next arvo']
~> %bout
%- road |. %- road |.
(slap !>(..ride) (rain /sys/arvo/hoon van)) (slap !>(..ride) (rain /sys/arvo/hoon van))
=/ lod =/ lod
@ -1640,6 +1646,7 @@
:: ::
=/ raw =/ raw
~> %slog.[0 'arvo: compiling hoon'] ~> %slog.[0 'arvo: compiling hoon']
~> %bout
(road |.((ride %noun u.hun))) (road |.((ride %noun u.hun)))
:: activate the new compiler gate, producing +ride :: activate the new compiler gate, producing +ride
:: ::
@ -1665,6 +1672,7 @@
[raw cop] [raw cop]
=/ hot =/ hot
~> %slog.[0 leaf/"arvo: recompiling hoon %{(scow %ud nex)}"] ~> %slog.[0 leaf/"arvo: recompiling hoon %{(scow %ud nex)}"]
~> %bout
(road |.((slum cop [%noun u.hun]))) (road |.((slum cop [%noun u.hun])))
[hot .*(0 +.hot)] [hot .*(0 +.hot)]
:: extract the hoon core from the outer gate (+ride) :: extract the hoon core from the outer gate (+ride)
@ -1680,6 +1688,7 @@
:: ::
=/ rav =/ rav
~> %slog.[0 'arvo: compiling next arvo'] ~> %slog.[0 'arvo: compiling next arvo']
~> %bout
(road |.((slum cop [hyp van]))) (road |.((slum cop [hyp van])))
:: activate arvo and extract the arvo core from the outer gate :: activate arvo and extract the arvo core from the outer gate
:: ::

View File

@ -3310,13 +3310,19 @@
++ num-slots ++ num-slots
^- @ud ^- @ud
(sub-safe cwnd live-packets) (sub-safe cwnd live-packets)
::
:: +clamp-rto: apply min and max to an .rto value :: +clamp-rto: apply min and max to an .rto value
:: ::
++ clamp-rto ++ clamp-rto
|= rto=@dr |= rto=@dr
^+ rto ^+ rto
(min ~m2 (max ^~((div ~s1 5)) rto)) (min max-backoff (max ^~((div ~s1 5)) rto))
:: +max-backoff: calculate highest re-send interval
::
:: Keeps pinhole to sponsors open by inspecting the duct (hack).
::
++ max-backoff
^- @dr
?:(?=([[%gall %use %ping *] *] duct) ~s25 ~m2)
:: +in-slow-start: %.y iff we're in "slow-start" mode :: +in-slow-start: %.y iff we're in "slow-start" mode
:: ::
++ in-slow-start ++ in-slow-start
@ -3963,6 +3969,7 @@
:: /ax/protocol/version @ :: /ax/protocol/version @
:: /ax/peers (map ship ?(%alien %known)) :: /ax/peers (map ship ?(%alien %known))
:: /ax/peers/[ship] ship-state :: /ax/peers/[ship] ship-state
:: /ax/peers/[ship]/last-contact (unit @da)
:: /ax/peers/[ship]/forward-lane (list lane) :: /ax/peers/[ship]/forward-lane (list lane)
:: /ax/bones/[ship] [snd=(set bone) rcv=(set bone)] :: /ax/bones/[ship] [snd=(set bone) rcv=(set bone)]
:: /ax/snd-bones/[ship]/[bone] vase :: /ax/snd-bones/[ship]/[bone] vase
@ -3987,6 +3994,13 @@
?~ peer ?~ peer
[~ ~] [~ ~]
``noun+!>(u.peer) ``noun+!>(u.peer)
::
[%last-contact ~]
:^ ~ ~ %noun
!> ^- (unit @da)
?. ?=([~ %known *] peer)
~
`last-contact.qos.u.peer
:: ::
[%forward-lane ~] [%forward-lane ~]
:: ::

View File

@ -108,10 +108,9 @@
[duct card] [duct card]
=/ =tang =/ =tang
(weld u.error `tang`[leaf/"drip failed" ~]) (weld u.error `tang`[leaf/"drip failed" ~])
:: XX should be :: XX we don't know the mote due to the %wake pattern
:: [duct %hurl fail/tang card]
:: ::
[duct %pass /drip-slog %d %flog %crud %drip-fail tang] [duct %hurl fail/tang card]
:: ::
+| %tasks +| %tasks
:: ::

View File

@ -1384,7 +1384,7 @@
`[[care.mood case.mood syd] path.mood cage]:[u.res syd=syd] `[[care.mood case.mood syd] path.mood cage]:[u.res syd=syd]
?~ ref ?~ ref
[%give %writ riot] [%give %writ riot]
[%slip %b %drip !>([%writ riot])] [%pass /drip %b %drip !>([%writ riot])]
:: ::
++ case-to-date ++ case-to-date
|= =case |= =case
@ -3781,7 +3781,7 @@
(~(run in moods) |=(m=mood [care.m path.m])) (~(run in moods) |=(m=mood [care.m path.m]))
=/ gift [%wris cas res] =/ gift [%wris cas res]
?: ?=(^ ref) ?: ?=(^ ref)
[%slip %b %drip !>(gift)] [%pass /drip %b %drip !>(gift)] :: XX s/b [%behn %wris ...] in $sign?
[%give gift] [%give gift]
?> ?=([* ~ ~] res) ?> ?=([* ~ ~] res)
:_ ~ :_ ~
@ -5753,7 +5753,25 @@
|= [tea=wire hen=duct dud=(unit goof) hin=sign] |= [tea=wire hen=duct dud=(unit goof) hin=sign]
^+ [*(list move) ..^$] ^+ [*(list move) ..^$]
?^ dud ?^ dud
?+ tea
~|(%clay-take-dud (mean tang.u.dud)) ~|(%clay-take-dud (mean tang.u.dud))
::
[%drip ~]
%. [~ ..^$]
%- slog
^- tang
:* 'clay: drip fail'
[%rose [": " "" ""] 'bail' mote.u.dud ~]
tang.u.dud
==
==
::
:: pseudo %slip on %drip
::
?: ?=([%drip ~] tea)
?> ?=([?(%behn %clay) ?(%writ %wris) *] hin)
[[`move`[hen %give +.hin] ~] ..^$]
::
?: ?=([%lu %load *] tea) ?: ?=([%lu %load *] tea)
?> ?=(%unto +<.hin) ?> ?=(%unto +<.hin)
?> ?=(%poke-ack -.p.hin) ?> ?=(%poke-ack -.p.hin)
@ -5909,7 +5927,7 @@
~(tap in ducts) ~(tap in ducts)
=/ cancel-moves=(list move) =/ cancel-moves=(list move)
%+ turn cancel-ducts %+ turn cancel-ducts
|=(=duct [duct %slip %b %drip !>([%writ ~])]) |=(=duct [duct %pass /drip %b %drip !>([%writ ~])])
:: delete local state of foreign desk :: delete local state of foreign desk
:: ::
=. hoy.ruf (~(del by hoy.ruf) who) =. hoy.ruf (~(del by hoy.ruf) who)

View File

@ -250,8 +250,10 @@
wrapped-task=(hobo task) wrapped-task=(hobo task)
== ==
^+ [*(list move) ..^$] ^+ [*(list move) ..^$]
=/ task=task
~| wrapped-task ~| wrapped-task
=/ task=task ((harden task) wrapped-task) ((harden task) wrapped-task)
~| -.task
:: unwrap session tasks, default to session %$ :: unwrap session tasks, default to session %$
:: ::
=^ ses=@tas task =^ ses=@tas task

View File

@ -40,75 +40,119 @@
|* [=(lake) paths=mold] |* [=(lake) paths=mold]
=> =>
|% |%
+$ flow [=aeon fail=_| =rock:lake] +$ from (on-rock:poke lake paths)
+$ into (response:poke lake paths)
+$ result (request:poke paths)
+$ fail [paths ship dude]
+$ flow [=aeon stale=_| fail=_| =rock:lake]
+$ subs [%0 (map [ship dude paths] (unit flow))]
-- --
|_ [sub=(map [ship dude paths] flow) =bowl:gall result-type=type on-rock-type=type] |= $: sub=subs
++ surf pine :: Subscribe to [ship dude path]. =bowl:gall
result-type=type
on-rock-type=type
fail-type=type
==
=> .(sub +.sub)
|%
++ surf :: Subscribe to [ship dude path].
|= which=[ship dude paths]
^- (quip card:agent:gall subs)
?+ flow=(~(get by sub) which) `0/sub
~ [~[(pine which)] 0/(~(put by sub) which ~)]
[~ ~] [~[(pine which)] 0/sub]
[~ ~ [* %& * *]] [~[(scry `+(aeon.u.u.flow) which)] 0/sub]
==
++ quit (corl (lead %0) ~(del by sub)) :: Unsub from [ship dude path].
++ read :: See current subscribed states. ++ read :: See current subscribed states.
^- (map [ship dude paths] [fail=? rock:lake]) ^- (map [ship dude paths] [stale=? fail=? =rock:lake])
%- ~(run by sub) %- malt %+ murn ~(tap by sub)
|= =flow |= [key=[ship dude paths] val=(unit flow)]
[fail rock]:flow ?~ val ~
:: :: Check poke-acks for errors. `[key +.u.val]
:: :: Check poke-ack for errors.
:: :: If an %sss-on-rock poke nacks, :: :: If an %sss-on-rock poke nacks,
++ chit :: that state is flagged as failed. ++ chit :: that state is flagged as failed.
|= [[aeon=term ship=term dude=term path=paths] =sign:agent:gall] |= [[aeon=term ship=term dude=term path=paths] =sign:agent:gall]
^+ sub ^- subs
:- %0
?> ?=(%poke-ack -.sign) ?> ?=(%poke-ack -.sign)
?~ p.sign sub ?~ p.sign sub
%+ ~(jab by sub) [(slav %p ship) dude path] %+ ~(jab by sub) [(slav %p ship) dude path]
|= =flow |= (unit flow)
=/ =flow (need +<)
?> =(aeon.flow (slav %ud aeon)) ?> =(aeon.flow (slav %ud aeon))
flow(fail &) `flow(fail &)
:: :: Check poke-ack for errors.
:: :: If a scry request nacks,
++ tell :: that state is flagged as stale.
|= [[ship=term =dude aeon=term path=paths] =sign:agent:gall]
^- (quip card:agent:gall subs)
?> ?=(%poke-ack -.sign)
?~ p.sign `0/sub
=/ current [ship=(slav %p ship) dude=dude path=path]
?+ flow=(~(get by sub) current) `0/sub
[~ ~ *]
=. stale.u.u.flow &
:_ 0/(~(put by sub) current u.flow)
~[(on-rock-poke current u.u.flow ~)]
::
[~ ~]
:_ 0/(~(del by sub) current) :_ ~
:* %pass (zoom surf-fail/aeon/ship/dude/path)
%agent [our dap]:bowl
%poke %sss-surf-fail fail-type ^- fail
[path ship dude]:current
==
==
:: :: Check if we're still interested :: :: Check if we're still interested
:: :: in a wave. If no, no-op. :: :: in a wave. If no, no-op.
:: :: If yes, scry. :: :: If yes, scry.
++ behn :: (See https://gist.github.com/belisarius222/7f8452bfea9b199c0ed717ab1778f35b) ++ behn :: (See https://gist.github.com/belisarius222/7f8452bfea9b199c0ed717ab1778f35b)
|= [ship=term =dude aeon=term path=paths] |= [ship=term =dude aeon=term path=paths]
^- (list card:agent:gall) ^- (list card:agent:gall)
%- fall :_ ~ %- mole |.
=/ ship (slav %p ship) =/ ship (slav %p ship)
=/ aeon (slav %ud aeon) =/ aeon (slav %ud aeon)
?: (lte aeon aeon:(~(got by sub) ship dude path)) ~ ?: (lte aeon aeon:(fall (~(got by sub) ship dude path) *flow)) ~
~[(scry `aeon ship dude path)] ~[(scry `aeon ship dude path)]
:: ::
++ apply :: Handle response from publisher. ++ apply :: Handle response from publisher.
|= res=(response:poke lake paths) |= res=(response:poke lake paths)
^- (quip card:agent:gall _sub) ^- (quip card:agent:gall subs)
%- fall :_ `0/sub %- mole |.
=* current [src.bowl dude.res path.res]
=/ old=flow (fall (~(got by sub) current) *flow)
?- type.res ?- type.res
%tomb
=/ =flow old(stale &)
:_ 0/(~(put by sub) current `flow) :_ ~
(on-rock-poke current flow ~)
::
%yore %yore
:_ sub :_ ~ :_ 0/sub :_ ~
(pine src.bowl dude.res path.res) (pine src.bowl dude.res path.res)
:: ::
%nigh %nigh
:_ sub :_ ~ :_ 0/sub :_ ~
(behn-s25 [dude aeon path]:res) (behn-s25 [dude aeon path]:res)
:: ::
%scry %scry
=* current [src.bowl dude.res path.res]
=/ [wave=(unit wave:lake) =flow] =/ [wave=(unit wave:lake) =flow]
=/ old=flow (~(gut by sub) current *flow)
?- what.res ?- what.res
%rock ?> (gte aeon.res aeon.old) %rock ?> (gte aeon.res aeon.old)
`[aeon.res | rock.res] [~ [aeon.res | | rock.res]]
%wave ~| [%weird-wave res=res old=old] %wave ?> =(aeon.res +(aeon.old))
?> =(aeon.res +(aeon.old)) [`wave.res [aeon.res | | (wash:lake rock.old wave.res)]]
[`wave.res [aeon.res | (wash:lake rock.old wave.res)]] ==
:_ 0/(~(put by sub) current `flow)
:~ (on-rock-poke current flow wave)
(scry `+(aeon.res) src.bowl dude.res path.res)
== ==
:_ (~(put by sub) current flow)
%- flop
:~ (scry `+(aeon.res) src.bowl dude.res path.res)
:* %pass (zoom on-rock/(scot %ud aeon.flow)^(scot %p src.bowl)^dude.res^path.res)
%agent [our dap]:bowl
%poke %sss-on-rock on-rock-type ^- from
[path.res src.bowl dude.res rock.flow wave]
== ==
== ==
:: ::
:: Non-public facing arms below :: Non-public facing arms below
:: ::
+$ from (on-rock:poke lake paths)
+$ into (response:poke lake paths)
+$ result (request:poke paths)
++ behn-s25 ++ behn-s25
|= [=dude =aeon path=noun] |= [=dude =aeon path=noun]
^- card:agent:gall ^- card:agent:gall
@ -119,71 +163,130 @@
++ scry ++ scry
|= [when=(unit aeon) who=ship which=dude where=paths] |= [when=(unit aeon) who=ship which=dude where=paths]
^- card:agent:gall ^- card:agent:gall
=/ when ?~ when %~ (scot %ud u.when) =/ when ?~ when ~ (scot %ud u.when)
:* %pass (zoom request/scry/(scot %p who)^which^when^where) :* %pass (zoom scry-request/(scot %p who)^which^when^where)
%agent [who which] %agent [who which]
%poke %sss-to-pub :- result-type ^- result %poke %sss-to-pub :- result-type ^- result
[where which ^when] [where dap.bowl ^when]
==
++ on-rock-poke
|= [[=ship =dude path=paths] flow wave=(unit wave:lake)]
^- card:agent:gall
:* %pass (zoom on-rock/(scot %ud aeon)^(scot %p ship)^dude^path)
%agent [our dap]:bowl
%poke %sss-on-rock on-rock-type ^- from
[path ship dude stale fail rock wave]
== ==
-- --
++ du :: Manage publications. ++ du :: Manage publications.
|* [=(lake) paths=mold] |* [=(lake) paths=mold]
=> =>
|% |%
+$ into (request:poke paths)
+$ result (response:poke lake paths)
+$ rule [rocks=_1 waves=_5] :: Retention policy +$ rule [rocks=_1 waves=_5] :: Retention policy
+$ tide +$ tide
$: rok=((mop aeon rock:lake) gte) $: rok=((mop aeon rock:lake) gte)
wav=((mop aeon wave:lake) lte) wav=((mop aeon wave:lake) lte)
rul=rule rul=rule
mem=(mip aeon [ship dude] @da) mem=(mip ship dude @da)
== ==
+$ buoy
$: tid=$~(*tide $@(aeon tide))
alo=(unit (set ship))
==
+$ pubs [%0 (map paths buoy)]
-- --
|_ [pub=(map paths tide) =bowl:gall result-type=type] |= [pub=pubs =bowl:gall result-type=type]
+* rok ((on aeon rock:lake) gte) => .(pub +.pub)
wav ((on aeon wave:lake) lte) =* rok ((on aeon rock:lake) gte)
:: =* wav ((on aeon wave:lake) lte)
|%
++ rule :: Set new retention policy. ++ rule :: Set new retention policy.
|= [path=paths =^rule] |= [path=paths =^rule]
^+ pub ^- pubs
:- %0
%+ ~(jab by pub) path %+ ~(jab by pub) path
|= =tide |= =buoy
(form tide(rul rule)) ?@ tid.buoy buoy
buoy(tid (form tid.buoy(rul rule)))
:: ::
++ wipe :: Create new rock and wipe rest. ++ wipe :: Create new rock and wipe rest.
|= path=paths |= path=paths
^+ pub ^- pubs
:- %0
%+ ~(jab by pub) path %+ ~(jab by pub) path
|= =tide |= =buoy
%* . (form tide(rul [0 1])) ?@ tid.buoy buoy
rul rul.tide %* . buoy(tid (form tid.buoy(rul [0 1])))
wav ~ rul.tid rul.tid.buoy
wav.tid ~
== ==
++ give :: Give a wave on a path. ++ give :: Give a wave on a path.
|= [path=paths =wave:lake] |= [path=paths =wave:lake]
^- (quip card:agent:gall _pub) ^- (quip card:agent:gall pubs)
?~ ;;((soft ^path) path) ~| %need-path !! ?~ ((soft ^path) path) ~| %need-path !!
=/ =tide (~(gut by pub) path *tide) =/ buoy (~(gut by pub) path *buoy)
=/ next=aeon ?@ tide=tid.buoy ~| %dead-path !! ::TODO is this good behavior?
.+ %+ max =/ next=aeon +((latest tide))
(fall (bind (pry:rok rok.tide) head) 0) :- %+ murn ~(tap bi mem.tide)
(fall (bind (ram:wav wav.tide) head) 0) |= [=ship =dude =@da]
:: ?: (lth da now.bowl) ~
:_ %+ ~(put by pub) path `(send scry/wave/wave ship dude next path)
:- %0
%+ ~(put by pub) path
=/ last=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok) =/ last=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok)
=. wav.tide (put:wav wav.tide next wave) =. wav.tide (put:wav wav.tide next wave)
=. mem.tide (~(del by mem.tide) next) =. mem.tide (~(del by mem.tide) next)
?. =(next (add aeon.last waves.rul.tide)) tide ?. =(next (add aeon.last waves.rul.tide)) buoy
(form tide) buoy(tid (form tide))
::
++ perm :: Change permissions with gate.
|= [where=(list paths) diff=$-((unit (set ship)) (unit (set ship)))]
^- pubs
%+ edit where
|= =buoy
=/ new=_alo.buoy (diff alo.buoy)
?@ tid.buoy buoy(alo new)
%= buoy
alo new
mem.tid ?~ new mem.tid.buoy
%. mem.tid.buoy
~(int by (malt (turn ~(tap in u.new) (late *(map @ @)))))
==
++ public (curr perm _~) :: Make list of paths public.
++ secret (curr perm _`~) :: Make list of paths secret.
:: :: Block ships from paths.
++ block :: No-ops on public paths.
|= [who=(list ship) whence=(list paths)]
^- pubs
%+ perm whence
|= old=(unit (set ship))
?~ old ~ `(~(dif in u.old) (sy who))
:: :: Allow ships to paths.
++ allow :: Any public paths will no-op.
|= [who=(list ship) where=(list paths)]
^- pubs
%+ perm where
|= old=(unit (set ship))
?~ old ~ `(~(gas in u.old) who)
:: :: Kill a list of paths, i.e. tell
++ kill :: subs to not expect updates.
(curr edit |=(=buoy buoy(tid (latest tid.buoy))))
:: :: Reopen list of killed paths.
++ live :: No-ops on live paths.
%+ curr edit
|= =buoy
?^ tid.buoy buoy
%*(. buoy(tid *tide) rok.tid (put:rok ~ +(tid.buoy) *rock:lake))
:: ::
%+ murn ~(tap by (~(gut by mem.tide) next ~))
|= [[=ship =dude] =@da]
?: (lth da now.bowl) ~
`(send scry/wave/wave ship dude next path)
++ read :: See current published states. ++ read :: See current published states.
^- (map paths rock:lake) ^- (map paths [allowed=(unit (set ship)) =rock:lake])
%- ~(run by pub) %- malt %+ murn ~(tap by pub)
|= =tide |= [path=paths =buoy]
=< rock ^- (unit [paths (unit (set ship)) rock:lake])
?@ tide=tid.buoy ~
:^ ~ path alo.buoy =< rock
=/ snap=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok) =/ snap=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok)
%+ roll (tap:wav (lot:wav wav.tide `aeon.snap ~)) %+ roll (tap:wav (lot:wav wav.tide `aeon.snap ~))
|= [[=aeon =wave:lake] =_snap] |= [[=aeon =wave:lake] =_snap]
@ -192,39 +295,58 @@
:: ::
++ apply :: Handle request from subscriber. ++ apply :: Handle request from subscriber.
|= req=(request:poke paths) |= req=(request:poke paths)
^- (quip card:agent:gall _pub) ^- (quip card:agent:gall pubs)
=/ =tide (~(gut by pub) path.req *tide) =/ =buoy (~(gut by pub) path.req *buoy)
?< &(?=(^ alo.buoy) !(~(has in u.alo.buoy) src.bowl))
?@ tid.buoy
:_ 0/pub :_ ~
(send tomb/~ src.bowl dude.req tid.buoy path.req)
?~ when.req ?~ when.req
=/ last (fall (pry:rok rok.tide) *[=key =val]:rok) =/ last (fall (pry:rok rok.tid.buoy) *[=key =val]:rok)
:_ pub :_ ~ :_ 0/pub :_ ~
(send scry/rock/val.last src.bowl dude.req key.last path.req) (send scry/rock/val.last src.bowl dude.req key.last path.req)
?^ dat=(get:wav wav.tide u.when.req) ?^ dat=(get:wav wav.tid.buoy u.when.req)
:_ pub :_ ~ :_ 0/pub :_ ~
(send scry/wave/u.dat src.bowl [dude u.when path]:req) (send scry/wave/u.dat src.bowl [dude u.when path]:req)
?: %+ lte u.when.req ?: %+ lte u.when.req
key::(fall (ram:wav wav.tide) (pry:rok rok.tide) [=key val]:wav) key::(fall (ram:wav wav.tid.buoy) (pry:rok rok.tid.buoy) [=key val]:wav)
:_ pub :_ ~ :_ 0/pub :_ ~
(send yore/~ src.bowl [dude u.when path]:req) (send yore/~ src.bowl [dude u.when path]:req)
?> =(u.when.req +((latest tid.buoy)))
:- ~[(send nigh/~ src.bowl [dude u.when path]:req)] :- ~[(send nigh/~ src.bowl [dude u.when path]:req)]
:- %0
%+ ~(put by pub) path.req %+ ~(put by pub) path.req
%= tide mem %= buoy
%^ ~(put bi mem.tide) u.when.req [src.bowl dude.req] mem.tid (~(put bi mem.tid.buoy) src.bowl dude.req (add ~s25 now.bowl))
(add ~s25 now.bowl)
== ==
:: ::
:: Non-public facing arms below :: Non-public facing arms below
:: ::
+$ into (request:poke paths)
+$ result (response:poke lake paths)
++ send ++ send
|= [payload=_|3:*(response:poke lake paths) =ship =dude =aeon path=paths] |= [payload=_|3:*(response:poke lake paths) =ship =dude =aeon path=paths]
^- card:agent:gall ^- card:agent:gall
=* mark (cat 3 %sss- name:lake) =* mark (cat 3 %sss- name:lake)
:* %pass (zoom response/scry/(scot %p ship)^dude^(scot %ud aeon)^path) :* %pass (zoom scry-response/(scot %p ship)^dude^(scot %ud aeon)^path)
%agent [ship dude] %agent [ship dude]
%poke mark result-type ^- (response:poke lake paths) %poke mark result-type ^- (response:poke lake paths)
[path dap.bowl aeon payload] [path dap.bowl aeon payload]
== ==
++ latest
|= =$@(aeon tide)
^- aeon
?@ tide tide
%+ max (fall (bind (pry:rok rok.tide) head) 0)
(fall (bind (ram:wav wav.tide) head) 0)
::
++ edit
|= [ps=(list paths) edit=$-(buoy buoy)]
^- pubs
:- %0
%- ~(rep in (sy ps))
|= [path=paths =_pub]
%- fall :_ pub %- mole |.
(~(jab by pub) path edit)
::
++ form ++ form
|= =tide |= =tide
^+ tide ^+ tide

View File

@ -16,73 +16,76 @@
:: ::
+$ sync-state [nun=@ta kid=(unit desk) let=@ud] +$ sync-state [nun=@ta kid=(unit desk) let=@ud]
+$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud]) +$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud])
:: +report-prep: get data required for reports ++ report-vats
:: =| $: =cone
++ report-prep sor=(map desk [ship desk])
|= [our=@p now=@da] zyn=(map [desk ship desk] sync-state)
=/ ego (scot %p our) desks=(set desk)
=/ wen (scot %da now) =pikes
:* .^(rock:tire %cx /(scot %p our)//(scot %da now)/tire) =rock:tire:clay
.^(=cone %cx /(scot %p our)//(scot %da now)/domes) kel=weft
.^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun) ==
.^ (map [desk ship desk] sync-state) %gx |_ [our=@p now=@da]
+* ego (scot %p our)
wen (scot %da now)
++ $
|= [? ? ? ? ?]
(report-vats:abed +<)
::
++ kel-path
|= =desk
^- path
/[ego]/[desk]/[wen]/sys/kelvin
::
++ desk-exists
|= =desk
?& !=(ud.cass 0):.^(=cass %cw /[ego]/[desk]/[wen])
.^(? %cu (kel-path desk))
==
::
++ abed
%= ..abed
cone .^(^cone %cx /[ego]//[wen]/domes)
sor .^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun)
zyn .^ (map [desk ship desk] sync-state) %gx
/[ego]/hood/[wen]/kiln/syncs/noun /[ego]/hood/[wen]/kiln/syncs/noun
== ==
desks .^((set desk) %cd /[ego]/base/[wen])
pikes .^(^pikes %gx /[ego]/hood/[wen]/kiln/pikes/kiln-pikes)
rock .^(rock:tire:clay %cx /[ego]//[wen]/tire)
kel (weft .^(* cx/(en-beam [our %base da+now] /sys/kelvin)))
== ==
:: +report-vats: report on all desk installations ++ vat-info
:: |= desk=_`desk`%base
++ report-vats =/ pike (~(got by pikes) desk)
|= [our=@p now=@da] =/ zest -:(~(got by rock) desk)
^- tang =/ kel-path (kel-path desk)
=/ desks .^((set desk) %cd /(scot %p our)/base/(scot %da now)) =/ sink=sink
=/ prep (report-prep our now) ?~ s=(~(get by sor) desk)
%+ turn ~(tap in desks)
|=(syd=desk (report-vat prep our now syd))
:: +report-vat: report on a single desk installation
::
++ report-vat
|= $: $: tyr=rock:tire =cone sor=(map desk [ship desk])
zyn=(map [desk ship desk] sync-state)
==
our=ship now=@da syd=desk
==
^- tank
=/ ego (scot %p our)
=/ wen (scot %da now)
=+ .^(=cass %cw /[ego]/[syd]/[wen])
?: =(ud.cass 0)
leaf+"desk does not yet exist: {<syd>}"
?: =(%kids syd)
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
leaf+"%kids %cz hash: {<hash>}"
=/ kel-path
/[ego]/[syd]/[wen]/sys/kelvin
?. .^(? %cu kel-path)
leaf+"bad desk: {<syd>}"
=+ .^(=waft %cx kel-path)
:+ %rose ["" "{<syd>}" "::"]
^- tang
=/ hash .^(@uv %cz /[ego]/[syd]/[wen])
=/ =sink
?~ s=(~(get by sor) syd)
~ ~
?~ z=(~(get by zyn) syd u.s) ?~ z=(~(get by zyn) desk u.s)
~ ~
`[-.u.s +.u.s +.u.z] `[-.u.s +.u.s +.u.z]
=/ meb=(list @uv) =/ hash .^(@uv %cz /[ego]/[desk]/[wen])
=/ dek (~(got by rock) desk)
=/ =dome (~(got by cone) our desk)
=+ .^(=waft %cx kel-path)
:* &1 &2 &3 &4 &5 &6 &7 &8
desk=desk
^= running =(%live zest)
^= suspended =(%dead zest)
^= meb :: =(list @uv)
?~ sink [hash]~ ?~ sink [hash]~
(mergebase-hashes our syd now her.u.sink sud.u.sink) (mergebase-hashes our desk now her.u.sink sud.u.sink)
=/ dek (~(got by tyr) syd) ^- [on=(list [@tas ?]) of=(list [@tas ?])]
=/ =dome (~(got by cone) our syd)
=/ [on=(list [@tas ?]) of=(list [@tas ?])]
(skid ~(tap by ren.dome) |=([* ?] +<+)) (skid ~(tap by ren.dome) |=([* ?] +<+))
=/ sat ^= sat
?- zest.dek ?- zest.dek
%live "running" %live "running"
%dead "suspended" %dead "suspended"
%held "suspended until next update" %held "suspended until next update"
== ==
=/ kul=tape ^- kul=tape
%+ roll %+ roll
%+ sort %+ sort
~(tap in (waft-to-wefts:clay waft)) ~(tap in (waft-to-wefts:clay waft))
@ -92,6 +95,53 @@
(lte lal.a lal.b) (lte lal.a lal.b)
|= [=weft =tape] |= [=weft =tape]
(welp " {<[lal num]:weft>}" tape) (welp " {<[lal num]:weft>}" tape)
^= blocking
?& !=(%base desk)
!=(%live zest.pike)
!(~(has in wic.pike) kel)
== ==
::
++ report-vats
|= $: verb=?
show-suspended=?
show-running=?
show-blocking=?
show-nonexistent=?
==
=/ [real=(list desk) fake=(list desk)]
(skid ~(tap in desks) desk-exists)
=; reals=tang
?. show-nonexistent
reals
%+ weld reals
`tang`(turn fake |=(=desk leaf+"nonexistent desk: {<desk>}"))
%+ turn
%+ skim (turn real vat-info)
|= vat-info
?| &(suspended show-suspended)
&(running show-running)
&(blocking show-blocking)
==
|= =vat-info
^- tank
:+ %rose [" " " " "::"]
:- leaf+"{<desk.vat-info>}"
%- flop
%- report-vat
[verb vat-info]
::
++ report-vat
|= [verb=? vat-info]
^- tang
?: =(%kids desk)
~[leaf+"%kids %cz hash: {<hash>}"]
%- flop
?. verb
:~ leaf/"/sys/kelvin: {kul}"
leaf/"app status: {sat}"
leaf/"publishing ship: {?~(sink <~> <(get-publisher our desk now)>)}"
leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}"
==
:~ leaf/"/sys/kelvin: {kul}" :~ leaf/"/sys/kelvin: {kul}"
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}" leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
leaf/"%cz hash: {<hash>}" leaf/"%cz hash: {<hash>}"
@ -100,7 +150,7 @@
leaf/"force on: {?:(=(~ on) "~" <on>)}" leaf/"force on: {?:(=(~ on) "~" <on>)}"
leaf/"force off: {?:(=(~ of) "~" <of>)}" leaf/"force off: {?:(=(~ of) "~" <of>)}"
:: ::
leaf/"publishing ship: {?~(sink <~> <(get-publisher our syd now)>)}" leaf/"publishing ship: {?~(sink <~> <(get-publisher our desk now)>)}"
leaf/"updates: {?~(sink "local" "remote")}" leaf/"updates: {?~(sink "local" "remote")}"
leaf/"source ship: {?~(sink <~> <her.u.sink>)}" leaf/"source ship: {?~(sink <~> <her.u.sink>)}"
leaf/"source desk: {?~(sink <~> <sud.u.sink>)}" leaf/"source desk: {?~(sink <~> <sud.u.sink>)}"
@ -108,18 +158,13 @@
leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> <u.kid.u.sink>))}" leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> <u.kid.u.sink>))}"
leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}" leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}"
== ==
:: +report-kids: non-vat cz hash report for kids desk ++ report-kids
::
++ report-kids
|= [our=ship now=@da]
^- tank ^- tank
=/ syd %kids ?. (~(has in .^((set desk) %cd /[ego]//[wen])) %kids)
=/ ego (scot %p our)
=/ wen (scot %da now)
?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd)
leaf/"no %kids desk" leaf/"no %kids desk"
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen]) =+ .^(hash=@uv %cz /[ego]/kids/[wen])
leaf/"%kids %cz hash: {<hash>}" leaf/"%kids %cz hash: {<hash>}"
--
:: +read-bill-foreign: read /desk/bill from a foreign desk :: +read-bill-foreign: read /desk/bill from a foreign desk
:: ::
++ read-bill-foreign ++ read-bill-foreign

View File

@ -24,13 +24,20 @@
$: path=paths $: path=paths
=dude =dude
=aeon =aeon
$% [type=?(%nigh %yore) ~] $% [type=?(%nigh %yore %tomb) ~]
$: type=%scry $: type=%scry
$% [what=%rock =rock:lake] $% [what=%rock =rock:lake]
[what=%wave =wave:lake] [what=%wave =wave:lake]
== == == == == == == ==
++ on-rock ++ on-rock
|* [=(lake) paths=mold] |* [=(lake) paths=mold]
,[path=paths src=ship from=dude =rock:lake wave=(unit wave:lake)] $: path=paths
src=ship
from=dude
stale=?
fail=?
=rock:lake
wave=(unit wave:lake)
==
-- --
-- --