mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
graph-store: add overwrite field to %add-graph
This commit is contained in:
parent
25a68b16a7
commit
4f7ca0a0dc
@ -66,8 +66,7 @@
|
||||
::
|
||||
update-logs.old
|
||||
%- ~(run by update-logs.old)
|
||||
|= =update-log:store
|
||||
*update-log:store
|
||||
|=(a=* *update-log:store)
|
||||
==
|
||||
::
|
||||
%1
|
||||
@ -77,8 +76,7 @@
|
||||
::
|
||||
update-logs.old
|
||||
%- ~(run by update-logs.old)
|
||||
|= =update-log:store
|
||||
*update-log:store
|
||||
|=(a=* *update-log:store)
|
||||
==
|
||||
::
|
||||
%2 [cards this(state old)]
|
||||
@ -247,20 +245,27 @@
|
||||
==
|
||||
::
|
||||
++ add-graph
|
||||
|= [=resource:store =graph:store mark=(unit mark:store)]
|
||||
|= $: =resource:store
|
||||
=graph:store
|
||||
mark=(unit mark:store)
|
||||
overwrite=?
|
||||
==
|
||||
^- (quip card _state)
|
||||
?< (~(has by archive) resource)
|
||||
?< (~(has by graphs) resource)
|
||||
?> ?| overwrite
|
||||
?& !(~(has by archive) resource)
|
||||
!(~(has 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)
|
||||
validators
|
||||
?~ mark validators
|
||||
(~(put in validators) u.mark)
|
||||
==
|
||||
%- zing
|
||||
:~ (give [/updates /keys ~] [%add-graph resource graph mark])
|
||||
:~ (give [/updates /keys ~] [%add-graph resource graph mark overwrite])
|
||||
?~ mark ~
|
||||
?: (~(has in validators) u.mark) ~
|
||||
=/ wire /validator/[u.mark]
|
||||
@ -646,7 +651,7 @@
|
||||
!> ^- update:store
|
||||
:+ %0
|
||||
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
|
||||
::
|
||||
@ -662,7 +667,7 @@
|
||||
!> ^- update:store
|
||||
:+ %0
|
||||
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 @ @ @ @ ~]
|
||||
=/ =ship (slav %p i.t.t.path)
|
||||
|
@ -116,7 +116,7 @@
|
||||
|= [=resource =graph:gra]
|
||||
^- card
|
||||
%- 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
|
||||
|= =resource
|
||||
|
@ -271,6 +271,7 @@
|
||||
rid
|
||||
graph
|
||||
`%graph-validator-publish
|
||||
%.y
|
||||
==
|
||||
(poke-graph-push %add rid)
|
||||
==
|
||||
|
@ -3,8 +3,8 @@
|
||||
/+ *graph-store
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource mark=(unit mark) ~] ~]
|
||||
[[=resource mark=(unit mark) overwrite=? ~] ~]
|
||||
==
|
||||
:- %graph-update
|
||||
^- update
|
||||
[%0 now [%add-graph resource (gas:orm ~ ~) mark]]
|
||||
[%0 now [%add-graph resource (gas:orm ~ ~) mark overwrite]]
|
||||
|
@ -123,6 +123,7 @@
|
||||
:~ [%resource (enjs:res resource.upd)]
|
||||
[%graph (graph graph.upd)]
|
||||
[%mark ?~(mark.upd ~ s+u.mark.upd)]
|
||||
[%overwrite b+overwrite.upd]
|
||||
==
|
||||
::
|
||||
%remove-graph
|
||||
@ -276,6 +277,7 @@
|
||||
:~ [%resource dejs:res]
|
||||
[%graph graph]
|
||||
[%mark (mu so)]
|
||||
[%overwrite bo]
|
||||
==
|
||||
::
|
||||
++ graph
|
||||
|
@ -42,7 +42,7 @@
|
||||
::
|
||||
+$ update-0
|
||||
$% logged-update-0
|
||||
[%add-graph =resource =graph mark=(unit mark)]
|
||||
[%add-graph =resource =graph mark=(unit mark) overwrite=?]
|
||||
[%remove-graph =resource]
|
||||
::
|
||||
[%add-tag =term =resource]
|
||||
|
@ -38,7 +38,7 @@
|
||||
?. =(our.bowl entity.rid.action)
|
||||
(strand-fail:strandio %bad-request ~)
|
||||
=/ =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
|
||||
(poke-our %graph-store graph-update+!>(update))
|
||||
;< ~ bind:m
|
||||
|
Loading…
Reference in New Issue
Block a user