mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-04 10:52:18 +03:00
graph-view: refactor threads to call into %group-view
This commit is contained in:
parent
e7b404ee4e
commit
2730eb6c09
@ -1,6 +1,6 @@
|
|||||||
/- spider,
|
/- spider,
|
||||||
graph=graph-store,
|
graph=graph-store,
|
||||||
*metadata-store,
|
metadata=metadata-store,
|
||||||
*group,
|
*group,
|
||||||
group-store,
|
group-store,
|
||||||
inv=invite-store
|
inv=invite-store
|
||||||
@ -16,13 +16,8 @@
|
|||||||
=/ m (strand ,resource)
|
=/ m (strand ,resource)
|
||||||
?: ?=(%group -.associated)
|
?: ?=(%group -.associated)
|
||||||
(pure:m rid.associated)
|
(pure:m rid.associated)
|
||||||
=/ =action:group-store
|
;< ~ bind:m
|
||||||
[%add-group rid policy.associated %&]
|
(poke-our %metadata-push-hook %push-hook-action !>([%add rid]))
|
||||||
;< ~ bind:m (poke-our %group-store %group-action !>(action))
|
|
||||||
;< =bowl:spider bind:m get-bowl:strandio
|
|
||||||
;< ~ bind:m (poke-our %group-store %group-action !>([%add-members rid (sy our.bowl ~)]))
|
|
||||||
;< ~ bind:m
|
|
||||||
(poke-our %group-push-hook %push-hook-action !>([%add rid]))
|
|
||||||
(pure:m rid)
|
(pure:m rid)
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
@ -52,25 +47,21 @@
|
|||||||
::
|
::
|
||||||
;< group=resource bind:m
|
;< group=resource bind:m
|
||||||
(handle-group rid.action associated.action)
|
(handle-group rid.action associated.action)
|
||||||
=/ group-path=path
|
|
||||||
(en-path:resource group)
|
|
||||||
::
|
::
|
||||||
:: Setup metadata
|
:: Setup metadata
|
||||||
::
|
::
|
||||||
=/ =metadata
|
=/ =metadatum:metadata
|
||||||
%* . *metadata
|
%* . *metadatum:metadata
|
||||||
title title.action
|
title title.action
|
||||||
description description.action
|
description description.action
|
||||||
date-created now.bowl
|
date-created now.bowl
|
||||||
creator our.bowl
|
creator our.bowl
|
||||||
module module.action
|
module module.action
|
||||||
==
|
==
|
||||||
=/ =metadata-action
|
=/ met-action=action:metadata
|
||||||
[%add group graph+rid.action metadata]
|
[%add group graph+rid.action metadatum]
|
||||||
;< ~ bind:m
|
;< ~ bind:m
|
||||||
(poke-our %metadata-store %metadata-action !>(metadata-action))
|
(poke-our %metadata-push-hook metadata-update+!>(met-action))
|
||||||
;< ~ bind:m
|
|
||||||
(poke-our %metadata-push-hook %push-hook-action !>([%add group]))
|
|
||||||
::
|
::
|
||||||
:: Send invites
|
:: Send invites
|
||||||
::
|
::
|
||||||
|
@ -64,16 +64,11 @@
|
|||||||
?~ ugroup-rid !!
|
?~ ugroup-rid !!
|
||||||
;< =group bind:m
|
;< =group bind:m
|
||||||
(scry-group u.ugroup-rid)
|
(scry-group u.ugroup-rid)
|
||||||
|
;< ~ bind:m
|
||||||
|
(delete-graph u.ugroup-rid rid.action)
|
||||||
?. hidden.group
|
?. hidden.group
|
||||||
;< ~ bind:m
|
|
||||||
(delete-graph u.ugroup-rid rid.action)
|
|
||||||
(pure:m !>(~))
|
(pure:m !>(~))
|
||||||
;< ~ bind:m
|
;< =thread-result:strandio bind:m
|
||||||
(poke-our %group-store %group-action !>([%remove-group rid.action ~]))
|
(await-thread:strandio %group-delete !>([%delete rid.action]))
|
||||||
;< ~ bind:m
|
|
||||||
(poke-our %group-push-hook %push-hook-action !>([%remove rid.action]))
|
|
||||||
;< ~ bind:m (delete-graph u.ugroup-rid rid.action)
|
|
||||||
;< ~ bind:m
|
|
||||||
%+ poke-our %metadata-hook
|
|
||||||
metadata-hook-action+!>([%remove (en-path:resource u.ugroup-rid)])
|
|
||||||
(pure:m !>(~))
|
(pure:m !>(~))
|
||||||
|
|
||||||
|
@ -19,42 +19,6 @@
|
|||||||
/noun
|
/noun
|
||||||
==
|
==
|
||||||
(pure:m res)
|
(pure:m res)
|
||||||
::
|
|
||||||
++ wait-for-group-join
|
|
||||||
|= rid=resource
|
|
||||||
=/ m (strand ,~)
|
|
||||||
^- form:m
|
|
||||||
=/ pax
|
|
||||||
(en-path:resource rid)
|
|
||||||
=/ hold=@dr ~s0..8000
|
|
||||||
|- ^- form:m
|
|
||||||
?> (lte hold ~m5)
|
|
||||||
=* loop $
|
|
||||||
;< u-group=(unit group) bind:m
|
|
||||||
(scry:strandio ,(unit group) (weld /gx/group-store/groups (snoc pax %noun)))
|
|
||||||
?^ u-group
|
|
||||||
(pure:m ~)
|
|
||||||
;< ~ bind:m (sleep:strandio hold)
|
|
||||||
=. hold (mul hold 2)
|
|
||||||
loop
|
|
||||||
::
|
|
||||||
++ wait-for-md
|
|
||||||
|= rid=resource
|
|
||||||
=/ m (strand ,~)
|
|
||||||
^- form:m
|
|
||||||
=/ pax
|
|
||||||
(en-path:resource rid)
|
|
||||||
=/ hold=@dr ~s0..8000
|
|
||||||
|- ^- form:m
|
|
||||||
?> (lte hold ~m5)
|
|
||||||
=* loop $
|
|
||||||
;< groups=(jug path md-resource) bind:m
|
|
||||||
(scry:strandio ,(jug path md-resource) /gy/metadata-store/group-indices)
|
|
||||||
?: (~(has by groups) pax)
|
|
||||||
(pure:m ~)
|
|
||||||
;< ~ bind:m (sleep:strandio hold)
|
|
||||||
=. hold (mul hold 2)
|
|
||||||
loop
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
^- thread:spider
|
^- thread:spider
|
||||||
@ -67,30 +31,10 @@
|
|||||||
?: =(our.bowl entity.rid.action)
|
?: =(our.bowl entity.rid.action)
|
||||||
(fail %bad-request ~)
|
(fail %bad-request ~)
|
||||||
;< group=(unit resource) bind:m (scry-metadata rid.action)
|
;< group=(unit resource) bind:m (scry-metadata rid.action)
|
||||||
?^ group
|
?> ?=(^ group)
|
||||||
:: We have group, graph is managed
|
:: We have group, graph is managed
|
||||||
;< ~ bind:m
|
|
||||||
%+ poke-our %graph-pull-hook
|
|
||||||
pull-hook-action+!>([%add ship.action rid.action])
|
|
||||||
(pure:m !>(~))
|
|
||||||
:: Else, add group then join
|
|
||||||
;< ~ bind:m
|
;< ~ bind:m
|
||||||
%+ (map-err:strandio ,~) |=(* [%forbidden ~])
|
%+ poke-our %graph-pull-hook
|
||||||
%+ poke
|
pull-hook-action+!>([%add ship.action rid.action])
|
||||||
[ship.action %group-push-hook]
|
|
||||||
group-update+!>([%add-members rid.action (sy our.bowl ~)])
|
|
||||||
::
|
|
||||||
;< ~ bind:m
|
|
||||||
%+ poke-our %group-pull-hook
|
|
||||||
pull-hook-action+!>([%add ship.action rid.action])
|
|
||||||
;< ~ bind:m (wait-for-group-join rid.action)
|
|
||||||
::
|
|
||||||
;< ~ bind:m
|
|
||||||
%+ poke-our %metadata-pull-hook
|
|
||||||
pull-hook-action+!>([%add ship.action rid.action])::
|
|
||||||
;< ~ bind:m (wait-for-md rid.action)
|
|
||||||
::
|
|
||||||
;< ~ bind:m
|
|
||||||
%+ poke-our %graph-pull-hook
|
|
||||||
pull-hook-action+!>([%add ship.action rid.action])
|
|
||||||
(pure:m !>(~))
|
(pure:m !>(~))
|
||||||
|
|
||||||
|
@ -10,16 +10,14 @@
|
|||||||
|= rid=resource
|
|= rid=resource
|
||||||
=/ m (strand ,resource)
|
=/ m (strand ,resource)
|
||||||
^- form:m
|
^- form:m
|
||||||
;< pax=(unit (set path)) bind:m
|
;< group=(unit resource) bind:m
|
||||||
%+ scry:strandio ,(unit (set path))
|
%+ scry:strandio ,(unit resource)
|
||||||
;: weld
|
;: weld
|
||||||
/gx/metadata-store/resource/graph
|
/gx/metadata-store/resource/graph
|
||||||
(en-path:resource rid)
|
(en-path:resource rid)
|
||||||
/noun
|
/noun
|
||||||
==
|
==
|
||||||
?> ?=(^ pax)
|
(pure:m (need group))
|
||||||
?> ?=(^ u.pax)
|
|
||||||
(pure:m (de-path:resource n.u.pax))
|
|
||||||
::
|
::
|
||||||
++ scry-group
|
++ scry-group
|
||||||
|= rid=resource
|
|= rid=resource
|
||||||
@ -59,18 +57,6 @@
|
|||||||
?. hidden.g
|
?. hidden.g
|
||||||
;< ~ bind:m (delete-graph now.bowl rid.action)
|
;< ~ bind:m (delete-graph now.bowl rid.action)
|
||||||
(pure:m !>(~))
|
(pure:m !>(~))
|
||||||
;< ~ bind:m
|
;< =thread-result:strandio bind:m
|
||||||
%+ poke-our %metadata-hook
|
(await-thread:strandio %group-leave !>([%leave rid.action]))
|
||||||
metadata-hook-action+!>([%remove (en-path:resource rid.action)])
|
|
||||||
;< ~ bind:m
|
|
||||||
%+ poke-our %metadata-store
|
|
||||||
:- %metadata-action
|
|
||||||
!> :+ %remove
|
|
||||||
(en-path:resource rid.action)
|
|
||||||
[%graph (en-path:resource rid.action)]
|
|
||||||
;< ~ bind:m
|
|
||||||
(poke-our %group-store %group-action !>([%remove-group rid.action ~]))
|
|
||||||
;< ~ bind:m
|
|
||||||
(poke-our %group-pull-hook %pull-hook-action !>([%remove rid.action]))
|
|
||||||
;< ~ bind:m (delete-graph now.bowl rid.action)
|
|
||||||
(pure:m !>(~))
|
(pure:m !>(~))
|
||||||
|
Loading…
Reference in New Issue
Block a user