From 16d9a0f35b22a39a9328ad1470833264485bb8c2 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 9 Jul 2021 12:54:55 +1000 Subject: [PATCH] metadata-store: upgrade to mark v2 --- pkg/arvo/app/group-view.hoon | 2 +- pkg/arvo/app/hark-group-hook.hoon | 2 +- pkg/arvo/app/metadata-pull-hook.hoon | 6 +++--- pkg/arvo/app/metadata-push-hook.hoon | 2 +- pkg/arvo/app/metadata-store.hoon | 8 ++++---- pkg/arvo/mar/metadata/update-1.hoon | 15 +++++++++++---- pkg/arvo/mar/metadata/update-2.hoon | 15 +++++++++++++++ pkg/arvo/sur/metadata-store.hoon | 12 ++++++++++++ pkg/arvo/ted/graph/create-group-feed.hoon | 4 ++-- pkg/arvo/ted/graph/create.hoon | 2 +- pkg/arvo/ted/graph/delete.hoon | 2 +- pkg/arvo/ted/graph/disable-group-feed.hoon | 2 +- 12 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 pkg/arvo/mar/metadata/update-2.hoon diff --git a/pkg/arvo/app/group-view.hoon b/pkg/arvo/app/group-view.hoon index 9770459eb..1a5a0ba08 100644 --- a/pkg/arvo/app/group-view.hoon +++ b/pkg/arvo/app/group-view.hoon @@ -289,7 +289,7 @@ :: ++ md-fact |= [=mark =vase] - ?. ?=(%metadata-update-1 mark) jn-core + ?. ?=(%metadata-update-2 mark) jn-core =+ !<(=update:metadata vase) ?. ?=(%initial-group -.update) jn-core ?. =(group.update rid) jn-core diff --git a/pkg/arvo/app/hark-group-hook.hoon b/pkg/arvo/app/hark-group-hook.hoon index 2123f8cb8..be5ac0d8c 100644 --- a/pkg/arvo/app/hark-group-hook.hoon +++ b/pkg/arvo/app/hark-group-hook.hoon @@ -113,7 +113,7 @@ (group-update !<(update:group-store q.cage.sign)) [cards this] :: - %metadata-update-1 + %metadata-update-2 =^ cards state (metadata-update !<(update:metadata q.cage.sign)) [cards this] diff --git a/pkg/arvo/app/metadata-pull-hook.hoon b/pkg/arvo/app/metadata-pull-hook.hoon index 4766ff0a1..bdf090efb 100644 --- a/pkg/arvo/app/metadata-pull-hook.hoon +++ b/pkg/arvo/app/metadata-pull-hook.hoon @@ -38,7 +38,7 @@ update:metadata %metadata-update %metadata-push-hook - 1 1 + 2 2 %.n == +$ state-zero @@ -180,7 +180,7 @@ %kick [watch-store^~ state] :: %fact - ?> ?=(%metadata-update-1 p.cage.sign) + ?> ?=(%metadata-update-2 p.cage.sign) =+ !<(=update:metadata q.cage.sign) ?. ?=(%initial-group -.update) `state `state(previews (~(del by previews) group.update)) @@ -325,7 +325,7 @@ %+ turn ~(tap by associations) |= [=md-resource:metadata =association:metadata] %+ poke-our:pass:io %metadata-store - :- %metadata-update-1 + :- %metadata-update-2 !> ^- update:metadata [%remove resource md-resource] :: diff --git a/pkg/arvo/app/metadata-push-hook.hoon b/pkg/arvo/app/metadata-push-hook.hoon index e0c3d99ec..45ffec1f9 100644 --- a/pkg/arvo/app/metadata-push-hook.hoon +++ b/pkg/arvo/app/metadata-push-hook.hoon @@ -14,7 +14,7 @@ update:store %metadata-update %metadata-pull-hook - 1 1 + 2 2 == :: +$ agent (push-hook:push-hook config) diff --git a/pkg/arvo/app/metadata-store.hoon b/pkg/arvo/app/metadata-store.hoon index d14986cfe..ba96e2a35 100644 --- a/pkg/arvo/app/metadata-store.hoon +++ b/pkg/arvo/app/metadata-store.hoon @@ -155,7 +155,7 @@ |^ =^ cards state ?+ mark (on-poke:def mark vase) - ?(%metadata-action %metadata-update-1) + ?(%metadata-action %metadata-update-2) (poke-metadata-update !<(update:store vase)) :: %import @@ -299,7 +299,7 @@ =/ cards=(list card) ?+ path (on-watch:def path) [%all ~] - (give %metadata-update-1 !>([%associations associations])) + (give %metadata-update-2 !>([%associations associations])) :: [%updates ~] ~ @@ -307,7 +307,7 @@ [%app-name @ ~] =/ =app-name:store i.t.path =/ app-indices (metadata-for-app:mc app-name) - (give %metadata-update-1 !>([%associations app-indices])) + (give %metadata-update-2 !>([%associations app-indices])) == [cards this] :: @@ -565,6 +565,6 @@ ++ update-subscribers |= [pax=path =update:store] ^- (list card) - [%give %fact ~[pax] %metadata-update-1 !>(update)]~ + [%give %fact ~[pax] %metadata-update-2 !>(update)]~ -- -- diff --git a/pkg/arvo/mar/metadata/update-1.hoon b/pkg/arvo/mar/metadata/update-1.hoon index 36036d109..01d0cbbcb 100644 --- a/pkg/arvo/mar/metadata/update-1.hoon +++ b/pkg/arvo/mar/metadata/update-1.hoon @@ -1,15 +1,22 @@ /+ store=metadata-store -|_ =update:store +|_ =update:one:store ++ grad %noun ++ grow |% ++ noun update - ++ json (update:enjs:store update) + ++ metadata-update-2 + ^- update:store + update -- :: ++ grab |% - ++ noun update:store - ++ json action:dejs:store + ++ noun update:one:store + :: This is ok, we don't send %edit over the wire yet. + ++ metadata-update-2 + |= upd=update:store + ^- update:one:store + ?< ?=(%edit -.upd) + upd -- -- diff --git a/pkg/arvo/mar/metadata/update-2.hoon b/pkg/arvo/mar/metadata/update-2.hoon new file mode 100644 index 000000000..0b55129f1 --- /dev/null +++ b/pkg/arvo/mar/metadata/update-2.hoon @@ -0,0 +1,15 @@ +/+ store=metadata-store +|_ =update:store +++ grad %noun +++ grow + |% + ++ noun update + ++ json (update:enjs:store update) + -- +:: +++ grab + |% + ++ noun update:store + ++ json update:dejs:store + -- +-- diff --git a/pkg/arvo/sur/metadata-store.hoon b/pkg/arvo/sur/metadata-store.hoon index 071e45692..9979f3e85 100644 --- a/pkg/arvo/sur/metadata-store.hoon +++ b/pkg/arvo/sur/metadata-store.hoon @@ -90,6 +90,18 @@ == == :: historical +++ one + |% + :: + +$ action + $~ [%remove *resource *md-resource] + $< %edit ^action + :: + +$ update + $~ [%remove *resource *md-resource] + $< %edit ^update + :: + -- ++ zero |% :: diff --git a/pkg/arvo/ted/graph/create-group-feed.hoon b/pkg/arvo/ted/graph/create-group-feed.hoon index 83590f592..1cf6d261e 100644 --- a/pkg/arvo/ted/graph/create-group-feed.hoon +++ b/pkg/arvo/ted/graph/create-group-feed.hoon @@ -46,7 +46,7 @@ (poke-our %graph-push-hook %push-hook-action !>([%add feed-rid])) ;< ~ bind:m %+ poke-our %metadata-push-hook - :- %metadata-update-1 + :- %metadata-update-2 !> ^- action:met :^ %add group.action @@ -54,7 +54,7 @@ metadatum(feed.config ``[%graph feed-rid]) ;< ~ bind:m %+ poke-our %metadata-push-hook - :- %metadata-update-1 + :- %metadata-update-2 !> ^- action:met :^ %add group.action diff --git a/pkg/arvo/ted/graph/create.hoon b/pkg/arvo/ted/graph/create.hoon index 44f9cd098..04ad3664d 100644 --- a/pkg/arvo/ted/graph/create.hoon +++ b/pkg/arvo/ted/graph/create.hoon @@ -78,7 +78,7 @@ =/ met-action=action:met [%add group graph+rid.action metadatum] ;< ~ bind:m - (poke-our %metadata-push-hook metadata-update-1+!>(met-action)) + (poke-our %metadata-push-hook metadata-update-2+!>(met-action)) :: :: Send invites :: diff --git a/pkg/arvo/ted/graph/delete.hoon b/pkg/arvo/ted/graph/delete.hoon index bab899d6e..e074482df 100644 --- a/pkg/arvo/ted/graph/delete.hoon +++ b/pkg/arvo/ted/graph/delete.hoon @@ -41,7 +41,7 @@ (poke-our %graph-push-hook %push-hook-action !>([%remove rid])) ;< ~ bind:m %+ poke-our %metadata-push-hook - :- %metadata-update-1 + :- %metadata-update-2 !> ^- action:metadata [%remove group-rid [%graph rid]] (pure:m ~) diff --git a/pkg/arvo/ted/graph/disable-group-feed.hoon b/pkg/arvo/ted/graph/disable-group-feed.hoon index 5b9d6555e..15b40e2f9 100644 --- a/pkg/arvo/ted/graph/disable-group-feed.hoon +++ b/pkg/arvo/ted/graph/disable-group-feed.hoon @@ -31,7 +31,7 @@ == ;< ~ bind:m %+ poke-our %metadata-push-hook - :- %metadata-update-1 + :- %metadata-update-2 !> ^- action:met :^ %add group.action