2020-08-19 22:22:20 +03:00
|
|
|
/+ store=graph-store
|
2020-09-18 23:09:06 +03:00
|
|
|
/+ metadata
|
2020-08-19 22:22:20 +03:00
|
|
|
/+ res=resource
|
|
|
|
/+ graph
|
|
|
|
/+ group
|
|
|
|
/+ default-agent
|
|
|
|
/+ dbug
|
|
|
|
/+ push-hook
|
2020-12-05 07:32:17 +03:00
|
|
|
~% %graph-push-hook-top ..part ~
|
2020-08-19 22:22:20 +03:00
|
|
|
|%
|
|
|
|
+$ card card:agent:gall
|
|
|
|
++ config
|
|
|
|
^- config:push-hook
|
|
|
|
:* %graph-store
|
|
|
|
/updates
|
|
|
|
update:store
|
|
|
|
%graph-update
|
|
|
|
%graph-pull-hook
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ agent (push-hook:push-hook config)
|
2020-09-15 20:29:26 +03:00
|
|
|
::
|
2020-09-18 23:09:06 +03:00
|
|
|
++ is-allowed
|
2020-09-19 00:59:56 +03:00
|
|
|
|= [=resource:res =bowl:gall requires-admin=?]
|
2020-09-15 20:29:26 +03:00
|
|
|
^- ?
|
|
|
|
=/ grp ~(. group bowl)
|
2020-09-18 23:09:06 +03:00
|
|
|
=/ met ~(. metadata bowl)
|
2021-01-13 07:05:22 +03:00
|
|
|
=/ group=(unit resource:res)
|
2021-01-14 01:50:39 +03:00
|
|
|
(peek-group:met %graph resource)
|
2021-01-13 07:05:22 +03:00
|
|
|
?~ group %.n
|
2020-09-19 00:59:56 +03:00
|
|
|
?: requires-admin
|
2021-01-13 07:05:22 +03:00
|
|
|
(is-admin:grp src.bowl u.group)
|
|
|
|
?| (is-member:grp src.bowl u.group)
|
|
|
|
(is-admin:grp src.bowl u.group)
|
2020-09-18 23:09:06 +03:00
|
|
|
==
|
2020-11-03 03:20:15 +03:00
|
|
|
::
|
|
|
|
++ is-allowed-remove
|
|
|
|
|= [=resource:res indices=(set index:store) =bowl:gall]
|
|
|
|
^- ?
|
|
|
|
=/ gra ~(. graph bowl)
|
|
|
|
?. (is-allowed resource bowl %.n)
|
|
|
|
%.n
|
|
|
|
%+ levy
|
|
|
|
~(tap in indices)
|
|
|
|
|= =index:store
|
|
|
|
^- ?
|
|
|
|
=/ =node:store
|
2020-11-03 21:10:57 +03:00
|
|
|
(got-node:gra resource index)
|
2020-11-03 03:20:15 +03:00
|
|
|
?| =(author.post.node src.bowl)
|
|
|
|
(is-allowed resource bowl %.y)
|
|
|
|
==
|
2020-08-19 22:22:20 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
%- agent:dbug
|
|
|
|
^- agent:gall
|
|
|
|
%- (agent:push-hook config)
|
|
|
|
^- agent
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
|
|
|
grp ~(. group bowl)
|
|
|
|
gra ~(. graph bowl)
|
|
|
|
::
|
|
|
|
++ on-init on-init:def
|
|
|
|
++ on-save !>(~)
|
|
|
|
++ on-load on-load:def
|
|
|
|
++ on-poke on-poke:def
|
|
|
|
++ on-agent on-agent:def
|
|
|
|
++ on-watch on-watch:def
|
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-peek on-peek:def
|
|
|
|
++ on-arvo on-arvo:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
::
|
|
|
|
++ should-proxy-update
|
|
|
|
|= =vase
|
|
|
|
^- ?
|
|
|
|
=/ =update:store !<(update:store vase)
|
|
|
|
?- -.q.update
|
2020-09-19 00:59:56 +03:00
|
|
|
%add-graph (is-allowed resource.q.update bowl %.y)
|
|
|
|
%remove-graph (is-allowed resource.q.update bowl %.y)
|
|
|
|
%add-nodes (is-allowed resource.q.update bowl %.n)
|
2020-11-03 03:20:15 +03:00
|
|
|
%remove-nodes (is-allowed-remove resource.q.update indices.q.update bowl)
|
2020-09-19 00:59:56 +03:00
|
|
|
%add-signatures (is-allowed resource.uid.q.update bowl %.n)
|
|
|
|
%remove-signatures (is-allowed resource.uid.q.update bowl %.y)
|
|
|
|
%archive-graph (is-allowed resource.q.update bowl %.y)
|
2020-08-19 22:22:20 +03:00
|
|
|
%unarchive-graph %.n
|
|
|
|
%add-tag %.n
|
|
|
|
%remove-tag %.n
|
|
|
|
%keys %.n
|
|
|
|
%tags %.n
|
|
|
|
%tag-queries %.n
|
2020-09-19 00:59:56 +03:00
|
|
|
%run-updates (is-allowed resource.q.update bowl %.y)
|
2020-08-19 22:22:20 +03:00
|
|
|
==
|
|
|
|
::
|
2021-02-01 23:49:14 +03:00
|
|
|
++ resource-for-update
|
|
|
|
|= =vase
|
|
|
|
^- (list resource:res)
|
|
|
|
=/ =update:store !<(update:store vase)
|
|
|
|
?- -.q.update
|
|
|
|
%add-graph ~[resource.q.update]
|
|
|
|
%remove-graph ~[resource.q.update]
|
|
|
|
%add-nodes ~[resource.q.update]
|
|
|
|
%remove-nodes ~[resource.q.update]
|
|
|
|
%add-signatures ~[resource.uid.q.update]
|
|
|
|
%remove-signatures ~[resource.uid.q.update]
|
|
|
|
%archive-graph ~[resource.q.update]
|
|
|
|
%unarchive-graph ~
|
|
|
|
%add-tag ~
|
|
|
|
%remove-tag ~
|
|
|
|
%keys ~
|
|
|
|
%tags ~
|
|
|
|
%tag-queries ~
|
|
|
|
%run-updates ~[resource.q.update]
|
|
|
|
==
|
|
|
|
::
|
2020-08-19 22:22:20 +03:00
|
|
|
++ initial-watch
|
|
|
|
|= [=path =resource:res]
|
|
|
|
^- vase
|
2020-09-19 00:59:56 +03:00
|
|
|
?> (is-allowed resource bowl %.n)
|
2020-08-19 22:22:20 +03:00
|
|
|
!> ^- update:store
|
|
|
|
?~ path
|
|
|
|
:: new subscribe
|
|
|
|
::
|
2020-09-15 23:46:00 +03:00
|
|
|
(get-graph:gra resource)
|
2020-08-19 22:22:20 +03:00
|
|
|
:: resubscribe
|
|
|
|
::
|
2020-11-10 22:56:19 +03:00
|
|
|
?~ (get-update-log:gra resource)
|
|
|
|
(get-graph:gra resource)
|
2020-08-19 22:22:20 +03:00
|
|
|
=/ =time (slav %da i.path)
|
|
|
|
=/ =update-log:store (get-update-log-subset:gra resource time)
|
|
|
|
[%0 now.bowl [%run-updates resource update-log]]
|
|
|
|
::
|
|
|
|
++ take-update
|
|
|
|
|= =vase
|
|
|
|
^- [(list card) agent]
|
|
|
|
=/ =update:store !<(update:store vase)
|
|
|
|
?+ -.q.update [~ this]
|
|
|
|
%remove-graph
|
|
|
|
:_ this
|
|
|
|
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
|
|
|
|
::
|
|
|
|
%archive-graph
|
|
|
|
:_ this
|
|
|
|
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
|
|
|
|
==
|
|
|
|
--
|