graph-store: on overwrite, archive existing graph

This commit is contained in:
Liam Fitzgerald 2020-12-10 12:36:59 +10:00
parent bf9d6cfe44
commit fc189a7c13
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
2 changed files with 10 additions and 2 deletions

View File

@ -257,11 +257,17 @@
?& !(~(has by archive) resource)
!(~(has by graphs) resource)
== ==
=/ old-graph=(unit marked-graph:store)
(~(get by graphs) resource)
?> (validate-graph graph mark)
:_ %_ state
graphs (~(put by graphs) resource [graph mark])
update-logs (~(put by update-logs) resource (gas:orm-log ~ ~))
archive (~(del by archive) resource)
archive
?~ old-graph
(~(del by archive) resource)
(~(put by archive) resource u.old-graph)
::
validators
?~ mark validators
(~(put in validators) u.mark)

View File

@ -37,8 +37,10 @@
::
?. =(our.bowl entity.rid.action)
(strand-fail:strandio %bad-request ~)
=/ overwrite=?
?=(%policy -.associated.action)
=/ =update:graph
[%0 now.bowl %add-graph rid.action *graph:graph mark.action %.n]
[%0 now.bowl %add-graph rid.action *graph:graph mark.action overwrite]
;< ~ bind:m
(poke-our %graph-store graph-update+!>(update))
;< ~ bind:m