shrub/pkg/arvo/ted/graph/delete.hoon

80 lines
2.0 KiB
Plaintext
Raw Normal View History

2020-09-03 08:07:18 +03:00
/- spider, graph-view, graph=graph-store, *metadata-store, *group
/+ strandio, resource
=>
|%
++ strand strand:spider
++ poke poke:strandio
++ poke-our poke-our:strandio
2020-09-04 10:51:28 +03:00
::
2020-09-03 08:07:18 +03:00
++ scry-metadata
|= rid=resource
=/ m (strand ,(unit resource))
2020-09-10 13:20:00 +03:00
;< paxs=(unit (set path)) bind:m
%+ scry:strandio ,(unit (set path))
2020-09-03 08:07:18 +03:00
;: weld
/gx/metadata-store/resource/graph
2020-09-03 08:07:18 +03:00
(en-path:resource rid)
/noun
==
2020-09-10 13:20:00 +03:00
?~ paxs (pure:m ~)
?~ u.paxs (pure:m ~)
(pure:m `(de-path:resource n.u.paxs))
2020-09-04 10:51:28 +03:00
::
2020-09-03 08:07:18 +03:00
++ scry-group
|= rid=resource
2020-09-10 13:20:00 +03:00
=/ m (strand ,group)
2020-09-03 08:07:18 +03:00
;< ugroup=(unit group) bind:m
%+ scry:strandio ,(unit group)
;: weld
2020-09-10 13:20:00 +03:00
/gx/group-store/groups
2020-09-03 08:07:18 +03:00
(en-path:resource rid)
/noun
==
(pure:m (need ugroup))
2020-09-04 10:51:28 +03:00
::
2020-09-03 08:07:18 +03:00
++ delete-graph
2020-09-11 06:08:16 +03:00
|= rid=resource
2020-09-03 08:07:18 +03:00
=/ m (strand ,~)
2020-09-11 06:08:16 +03:00
^- form:m
2020-09-10 13:20:00 +03:00
;< =bowl:spider bind:m get-bowl:strandio
2020-09-03 08:07:18 +03:00
;< ~ bind:m
(poke-our %graph-store %graph-update !>([%0 now.bowl %remove-graph rid]))
;< ~ bind:m
(poke-our %graph-push-hook %push-hook-action !>([%remove rid]))
;< ~ bind:m
%+ poke-our %metadata-hook
metadata-hook-action+!>([%remove (en-path:resource rid)])
;< ~ bind:m
%+ poke-our %metadata-store
:- %metadata-action
!> :+ %remove
(en-path:resource rid)
[%graph (en-path:resource rid)]
2020-09-03 08:07:18 +03:00
(pure:m ~)
--
2020-09-04 10:51:28 +03:00
::
2020-09-03 08:07:18 +03:00
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<([~ =action:graph-view] arg)
2020-09-03 08:07:18 +03:00
?> ?=(%delete -.action)
;< =bowl:spider bind:m get-bowl:strandio
2020-09-11 06:08:16 +03:00
?. =(our.bowl entity.rid.action)
(strand-fail:strandio %bad-request ~)
2020-09-03 08:07:18 +03:00
;< ugroup-rid=(unit resource) bind:m
(scry-metadata rid.action)
2020-09-10 13:20:00 +03:00
?~ ugroup-rid !!
;< =group bind:m
2020-09-03 08:07:18 +03:00
(scry-group u.ugroup-rid)
2020-09-10 13:20:00 +03:00
?. hidden.group
;< ~ bind:m
(delete-graph rid.action)
(pure:m !>(~))
2020-09-03 08:07:18 +03:00
;< ~ bind:m
(poke-our %group-store %group-action !>([%remove-group rid.action ~]))
2020-09-03 08:07:18 +03:00
;< ~ bind:m
(poke-our %group-push-hook %push-hook-action !>([%remove rid.action]))
2020-09-03 08:07:18 +03:00
;< ~ bind:m (delete-graph rid.action)
(pure:m !>(~))