From 55dffb59e7846feb0bd724eed2eef8fbcc323874 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 31 Mar 2023 15:45:51 +0200 Subject: [PATCH] =?UTF-8?q?ames:=20add=20all=3D=3F=20flag=20to=20fine=20%y?= =?UTF-8?q?awn=20task?= 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. --- pkg/arvo/gen/hood/pine.hoon | 2 +- pkg/arvo/gen/hood/yawn.hoon | 9 +++++---- pkg/arvo/sys/lull.hoon | 2 +- pkg/arvo/sys/vane/ames.hoon | 31 ++++++++++++++++++++++++++++--- pkg/arvo/sys/vane/clay.hoon | 8 ++++---- 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/gen/hood/pine.hoon b/pkg/arvo/gen/hood/pine.hoon index 3ad4dc730..0689bd719 100644 --- a/pkg/arvo/gen/hood/pine.hoon +++ b/pkg/arvo/gen/hood/pine.hoon @@ -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] diff --git a/pkg/arvo/gen/hood/yawn.hoon b/pkg/arvo/gen/hood/yawn.hoon index 7388de08a..9eb7c7bf9 100644 --- a/pkg/arvo/gen/hood/yawn.hoon +++ b/pkg/arvo/gen/hood/yawn.hoon @@ -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] diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index ec249f4b8..e7ab9f513 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -1102,7 +1102,7 @@ :: [%keen =ship =path] [%pine =ship =path] - [%yawn =ship =path] + [%yawn =ship =path all=?] :: $>(%born vane-task) $>(%init vane-task) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b76abd737..1f6431123 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -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: {} not a listener for {}" ~) + :: 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 {}" ~) + ke-core(listeners.keen ?:(all ~ (~(del in listeners.keen) duct))) :: +| %implementation :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5c737a675..cad48b8ec 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -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 ::