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

View File

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

View File

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

View File

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