strandio: add +keen gate

This commit is contained in:
Liam Fitzgerald 2022-02-24 12:03:07 -06:00
parent 801ef4b89e
commit b4da246f01
4 changed files with 40 additions and 5 deletions

View File

@ -524,7 +524,7 @@
:~ 'messages'^(numb (lent messages))
'packets'^(numb ~(wyt in packets))
'heeds'^(set-array heeds from-duct)
'keens'^(set-array keens path)
'keens'^(set-array ~(key by keens) path)
==
::
:: json for known peer is structured to closely match the peer-state type.

View File

@ -2707,6 +2707,7 @@
::
++ ke-done
|= [sig=@ data=$@(~ (cask))]
~& path
?> (meri:keys ship life.peer path sig data)
~& got-response/path
=/ listeners ~(tap in listeners.keen)

View File

@ -6,7 +6,16 @@
=/ m (strand ,vase)
^- form:m
=+ !<([~ arg=path] arg)
;< ~ bind:m (send-raw-card:strandio %pass / %arvo %a %keen arg)
;< [wire sign=sign-arvo] bind:m take-sign-arvo:strandio
?> ?=(%tune +<.sign)
(pure:m !>(data.sign))
;< dat=(unit (cask)) bind:m
(keen:strandio arg)
?~ dat
(pure:m !>(~))
;< =bowl:spider bind:m get-bowl:strandio
=+ .^ =dais:clay %cb
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[p.u.dat]
==
=/ res (mule |.((vale.dais q.u.dat)))
?: ?=(%| -.res)
~|(%keen-mark-fail (mean leaf+"-keen: ames vale fail {<mark>}" p.res))
(pure:m p.res)

View File

@ -180,6 +180,21 @@
`[%done ~]
`[%fail %timer-error u.error.sign-arvo.u.in.tin]
==
++ take-tune
|= =wire
=/ m (strand ,~)
^- form:m
|= tin=strand-input:strand
?+ in.tin `[%skip ~]
~ `[%wait ~]
[~ %agent * %poke-ack *]
?. =(wire wire.u.in.tin)
`[%skip ~]
?~ p.sign.u.in.tin
`[%done ~]
`[%fail %poke-fail u.p.sign.u.in.tin]
==
::
++ take-poke-ack
|= =wire
@ -315,6 +330,16 @@
;< ~ bind:m (send-wait until)
(take-wake `until)
::
++ keen
|= =path
=/ m (strand ,(unit (cask)))
^- form:m
=/ =card:agent:gall [%pass /keen %arvo %a %keen path]
;< ~ bind:m (send-raw-card card)
;< [wire sign=sign-arvo] bind:m take-sign-arvo
?> ?=(%tune +<.sign)
(pure:m data.sign)
::
++ sleep
|= for=@dr
=/ m (strand ,~)