graph-store: enforce that only logged-updates may be sent via %run-updates, and enforce that they only affect the intended resource

This commit is contained in:
Logan Allen 2020-06-30 14:08:22 -04:00
parent 849556491c
commit ee5e80cf44
3 changed files with 25 additions and 11 deletions

View File

@ -359,14 +359,23 @@
?> (~(has by graphs) resource)
:_ state
%+ turn (tap:orm-log update-log)
|= [=time =update:store]
|= [=time update=logged-update:store]
^- card
?> ?=(%0 -.update)
:* %pass
/run-updates/(scot %da time)
%agent
[our.bowl %graph-store]
%poke
[%graph-update !>(update)]
:- %graph-update
!>
^- update:store
?- -.q.update
%add-nodes update(resource.q resource)
%remove-nodes update(resource.q resource)
%add-signatures update(resource.uid.q resource)
%remove-signatures update(resource.uid.q resource)
==
==
::
++ give

View File

@ -29,7 +29,7 @@
==
::
++ orm ((or-map atom node) gth)
++ orm-log ((or-map time update) gth)
++ orm-log ((or-map time logged-update) gth)
::
++ enjs
=, enjs:format

View File

@ -12,7 +12,7 @@
+$ node [=post children=internal-graph]
+$ graphs (map resource graph)
+$ tag-queries (jug term resource)
+$ update-log ((mop time update) gth)
+$ update-log ((mop time logged-update) gth)
+$ update-logs (map resource update-log)
::
+$ internal-graph
@ -32,22 +32,27 @@
$% [%0 p=time q=update-0]
==
::
+$ update-0
$% [%add-graph =resource =graph]
[%remove-graph =resource]
::
[%add-nodes =resource nodes=(map index node)]
+$ logged-update
$% [%0 p=time q=logged-update-0]
==
::
+$ logged-update-0
$% [%add-nodes =resource nodes=(map index node)]
[%remove-nodes =resource indices=(set index)]
::
[%add-signatures =uid =signatures]
[%remove-signatures =uid =signatures]
==
::
+$ update-0
$% logged-update-0
[%add-graph =resource =graph]
[%remove-graph =resource]
::
[%add-tag =term =resource]
[%remove-tag =term =resource]
::
[%archive-graph =resource]
[%unarchive-graph =resource]
::
[%run-updates =resource =update-log]
::
:: NOTE: cannot be sent as pokes