graph-store: add overwrite field to %add-graph

This commit is contained in:
Logan Allen 2020-11-12 20:40:12 +00:00
parent 25a68b16a7
commit 4f7ca0a0dc
7 changed files with 23 additions and 15 deletions

View File

@ -66,8 +66,7 @@
:: ::
update-logs.old update-logs.old
%- ~(run by update-logs.old) %- ~(run by update-logs.old)
|= =update-log:store |=(a=* *update-log:store)
*update-log:store
== ==
:: ::
%1 %1
@ -77,8 +76,7 @@
:: ::
update-logs.old update-logs.old
%- ~(run by update-logs.old) %- ~(run by update-logs.old)
|= =update-log:store |=(a=* *update-log:store)
*update-log:store
== ==
:: ::
%2 [cards this(state old)] %2 [cards this(state old)]
@ -247,20 +245,27 @@
== ==
:: ::
++ add-graph ++ add-graph
|= [=resource:store =graph:store mark=(unit mark:store)] |= $: =resource:store
=graph:store
mark=(unit mark:store)
overwrite=?
==
^- (quip card _state) ^- (quip card _state)
?< (~(has by archive) resource) ?> ?| overwrite
?< (~(has by graphs) resource) ?& !(~(has by archive) resource)
!(~(has by graphs) resource)
== ==
?> (validate-graph graph mark) ?> (validate-graph graph mark)
:_ %_ state :_ %_ state
graphs (~(put by graphs) resource [graph mark]) graphs (~(put by graphs) resource [graph mark])
update-logs (~(put by update-logs) resource (gas:orm-log ~ ~)) update-logs (~(put by update-logs) resource (gas:orm-log ~ ~))
archive (~(del by archive) resource)
validators validators
?~ mark validators ?~ mark validators
(~(put in validators) u.mark) (~(put in validators) u.mark)
== ==
%- zing %- zing
:~ (give [/updates /keys ~] [%add-graph resource graph mark]) :~ (give [/updates /keys ~] [%add-graph resource graph mark overwrite])
?~ mark ~ ?~ mark ~
?: (~(has in validators) u.mark) ~ ?: (~(has in validators) u.mark) ~
=/ wire /validator/[u.mark] =/ wire /validator/[u.mark]
@ -646,7 +651,7 @@
!> ^- update:store !> ^- update:store
:+ %0 :+ %0
now.bowl now.bowl
[%add-graph [ship term] `graph:store`p.u.result q.u.result] [%add-graph [ship term] `graph:store`p.u.result q.u.result %.y]
:: ::
:: note: near-duplicate of /x/graph :: note: near-duplicate of /x/graph
:: ::
@ -662,7 +667,7 @@
!> ^- update:store !> ^- update:store
:+ %0 :+ %0
now.bowl now.bowl
[%add-graph [ship term] `graph:store`p.u.result q.u.result] [%add-graph [ship term] `graph:store`p.u.result q.u.result %.y]
:: ::
[%x %graph-subset @ @ @ @ ~] [%x %graph-subset @ @ @ @ ~]
=/ =ship (slav %p i.t.t.path) =/ =ship (slav %p i.t.t.path)

View File

@ -116,7 +116,7 @@
|= [=resource =graph:gra] |= [=resource =graph:gra]
^- card ^- card
%- poke-graph-store %- poke-graph-store
[%0 now.bowl %add-graph resource graph `%graph-validator-link] [%0 now.bowl %add-graph resource graph `%graph-validator-link %.y]
:: ::
++ archive-graph ++ archive-graph
|= =resource |= =resource

View File

@ -271,6 +271,7 @@
rid rid
graph graph
`%graph-validator-publish `%graph-validator-publish
%.y
== ==
(poke-graph-push %add rid) (poke-graph-push %add rid)
== ==

View File

@ -3,8 +3,8 @@
/+ *graph-store /+ *graph-store
:- %say :- %say
|= $: [now=@da eny=@uvJ =beak] |= $: [now=@da eny=@uvJ =beak]
[[=resource mark=(unit mark) ~] ~] [[=resource mark=(unit mark) overwrite=? ~] ~]
== ==
:- %graph-update :- %graph-update
^- update ^- update
[%0 now [%add-graph resource (gas:orm ~ ~) mark]] [%0 now [%add-graph resource (gas:orm ~ ~) mark overwrite]]

View File

@ -123,6 +123,7 @@
:~ [%resource (enjs:res resource.upd)] :~ [%resource (enjs:res resource.upd)]
[%graph (graph graph.upd)] [%graph (graph graph.upd)]
[%mark ?~(mark.upd ~ s+u.mark.upd)] [%mark ?~(mark.upd ~ s+u.mark.upd)]
[%overwrite b+overwrite.upd]
== ==
:: ::
%remove-graph %remove-graph
@ -276,6 +277,7 @@
:~ [%resource dejs:res] :~ [%resource dejs:res]
[%graph graph] [%graph graph]
[%mark (mu so)] [%mark (mu so)]
[%overwrite bo]
== ==
:: ::
++ graph ++ graph

View File

@ -42,7 +42,7 @@
:: ::
+$ update-0 +$ update-0
$% logged-update-0 $% logged-update-0
[%add-graph =resource =graph mark=(unit mark)] [%add-graph =resource =graph mark=(unit mark) overwrite=?]
[%remove-graph =resource] [%remove-graph =resource]
:: ::
[%add-tag =term =resource] [%add-tag =term =resource]

View File

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