mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-20 21:31:32 +03:00
ames: give %miss to all listeners on %keen cancel
%spider will send a %yawn task to ames if a thread fails or stops. if the thread is done, it will delete the scry from its state without notifying %ames
This commit is contained in:
parent
51effc6be9
commit
873de61269
@ -421,7 +421,7 @@
|
|||||||
?: (~(has of running.state) u.yarn)
|
?: (~(has of running.state) u.yarn)
|
||||||
?. nice
|
?. nice
|
||||||
(thread-fail u.yarn %cancelled ~)
|
(thread-fail u.yarn %cancelled ~)
|
||||||
=^ cancel-cards state (cancel-scry tid)
|
=^ cancel-cards state (cancel-scry tid &)
|
||||||
=^ done-cards state (thread-done u.yarn *vase)
|
=^ done-cards state (thread-done u.yarn *vase)
|
||||||
[(weld cancel-cards done-cards) state]
|
[(weld cancel-cards done-cards) state]
|
||||||
?: (~(has by starting.state) u.yarn)
|
?: (~(has by starting.state) u.yarn)
|
||||||
@ -498,12 +498,13 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ cancel-scry
|
++ cancel-scry
|
||||||
|= =tid
|
|= [=tid silent=?]
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
?~ scry=(~(get by scries.state) tid)
|
?~ scry=(~(get by scries.state) tid)
|
||||||
`state
|
`state
|
||||||
:_ state(scries (~(del by scries.state) tid))
|
:_ state(scries (~(del by scries.state) tid))
|
||||||
::%- (slog leaf+"cancelling {<tid>}: [{<[ship path]:u.scry>}]" ~)
|
?: silent ~
|
||||||
|
%- (slog leaf+"cancelling {<tid>}: [{<[ship path]:u.scry>}]" ~)
|
||||||
[%pass /thread/[tid]/keen %arvo %a %yawn [ship path]:u.scry]~
|
[%pass /thread/[tid]/keen %arvo %a %yawn [ship path]:u.scry]~
|
||||||
::
|
::
|
||||||
++ thread-http-fail
|
++ thread-http-fail
|
||||||
@ -536,7 +537,7 @@
|
|||||||
=/ fail-cards (thread-say-fail tid term tang)
|
=/ fail-cards (thread-say-fail tid term tang)
|
||||||
=^ cards state (thread-clean yarn)
|
=^ cards state (thread-clean yarn)
|
||||||
=^ http-cards state (thread-http-fail tid term tang)
|
=^ http-cards state (thread-http-fail tid term tang)
|
||||||
=^ scry-card state (cancel-scry tid)
|
=^ scry-card state (cancel-scry tid |)
|
||||||
:_ state
|
:_ state
|
||||||
:(weld fail-cards cards http-cards scry-card)
|
:(weld fail-cards cards http-cards scry-card)
|
||||||
::
|
::
|
||||||
@ -565,7 +566,7 @@
|
|||||||
==
|
==
|
||||||
=^ http-cards state
|
=^ http-cards state
|
||||||
(thread-http-response tid vase)
|
(thread-http-response tid vase)
|
||||||
=^ scry-card state (cancel-scry tid)
|
=^ scry-card state (cancel-scry tid &)
|
||||||
=^ cards state (thread-clean yarn)
|
=^ cards state (thread-clean yarn)
|
||||||
[:(weld done-cards cards http-cards scry-card) state]
|
[:(weld done-cards cards http-cards scry-card) state]
|
||||||
::
|
::
|
||||||
|
@ -2612,7 +2612,7 @@
|
|||||||
?. (~(has by keens) path)
|
?. (~(has by keens) path)
|
||||||
~&(dead-response/peep peer-core)
|
~&(dead-response/peep peer-core)
|
||||||
=< fi-abet
|
=< fi-abet
|
||||||
?^ error (fi-error:fine u.error)
|
?^ error (fi-fail:fine u.error)
|
||||||
(fi-rcv:fine peep meow lane)
|
(fi-rcv:fine peep meow lane)
|
||||||
::
|
::
|
||||||
++ on-keen
|
++ on-keen
|
||||||
@ -3729,7 +3729,7 @@
|
|||||||
^- byts
|
^- byts
|
||||||
:- (roll biz |=([[wid=@ *] acc=@] (add wid acc)))
|
:- (roll biz |=([[wid=@ *] acc=@] (add wid acc)))
|
||||||
(can 3 biz)
|
(can 3 biz)
|
||||||
::
|
:: TODO: move +etch-peep/+etch-keen to %lull?
|
||||||
++ etch-peep
|
++ etch-peep
|
||||||
|= [=path num=@ud]
|
|= [=path num=@ud]
|
||||||
^- byts
|
^- byts
|
||||||
@ -3831,17 +3831,8 @@
|
|||||||
++ 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-clean-up
|
++ fi-miss
|
||||||
|= [=^duct =_fine]
|
|=([=^duct =_fine] (fi-emit:fine duct %give %miss fi-full-path))
|
||||||
:: at the moment only %spider keeps state about remote scries
|
|
||||||
::
|
|
||||||
?+ duct fine
|
|
||||||
[[%gall %use %spider @ ship=@ %thread tid=@ *] *]
|
|
||||||
=/ =cage spider-stop+!>([&7.-.duct |])
|
|
||||||
=/ poke=* [%0 %m [p q.q]:cage]
|
|
||||||
=/ =plea [%g /ge/spider poke]
|
|
||||||
(fi-emit:fine duct %pass /fine/unsub %g %plea our plea)
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
+| %entry-points
|
+| %entry-points
|
||||||
::
|
::
|
||||||
@ -3906,31 +3897,18 @@
|
|||||||
|= [=^duct all=?]
|
|= [=^duct all=?]
|
||||||
?. |(all (~(has in listeners.keen) duct))
|
?. |(all (~(has in listeners.keen) duct))
|
||||||
%. fine
|
%. fine
|
||||||
(fi-trace fin.veb |.("{<duct>} not a listener for {<path>}"))
|
(fi-trace fin.veb |.("unknown listener, skip"))
|
||||||
=? fine all
|
=? fine all (~(rep in listeners.keen) fi-miss)
|
||||||
:: notify listeners by inspecting their
|
%- (fi-trace fin.veb |.("deleting {<fi-full-path>}"))
|
||||||
:: ducts and sending appropiate clean up moves
|
|
||||||
::
|
|
||||||
(~(rep in listeners.keen) fi-clean-up)
|
|
||||||
%- (fi-trace fin.veb |.("deleting {<path>}"))
|
|
||||||
fine(listeners.keen ?:(all ~ (~(del in listeners.keen) duct)))
|
fine(listeners.keen ?:(all ~ (~(del in listeners.keen) duct)))
|
||||||
::
|
::
|
||||||
++ fi-error
|
++ fi-fail
|
||||||
|= =goof
|
|= =goof
|
||||||
^+ fine
|
^+ fine
|
||||||
:: we want to propagate the crash to the listeners and then
|
:: TODO: propagate the goof to the listeners?
|
||||||
:: cancel this request, so it doesn't continue forever resending
|
|
||||||
:: request packets
|
|
||||||
::
|
::
|
||||||
%- (fi-trace fin.veb |.("error {<mote.goof>} {<fi-full-path>}"))
|
%- (fi-trace fin.veb |.("error {<mote.goof>} {<fi-full-path>}"))
|
||||||
=. listeners.keen (~(del in listeners.keen) duct)
|
(fi-unsub duct all=&)
|
||||||
%- ~(rep in listeners.keen)
|
|
||||||
|= [=^duct =_fine]
|
|
||||||
=. fine (fi-clean-up duct fine)
|
|
||||||
:: TODO return a %tune with data=~ (unit (unit cask)), instead?
|
|
||||||
:: have a gift for error handling? check with ~master-morzod
|
|
||||||
::
|
|
||||||
(fi-emit:fine duct %give %miss fi-full-path)
|
|
||||||
::
|
::
|
||||||
+| %implementation
|
+| %implementation
|
||||||
::
|
::
|
||||||
@ -3965,6 +3943,8 @@
|
|||||||
=/ =gift
|
=/ =gift
|
||||||
:: TODO define data in %tune as a (unit (unit cask))
|
:: TODO define data in %tune as a (unit (unit cask))
|
||||||
:: and return ~ signaling a block, instead of %miss?
|
:: and return ~ signaling a block, instead of %miss?
|
||||||
|
:: NOTE a %miss gift now represents that the request was dropped
|
||||||
|
::
|
||||||
?. (meri:keys fi-full-path sig data)
|
?. (meri:keys fi-full-path sig data)
|
||||||
[%miss fi-full-path]
|
[%miss fi-full-path]
|
||||||
[%tune fi-full-path sig ?~(data ~ `data)]
|
[%tune fi-full-path sig ?~(data ~ `data)]
|
||||||
|
@ -3,6 +3,15 @@
|
|||||||
/+ *test, v=test-ames-gall
|
/+ *test, v=test-ames-gall
|
||||||
/* kelvin %hoon /sys/kelvin
|
/* kelvin %hoon /sys/kelvin
|
||||||
=> |%
|
=> |%
|
||||||
|
++ crypto-core
|
||||||
|
|% ++ nec (pit:nu:crub:crypto 512 (shaz 'nec'))
|
||||||
|
++ bud (pit:nu:crub:crypto 512 (shaz 'bud'))
|
||||||
|
++ sign
|
||||||
|
|= [=ship data=@ux]
|
||||||
|
%. data
|
||||||
|
?:(=(ship ~nec) sigh:as:nec sigh:as:bud)
|
||||||
|
--
|
||||||
|
::
|
||||||
++ n-frags
|
++ n-frags
|
||||||
|= n=@
|
|= n=@
|
||||||
^- @ux
|
^- @ux
|
||||||
@ -31,6 +40,32 @@
|
|||||||
::
|
::
|
||||||
%cx ``hoon+!>(kelvin)
|
%cx ``hoon+!>(kelvin)
|
||||||
==
|
==
|
||||||
|
::
|
||||||
|
++ gum
|
||||||
|
::~/ %gum
|
||||||
|
|= biz=(list byts)
|
||||||
|
^- byts
|
||||||
|
:- (roll biz |=([[wid=@ *] acc=@] (add wid acc)))
|
||||||
|
(can 3 biz)
|
||||||
|
::
|
||||||
|
++ etch-peep
|
||||||
|
|= [=path num=@ud]
|
||||||
|
^- byts
|
||||||
|
?> (lth num (bex 32))
|
||||||
|
=+ pat=(spat path)
|
||||||
|
=+ wid=(met 3 pat)
|
||||||
|
%- gum
|
||||||
|
:~ 4^num :: fragment number
|
||||||
|
2^wid :: path size
|
||||||
|
wid^`@`pat :: namespace path
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ etch-request-content
|
||||||
|
|= [our=@p =path num=@ud]
|
||||||
|
^- @
|
||||||
|
=/ bod (etch-peep path num)
|
||||||
|
=/ sig 64^(sign:crypto-core our dat.bod)
|
||||||
|
(can 3 sig bod ~)
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
|%
|
|%
|
||||||
@ -45,38 +80,25 @@
|
|||||||
:: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
|
:: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
|
||||||
=/ scry-path=path /c/x/1/kids/sys/kelvin
|
=/ scry-path=path /c/x/1/kids/sys/kelvin
|
||||||
=/ fine-behn-wire=wire (weld /fine/behn/wake/~bud scry-path)
|
=/ fine-behn-wire=wire (weld /fine/behn/wake/~bud scry-path)
|
||||||
|
=/ future-path=path /c/x/5/kids/sys/kelvin
|
||||||
|
=/ future-behn=wire (weld /fine/behn/wake/~bud future-path)
|
||||||
=/ =task:ames [%keen ~bud scry-path]
|
=/ =task:ames [%keen ~bud scry-path]
|
||||||
::
|
::
|
||||||
=/ [sig=@ux meows=(list @ux)]
|
=/ request=shot:ames
|
||||||
%: ames-scry-hunk:v ames.bud
|
:* [sndr=~nec rcvr=~bud]
|
||||||
[~1111.1.2 0xbeef.dead custom-roof]
|
req=& sam=|
|
||||||
~bud
|
|
||||||
[1 16.384 /~bud/1/1/c/x/1/kids/sys/kelvin]
|
|
||||||
==
|
|
||||||
=/ =shot:ames
|
|
||||||
:* [sndr=~bud rcvr=~nec]
|
|
||||||
req=| sam=|
|
|
||||||
sndr-tick=0b1
|
sndr-tick=0b1
|
||||||
rcvr-tick=0b1
|
rcvr-tick=0b1
|
||||||
origin=~
|
origin=~
|
||||||
:: we know that for /sys/kelvin its contents fit
|
content=(etch-request-content ~nec /~bud/1/1/c/x/1/kids/sys/kelvin 1)
|
||||||
:: in one packet -- TODO multipacket response
|
|
||||||
content=?>(?=([@ *] meows) i.meows)
|
|
||||||
==
|
==
|
||||||
::
|
|
||||||
~& > 'poke requester %ames with a %keen task'
|
~& > 'poke requester %ames with a %keen task'
|
||||||
=^ t1 ames.nec
|
=^ t1 ames.nec
|
||||||
%: ames-check-call:v ames.nec
|
%: ames-check-call:v ames.nec
|
||||||
[~1111.1.1 0xdead.beef *roof]
|
[~1111.1.1 0xdead.beef *roof]
|
||||||
[~[/keen-duct-1] task]
|
[~[/keen-duct-1] task]
|
||||||
:~ :- ~[//unix]
|
:~ :- ~[//unix]
|
||||||
:* %give %send [%& ~bud]
|
[%give %send [%& ~bud] (etch-shot:ames request)]
|
||||||
0x6e69.766c.656b.2f73.7973.2f73.6469.6b2f.312f.782f.632f.312f.312f.
|
|
||||||
6475.627e.2f00.1f00.0000.0107.7900.3220.8214.2705.fb35.0288.4b05.
|
|
||||||
06f2.e713.a557.9049.745f.2f6d.8871.afd8.ceeb.cebf.1db5.8e23.619e.
|
|
||||||
1dd2.c92e.b7f8.a142.1746.b5f0.d7f1.5155.2d30.9093.7ee4.ce00.0200.
|
|
||||||
0111.e898.b008
|
|
||||||
==
|
|
||||||
[~[//unix] %pass fine-behn-wire %b %wait ~1111.1.1..00.00.01]
|
[~[//unix] %pass fine-behn-wire %b %wait ~1111.1.1..00.00.01]
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
@ -97,20 +119,37 @@
|
|||||||
?~ keen=(~(get by keens.peer) scry-path)
|
?~ keen=(~(get by keens.peer) scry-path)
|
||||||
~
|
~
|
||||||
listeners:u.keen
|
listeners:u.keen
|
||||||
~& > 'two listeners for the requested path'
|
~& > 'checks two listeners for the requested scry path'
|
||||||
=/ t3=tang
|
=/ t3=tang
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!>((sy ~[~[/keen-duct-1] ~[/keen-duct-2]]))
|
!>((sy ~[~[/keen-duct-1] ~[/keen-duct-2]]))
|
||||||
!>(listeners)
|
!>(listeners)
|
||||||
::
|
::
|
||||||
:- t3 |. :- %&
|
:- t3 |. :- %|
|
||||||
~& > 'hears a remote scry response'
|
~& > 'gives a remote scry response to listeners'
|
||||||
|
=/ [sig=@ux meows=(list @ux)]
|
||||||
|
%: ames-scry-hunk:v ames.bud
|
||||||
|
[~1111.1.2 0xbeef.dead custom-roof]
|
||||||
|
~bud
|
||||||
|
[1 16.384 /~bud/1/1/c/x/1/kids/sys/kelvin]
|
||||||
|
==
|
||||||
|
=/ response=shot:ames
|
||||||
|
:* [sndr=~bud rcvr=~nec]
|
||||||
|
req=| sam=|
|
||||||
|
sndr-tick=0b1
|
||||||
|
rcvr-tick=0b1
|
||||||
|
origin=~
|
||||||
|
:: we know that for /sys/kelvin its contents fit
|
||||||
|
:: in one packet -- TODO multipacket response
|
||||||
|
content=?>(?=([@ *] meows) i.meows)
|
||||||
|
==
|
||||||
|
::
|
||||||
=^ t4 ames.nec
|
=^ t4 ames.nec
|
||||||
%: ames-check-call:v ames.nec
|
%: ames-check-call:v ames.nec
|
||||||
[~1111.1.2 0xbeef.dead *roof]
|
[~1111.1.2 0xbeef.dead *roof]
|
||||||
:- ~[//fine]
|
:- ~[//fine]
|
||||||
:* %hear [%& ~bud]
|
:* %hear [%& ~bud]
|
||||||
(etch-shot:ames shot)
|
(etch-shot:ames response)
|
||||||
==
|
==
|
||||||
:~ [~[//fine] [%pass /qos %d %flog %text "; ~bud is your neighbor"]]
|
:~ [~[//fine] [%pass /qos %d %flog %text "; ~bud is your neighbor"]]
|
||||||
:- ~[/keen-duct-2]
|
:- ~[/keen-duct-2]
|
||||||
@ -127,5 +166,71 @@
|
|||||||
==
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
t4
|
:- t4 |. :- %|
|
||||||
|
=/ request=shot:ames
|
||||||
|
:* [sndr=~nec rcvr=~bud]
|
||||||
|
req=& sam=|
|
||||||
|
sndr-tick=0b1
|
||||||
|
rcvr-tick=0b1
|
||||||
|
origin=~
|
||||||
|
content=(etch-request-content ~nec /~bud/1/1/c/x/5/kids/sys/kelvin 1)
|
||||||
|
==
|
||||||
|
~& > 'poke requester %ames with a %keen task for a future case'
|
||||||
|
=^ t5 ames.nec
|
||||||
|
%: ames-check-call:v ames.nec
|
||||||
|
[~1111.1.1 0xdead.beef *roof]
|
||||||
|
[~[/keen-duct-3] %keen ~bud future-path]
|
||||||
|
:~ [~[//unix] [%give %send [%& ~bud] (etch-shot:ames request)]]
|
||||||
|
[~[//unix] %pass future-behn %b %wait ~1111.1.1..00.00.01]
|
||||||
|
==
|
||||||
|
==
|
||||||
|
::
|
||||||
|
:- t5 |. :- %|
|
||||||
|
~& > 'cancel %keen task, from requester'
|
||||||
|
=^ t6 ames.nec
|
||||||
|
%: ames-check-call:v ames.nec
|
||||||
|
[~1111.1.1 0xdead.beef *roof]
|
||||||
|
[~[/keen-duct-3] %yawn ~bud future-path]
|
||||||
|
[~[//unix] %pass future-behn %b %rest ~1111.1.1..00.00.01]~
|
||||||
|
==
|
||||||
|
::
|
||||||
|
:- t6 |. :- %|
|
||||||
|
~& > 'poke requester %ames with a new %keen task for a future case'
|
||||||
|
=^ t7 ames.nec
|
||||||
|
%: ames-check-call:v ames.nec
|
||||||
|
[~1111.1.1 0xdead.beef *roof]
|
||||||
|
[~[/keen-duct-4] %keen ~bud future-path]
|
||||||
|
:~ [~[//unix] [%give %send [%& ~bud] (etch-shot:ames request)]]
|
||||||
|
[~[//unix] %pass future-behn %b %wait ~1111.1.1..00.00.01]
|
||||||
|
==
|
||||||
|
==
|
||||||
|
::
|
||||||
|
:- t7 |. :- %|
|
||||||
|
~& > 'poke requester %ames with a second %keen task for a future case'
|
||||||
|
=^ t8 ames.nec
|
||||||
|
%: ames-check-call:v ames.nec
|
||||||
|
[~1111.1.1 0xdead.beef *roof]
|
||||||
|
[~[/keen-duct-5] %keen ~bud future-path]
|
||||||
|
~
|
||||||
|
==
|
||||||
|
:- t8 |. :- %|
|
||||||
|
~& > 'cancel scry for all listeners (%wham)'
|
||||||
|
=^ t9 ames.nec
|
||||||
|
%: ames-check-call:v ames.nec
|
||||||
|
[~1111.1.1 0xdead.beef *roof]
|
||||||
|
[~[/wham-duct] %wham ~bud future-path]
|
||||||
|
:~ [~[/keen-duct-4] [%give %miss /~bud/1/1/c/x/5/kids/sys/kelvin]]
|
||||||
|
[~[/keen-duct-5] [%give %miss /~bud/1/1/c/x/5/kids/sys/kelvin]]
|
||||||
|
[~[//unix] %pass future-behn %b %rest ~1111.1.1..00.00.01]
|
||||||
|
==
|
||||||
|
==
|
||||||
|
:- t9 |. :- %&
|
||||||
|
=/ peer=peer-state:ames
|
||||||
|
(ames-scry-peer:v ames.nec [~1111.1.8 0xbeef.dead *roof] [~nec ~bud])
|
||||||
|
=/ listeners=(set duct)
|
||||||
|
?~ keen=(~(get by keens.peer) scry-path)
|
||||||
|
~
|
||||||
|
listeners:u.keen
|
||||||
|
~& > 'checks no more listeners'
|
||||||
|
(expect-eq !>(~) !>(listeners))
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user