urbit/pkg/arvo/ted/graph/join.hoon

41 lines
954 B
Plaintext
Raw Normal View History

2020-09-02 08:18:07 +03:00
/- spider, graph-view, graph=graph-store, *metadata-store, *group
/+ strandio, resource
=>
|%
++ strand strand:spider
2020-09-11 06:08:16 +03:00
++ fail strand-fail:strand
2020-09-02 08:18:07 +03:00
++ poke poke:strandio
++ poke-our poke-our:strandio
2020-09-04 10:51:28 +03:00
::
2020-09-02 08:18:07 +03:00
++ scry-metadata
|= rid=resource
2020-09-02 08:18:07 +03:00
=/ m (strand ,(unit resource))
2020-09-04 10:42:20 +03:00
^- form:m
;< res=(unit resource) bind:m
%+ scry:strandio ,(unit resource)
2020-09-02 08:18:07 +03:00
;: weld
/gx/metadata-store/resource/graph
2020-09-02 08:18:07 +03:00
(en-path:resource rid)
/noun
==
(pure:m res)
2020-09-02 08:18:07 +03:00
--
2020-09-04 10:51:28 +03:00
::
2020-09-02 08:18:07 +03:00
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<([~ =action:graph-view] arg)
2020-09-02 08:18:07 +03:00
?> ?=(%join -.action)
;< =bowl:spider bind:m get-bowl:strandio
2020-09-11 06:08:16 +03:00
?: =(our.bowl entity.rid.action)
(fail %bad-request ~)
;< group=(unit resource) bind:m (scry-metadata rid.action)
?> ?=(^ group)
:: We have group, graph is managed
2020-09-02 08:18:07 +03:00
;< ~ bind:m
%+ poke-our %graph-pull-hook
pull-hook-action+!>([%add ship.action rid.action])
2020-09-02 08:18:07 +03:00
(pure:m !>(~))