diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index 42c95da91d..b74743e115 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -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) diff --git a/pkg/arvo/app/link-store.hoon b/pkg/arvo/app/link-store.hoon index 0d8f472cfb..d653e7748c 100644 --- a/pkg/arvo/app/link-store.hoon +++ b/pkg/arvo/app/link-store.hoon @@ -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 diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 1ee0c74505..2588be4338 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -271,6 +271,7 @@ rid graph `%graph-validator-publish + %.y == (poke-graph-push %add rid) == diff --git a/pkg/arvo/gen/graph-store/add-graph.hoon b/pkg/arvo/gen/graph-store/add-graph.hoon index a95468928b..0192ede89e 100644 --- a/pkg/arvo/gen/graph-store/add-graph.hoon +++ b/pkg/arvo/gen/graph-store/add-graph.hoon @@ -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]] diff --git a/pkg/arvo/lib/graph-store.hoon b/pkg/arvo/lib/graph-store.hoon index 0b339bc769..397637c865 100644 --- a/pkg/arvo/lib/graph-store.hoon +++ b/pkg/arvo/lib/graph-store.hoon @@ -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 diff --git a/pkg/arvo/sur/graph-store.hoon b/pkg/arvo/sur/graph-store.hoon index edcfb41359..e2570fed81 100644 --- a/pkg/arvo/sur/graph-store.hoon +++ b/pkg/arvo/sur/graph-store.hoon @@ -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] diff --git a/pkg/arvo/ted/graph/create.hoon b/pkg/arvo/ted/graph/create.hoon index 2871218327..e0c5448186 100644 --- a/pkg/arvo/ted/graph/create.hoon +++ b/pkg/arvo/ted/graph/create.hoon @@ -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