urbit/pkg/landscape/lib/pull-hook-virt.hoon

53 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-03-10 08:07:58 +03:00
:: pull-hook-virt: virtualisation for pull-hook
/- *resource
|_ =bowl:gall
++ mule-scry
|= [ref=* raw=*]
=/ pax=(unit path)
((soft path) raw)
?~ pax ~
?. ?=([@ @ @ @ *] u.pax) ~
=/ ship
(slaw %p i.t.u.pax)
=/ ved
(slay i.t.t.t.u.pax)
=/ dat
?~ ved now.bowl
=/ cas=(unit case)
((soft case) p.u.ved)
?~ cas now.bowl
?: ?=(%da -.u.cas)
p.u.cas
now.bowl
:: catch bad gall scries early
?: ?& =((end 3 i.u.pax) %g)
?| !=(`our.bowl ship)
!=(dat now.bowl)
==
==
~
``.^(* u.pax)
::
++ kick-mule
2021-03-11 06:49:42 +03:00
|= [rid=resource trp=(trap *)]
2021-03-10 08:07:58 +03:00
^- (unit (unit path))
=/ res=toon
2021-03-11 06:49:42 +03:00
(mock [trp %9 2 %0 1] mule-scry)
2021-03-10 08:07:58 +03:00
=/ pax=(unit path)
!< (unit path)
:- -:!>(*(unit path))
?:(?=(%0 -.res) p.res ~)
?: !?=(%0 -.res)
=/ =tang
:+ leaf+"failed kick handler, please report"
leaf+"{<rid>} in {(trip dap.bowl)}"
?: ?=(%2 -.res)
p.res
?> ?=(%1 -.res)
=/ maybe-path=(unit path) ((soft path) p.res)
?~ maybe-path ~
[(smyt u.maybe-path) ~]
((slog tang) ~)
`pax
--