shrub/pkg/landscape/ted/graph/leave.hoon

57 lines
1.4 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
2021-06-21 03:25:48 +03:00
++ raw-poke-our raw-poke-our:strandio
2020-09-04 10:51:28 +03:00
::
2020-09-03 08:07:18 +03:00
++ scry-metadata
|= rid=resource
%+ scry:strandio ,(unit resource)
;: weld
/gx/metadata-store/resource/graph
(en-path:resource rid)
/noun
==
2020-09-04 10:51:28 +03:00
::
2020-09-03 08:07:18 +03:00
++ scry-group
|= rid=resource
%+ scry:strandio ,(unit group)
;: weld
/gx/group-store/groups
(en-path:resource rid)
/noun
==
2020-09-04 10:51:28 +03:00
::
2020-09-03 08:07:18 +03:00
++ delete-graph
|= [now=time rid=resource]
2020-09-03 08:07:18 +03:00
=/ m (strand ,~)
2020-09-11 03:10:44 +03:00
^- form:m
2020-09-03 08:07:18 +03:00
;< ~ bind:m
(raw-poke-our %graph-pull-hook %pull-hook-action !>([%remove rid]))
2020-09-03 08:07:18 +03:00
;< ~ bind:m
2021-09-28 02:43:36 +03:00
(raw-poke-our %graph-store %graph-update-3 !>([now [%remove-graph 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
?> ?=(%leave -.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 ~)
;< group-rid=(unit resource) bind:m (scry-metadata rid.action)
?~ group-rid (pure:m !>(~))
;< g=(unit group) bind:m (scry-group u.group-rid)
?~ g (pure:m !>(~))
;< ~ bind:m (delete-graph now.bowl rid.action)
?. hidden.u.g
2020-09-11 03:10:44 +03:00
(pure:m !>(~))
;< =thread-result:strandio bind:m
(await-thread:strandio %group-leave !>([~ [%leave rid.action]]))
2020-09-03 08:07:18 +03:00
(pure:m !>(~))