ames: refactors %tune, supercedes %miss

This commit is contained in:
Joe Bryan 2023-04-21 10:43:30 -04:00
parent 15279e5267
commit 4d84131464
4 changed files with 54 additions and 38 deletions

View File

@ -1140,8 +1140,8 @@
[%lost ~]
[%send =lane =blob]
::
[%tune =path sign=@ux data=(unit (cask))]
[%miss =path]
[%tune [=ship =path] roar=(unit roar)]
[%miss =ship =path]
::
[%turf turfs=(list turf)]
==
@ -1344,9 +1344,8 @@
peep
==
+$ roar :: response message
$: sig=@
dat=$@(~ (cask))
==
(tale:pki:jael (pair path (unit (cask))))
:::
:: $qos: quality of service; how is our connection to a peer doing?
::
:: .last-contact: last time we heard from peer, or if %unborn, when
@ -3311,6 +3310,11 @@
+$ mind [who=ship lyf=life] :: key identifier
+$ name (pair @ta @t) :: ascii / unicode
+$ oath @ :: signature
++ tale :: urbit-signed *
|$ [typ] :: payload mold
$: dat=typ :: data
syg=(map ship (pair life oath)) :: signatures
== ::
-- :: pki
-- :: jael
:: ::::

View File

@ -305,12 +305,10 @@
::
++ sift-roar
|= [total=@ud hav=(list have)]
^- roar
^- [sig=@ux dat=$@(~ (cask))]
=/ mes=@
%+ rep response-size
%+ turn (flop hav)
|= =have
dat.have
(roll hav |=([=have dat=(list @ux)] [dat.have dat]))
=+ sig=(end 9 mes)
:- sig
=+ dat=(rsh 9 mes)
@ -3838,8 +3836,9 @@
++ fi-send
|=(=hoot fine(event-core (send-blob for=| her `@ux`hoot)))
::
++ fi-miss
|=([=^duct =_fine] (fi-emit:fine duct %give %miss fi-full-path))
++ fi-give-tune
|= dat=(unit roar)
|=([=^duct =_fine] (fi-emit:fine duct %give %tune [her path] dat))
::
+| %entry-points
::
@ -3902,12 +3901,17 @@
::
++ fi-unsub
|= [=^duct all=?]
?. |(all (~(has in listeners.keen) duct))
^+ fine
?: all
%- (fi-trace fin.veb |.("unsub all {<fi-full-path>}"))
(~(rep in listeners.keen) (fi-give-tune ~))
::
?: (~(has in listeners.keen) duct)
%- (fi-trace fin.veb |.("unsub {<fi-full-path>} on {<duct>}"))
fine(listeners.keen (~(del in listeners.keen) duct))
::
%. fine
(fi-trace fin.veb |.("unknown listener, skip"))
=? fine all (~(rep in listeners.keen) fi-miss)
%- (fi-trace fin.veb |.("deleting {<fi-full-path>}"))
fine(listeners.keen ?:(all ~ (~(del in listeners.keen) duct)))
(fi-trace fin.veb |.("unknown {<fi-full-path>} {<duct>}"))
::
+| %implementation
::
@ -3939,18 +3943,15 @@
::
++ fi-done
|= [sig=@ data=$@(~ (cask))]
=/ =gift
:: TODO define data in %tune as a (unit (unit cask))
:: and return ~ signaling a block, instead of %miss?
:: NOTE a %miss gift now represents that the request was dropped
=/ ful fi-full-path
=/ roar=(unit roar)
?. (meri:keys ful sig data)
~
:+ ~ [ful ?~(data ~ `data)]
[[her [life.peer-state sig]] ~ ~]
::
?. (meri:keys fi-full-path sig data)
[%miss fi-full-path]
[%tune fi-full-path sig ?~(data ~ `data)]
%- (fi-trace fin.veb |.("done {(spud fi-full-path)}"))
%- ~(rep in listeners.keen)
|= [=^duct =_fine]
(fi-emit:fine duct %give gift)
%- (fi-trace fin.veb |.("done {(spud ful)}"))
(~(rep in listeners.keen) (fi-give-tune roar))
::
++ fi-first-rcv
|= =meow

View File

@ -6145,15 +6145,24 @@
=? den ?=(%tune +<.hin)
(cancel-scry-timeout:den index)
abet:(take-foreign-answer:den index res)
::
?: ?=(%boon +<.hin) ;;((unit rand) payload.hin)
%+ bind data.hin
::
?~ roar.hin ~
%+ bind q.dat.u.roar.hin
|= =(cask)
^- rand
:: retrieve the request from the scry path
::
=+ (need (de-omen path.hin))
=/ =care ;;(care ?@(vis (rsh 3 vis) car.vis))
[[care r.bem q.bem] s.bem cask]
=/ pol=(pole knot) path.hin
?> ?=([%c car=care cas=@ta des=@tas pat=*] pol)
=/ =case (need (de-case cas.pol))
[[car.pol case des.pol] pat.pol cask]
:: XX this just looks wrong
::
:: =+ (need (de-omen path.hin))
:: =/ =care ;;(care ?@(vis (rsh 3 vis) car.vis))
:: [[care r.bem q.bem] s.bem cask]
[mos ..^$]
::
%wake
@ -6191,8 +6200,10 @@
::
=/ fell=(unit fell)
?: ?=(%boon +<.hin) `;;(fell payload.hin)
?~ data.hin ~
`[%direct (page-to-lobe u.data.hin) u.data.hin]
?~ roar.hin ~
?~ q.dat.u.roar.hin ~
=* pag u.q.dat.u.roar.hin
`[%direct (page-to-lobe pag) pag]
::
=^ mos ruf
=/ den ((de now rof hen ruf) her desk)

View File

@ -336,13 +336,13 @@
::
++ keen
|= [=ship =path]
=/ m (strand ,(unit (cask)))
=/ m (strand ,(unit roar:ames))
^- form:m
=/ =card:agent:gall [%pass /keen %arvo %a %keen ship path]
;< ~ bind:m (send-raw-card card)
;< [wire sign=sign-arvo] bind:m take-sign-arvo
?> ?=(%tune +<.sign)
(pure:m data.sign)
?> ?=([%ames %tune *] sign)
(pure:m roar.sign)
::
++ sleep
|= for=@dr