mirror of
https://github.com/urbit/shrub.git
synced 2024-11-30 22:15:47 +03:00
ames: add all=? flag to fine %yawn task
if all=& in |yawn, it will delete all listeners ducts, without notifying them about it, which seems bad, so we migh adress that separatedly. Also, it might be cleaner to have a separate task instead of a flag, to have two paths for "remove me" and "remove all", this way there won't be an option for a listener to remove all others, and that will have to be handled explicitly.
This commit is contained in:
parent
8387a28bd2
commit
55dffb59e7
@ -2,5 +2,5 @@
|
||||
|= [^ [=ship pax=$@(~ [path ~])] ~]
|
||||
=/ =path
|
||||
?^ pax -.pax
|
||||
/c/x/1/kids/sys/hoon/hoon
|
||||
/c/x/1/kids/sys/kelvin
|
||||
[%helm-pass %a %pine ship path]
|
||||
|
@ -1,8 +1,9 @@
|
||||
:- %say
|
||||
|= [^ [=ship pax=$@(~ [=path ~])] ~]
|
||||
|= [^ [=ship all=? pax=$@(~ [=path ~])] ~]
|
||||
=/ =path
|
||||
?~ pax /cz/(scot %p ship)/kids/1/sys
|
||||
:: XX remove default path
|
||||
?~ pax /c/x/1/kids/sys/kelvin
|
||||
?> ?=([@ *] path.pax)
|
||||
=, pax
|
||||
[i.path (scot %p ship) t.path]
|
||||
[%helm-pass %a %yawn path]
|
||||
path
|
||||
[%helm-pass %a %yawn ship path all]
|
||||
|
@ -1102,7 +1102,7 @@
|
||||
::
|
||||
[%keen =ship =path]
|
||||
[%pine =ship =path]
|
||||
[%yawn =ship =path]
|
||||
[%yawn =ship =path all=?]
|
||||
::
|
||||
$>(%born vane-task)
|
||||
$>(%init vane-task)
|
||||
|
@ -2278,12 +2278,12 @@
|
||||
todos(keens (~(put ju keens.todos) path duct))
|
||||
::
|
||||
++ on-yawn
|
||||
|= [=ship =path]
|
||||
|= [=ship =path all=?]
|
||||
^+ event-core
|
||||
?~ ship-state=(~(get by peers.ames-state) ship)
|
||||
~|(%no-ship-for-yawn !!)
|
||||
?> ?=([%known *] u.ship-state)
|
||||
fi-abet:ke-abet:(ke-unsub:(ke-abed:ke:fi:(abed:pe ship) path) duct)
|
||||
fi-abet:ke-abet:(ke-unsub:(ke-abed:ke:fi:(abed:pe ship) path) duct all)
|
||||
::
|
||||
+| %implementation
|
||||
:: +enqueue-alien-todo: helper to enqueue a pending request
|
||||
@ -3966,7 +3966,32 @@
|
||||
:: scry is autocancelled in +ke-abet if no more listeners
|
||||
::
|
||||
++ ke-unsub
|
||||
|=(=^duct ke-core(listeners.keen (~(del in listeners.keen) duct)))
|
||||
|= [=^duct all=?]
|
||||
?. |(all (~(has in listeners.keen) duct))
|
||||
%. ke-core
|
||||
:: XX TODO use trace, add fine flags? reuse ames?
|
||||
(slog leaf/"fine: {<duct>} not a listener for {<path>}" ~)
|
||||
:: XX TODO: notify all listeners?
|
||||
:: supported subscribers are:
|
||||
:: %clay
|
||||
:: %gall (via agents or %spider threads; see -keen)
|
||||
::
|
||||
:: (-keen wire=[%gall %use %spider @ ship=@ %thread tid=@ /keen])
|
||||
::
|
||||
:: by inspecting all listener ducts we can know who
|
||||
:: is listening and send appropiate clean up moves
|
||||
::
|
||||
:: =. event-core
|
||||
:: %- ~(rep in listeners.keen)
|
||||
:: |= [=^duct c=_event-core]
|
||||
:: %- emit
|
||||
:: ?+ duct c
|
||||
:: [[%gall %use app=@ @ @ ] *] :: XX TODO
|
||||
:: [[%clay *] *] :: XX TODO
|
||||
:: ==
|
||||
:: TODO: use ev-trace
|
||||
%- (slog leaf/"fine: deleting {<path>}" ~)
|
||||
ke-core(listeners.keen ?:(all ~ (~(del in listeners.keen) duct)))
|
||||
::
|
||||
+| %implementation
|
||||
::
|
||||
|
@ -3240,12 +3240,12 @@
|
||||
::
|
||||
?. ?=([~ ^] busy.sat)
|
||||
%. [hen her u.nux [syd ~]]
|
||||
send-over-ames(ref `(unit rind)`ref) :: XX TMI
|
||||
send-over-ames(ref `(unit rind)`ref) :: XX TMI
|
||||
%- emil
|
||||
=* bus u.busy.sat
|
||||
=/ =wire (request-wire kind.bus her syd u.nux)
|
||||
~& %cancel-request-yawn
|
||||
:~ [hen %pass wire %a %yawn her path.bus]
|
||||
:~ [hen %pass wire %a %yawn her path.bus |]
|
||||
[hen %pass wire %b %rest time.bus]
|
||||
==
|
||||
::
|
||||
@ -3289,9 +3289,9 @@
|
||||
=/ bus ?>(?=([~ ^] busy.sat) u.busy.sat)
|
||||
=/ =wire (request-wire kind her syd inx)
|
||||
%- emil
|
||||
~& %retry-with-ames-yawn
|
||||
~& %retry-with-ames-yawn
|
||||
:~ [hen %pass wire %b %rest time.bus]
|
||||
[hen %pass wire %a %yawn her path.bus]
|
||||
[hen %pass wire %a %yawn her path.bus |]
|
||||
==
|
||||
:: re-send over ames
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user