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 ++ get-graph
|= res=resource |= res=resource
^- marked-graph:store ^- update:store
%+ scry-for marked-graph:store %+ scry-for update:store
/graph/(scot %p entity.res)/[name.res] /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 ++ peek-log
|= res=resource |= res=resource
^- (unit time) ^- (unit time)

View File

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

View File

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