lib/graph: fix scries

This commit is contained in:
Liam Fitzgerald 2020-09-04 17:42:20 +10:00
parent ff1219bbda
commit cd0ca3a1b4
3 changed files with 40 additions and 20 deletions

View File

@ -13,10 +13,16 @@
::
++ get-graph
|= res=resource
^- marked-graph:store
%+ scry-for marked-graph:store
^- update:store
%+ scry-for update:store
/graph/(scot %p entity.res)/[name.res]
::
++ get-update-log
|= rid=resource
^- update-log:store
%+ scry-for update-log:store
/update-log/(scot %p entity.rid)/[name.rid]
::
++ peek-log
|= res=resource
^- (unit time)

View File

@ -1,38 +1,38 @@
/- spider, graph-view, graph=graph-store, *metadata-store, *group, group-store
/+ strandio, resource
/- spider, graph=graph-store, *metadata-store, *group, group-store
/+ strandio, resource, graph-view
=>
|%
++ strand strand:spider
++ poke poke:strandio
++ poke-our poke-our:strandio
++ handle-group
|= [rid=resource associated=(each resource policy)]
|= [rid=resource =associated:graph-view]
=/ m (strand ,resource)
?: ?=(%& -.associated)
(pure:m p.associated)
?: ?=(%group -.associated)
(pure:m rid.associated)
=/ =action:group-store
[%add-group rid p.associated %&]
[%add-group rid policy.associated %&]
;< ~ bind:m (poke-our %group-store %group-action !>(action))
;< ~ bind:m
(poke-our %group-push-hook %push-hook-action !>([%add rid]))
(pure:m rid)
--
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<([=action:graph-view ~] arg)
=+ !<(=action:graph-view arg)
?> ?=(%create -.action)
;< =bowl:spider bind:m get-bowl:strandio
:: Add graph to graph-store
::
=/ =update:graph
[%0 now.bowl %add-graph rid.action *graph:graph mark.action]
;< ~ bind:m (poke-our %graph-store %graph-update !>(update))
::;< ~ bind:m
:: (poke-our %graph-push-hook %push-hook-action !>([%add rid.action]))
[%0 now.bowl %add-graph rid.action *graph:graph `(app-to-mark:graph-view app.action)]
;< ~ bind:m
(poke-our %graph-store graph-update+!>(update))
;< ~ bind:m
(poke-our %graph-push-hook %push-hook-action !>([%add rid.action]))
:: Add group, if graph is unmanaged
::
;< group=resource bind:m
@ -49,7 +49,7 @@
creator our.bowl
==
=/ act=metadata-action
[%add group-path [%graph (en-path:resource rid.action)] metadata]
[%add group-path [app.action (en-path:resource rid.action)] metadata]
;< ~ bind:m (poke-our %metadata-hook %metadata-action !>(act))
;< ~ bind:m
(poke-our %metadata-hook %metadata-hook-action !>([%add-owned group-path]))

View File

@ -5,17 +5,29 @@
++ strand strand:spider
++ poke poke:strandio
++ poke-our poke-our:strandio
++ check-live
|= who=ship
=/ m (strand ,~)
^- form:m
%+ (set-timeout:strandio ,~) ~s10
;< ~ bind:m
(poke [who %hood] %helm-hi !>(~))
(pure:m ~)
++ scry-metadata
|= rid=resource
=/ m (strand ,(unit resource))
;< pax=(unit path) bind:m
%+ scry:strandio ,(unit path)
^- form:m
;< pax=(unit (set path)) bind:m
%+ scry:strandio ,(unit (set path))
;: weld
/gx/metadata-store/resource/graph
/gx/metadata-store/resource/chat
(en-path:resource rid)
/noun
==
(pure:m (bind pax de-path:resource))
%- pure:m
?~ pax ~
?~ u.pax ~
`(de-path:resource n.u.pax)
--
^- thread:spider
|= arg=vase
@ -27,6 +39,7 @@
?< =(our.bowl entity.rid.action)
;< group=(unit resource) bind:m
(scry-metadata rid.action)
;< ~ bind:m (check-live entity.rid.action)
?^ group
:: We have group, graph is managed
;< ~ bind:m
@ -47,6 +60,7 @@
%+ poke-our %metadata-hook
metadata-hook-action+!>([%add-synced ship.action rid.action])
;< ~ bind:m
(poke-our %graph-pull-hook %pull-hook-action !>([%add ship.action rid.action]))
%+ poke-our %graph-pull-hook
pull-hook-action+!>([%add ship.action rid.action]))
(pure:m !>(~))