From 837abacb9cb5d37311ddcf0523588e41494bfedb Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Fri, 20 Nov 2020 11:01:24 -0600 Subject: [PATCH 01/24] observe-hook: add new thread to leave graphs upon removing a group --- pkg/arvo/app/observe-hook.hoon | 27 ++++++++++++++++++---- pkg/arvo/ted/group/leave-graph.hoon | 35 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 pkg/arvo/ted/group/leave-graph.hoon diff --git a/pkg/arvo/app/observe-hook.hoon b/pkg/arvo/app/observe-hook.hoon index 174b90b13..e2ec831e9 100644 --- a/pkg/arvo/app/observe-hook.hoon +++ b/pkg/arvo/app/observe-hook.hoon @@ -10,10 +10,13 @@ +$ card card:agent:gall +$ versioned-state $% state-0 + state-0 == :: +$ serial @uv +$ state-0 [%0 observers=(map serial observer:sur)] ++$ state-1 [%1 observers=(map serial observer:sur)] +:: ++ got-by-val |= [a=(map serial observer:sur) b=observer:sur] ^- serial @@ -24,7 +27,7 @@ -- :: %- agent:dbug -=| state-0 +=| state-1 =* state - :: ^- agent:gall @@ -35,8 +38,14 @@ ++ on-init |^ ^- (quip card _this) :_ this - :_ ~ - (act /inv-gra [%watch %invite-store /invitatory/graph %invite-accepted-graph]) + :~ %+ act + /inv-gra + [%watch %invite-store /invitatory/graph %invite-accepted-graph] + :: + %+ act + /grp-gra + [%watch %group-store /groups %group-leave-graph] + == :: ++ act |= [=wire =action:sur] @@ -56,7 +65,17 @@ ++ on-load |= old-vase=vase ^- (quip card _this) - `this(state !<(state-0 old-vase)) + =/ old-state !<(versioned-state old-vase) + ?- -.old-state + %1 `this(state old-state) + :: + %0 + =. this(state [%1 observers.old-state]) + %+ on-poke + %observe-action + !> ^- action:sur + [%watch %group-store /groups %group-leave-graph] + == :: ++ on-poke |= [=mark =vase] diff --git a/pkg/arvo/ted/group/leave-graph.hoon b/pkg/arvo/ted/group/leave-graph.hoon new file mode 100644 index 000000000..3ea41e1ad --- /dev/null +++ b/pkg/arvo/ted/group/leave-graph.hoon @@ -0,0 +1,35 @@ +/- spider, grp=group-store, gra=graph-store, met=metadata-store +/+ strandio, res=resource +:: +=* strand strand:spider +=* poke-our poke-our:strandio +=* scry scry:strandio +:: +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([=update:grp ~] arg) +?. ?=(%remove-group -.update) + (pure:m !>(~)) +:: +:: get graphs associated with group and archive them +=/ graphs=(list path) + %+ turn + %~ tap in + %~ key by + ^- associations:met + %+ scry + %noun + (weld /group (en-path:res resource.update)) + |= [g=group-path:met m=md-resource:met] + ^- path + app-path.m +|- +?~ groups + (pure:m !>(~)) +;< ~ bind:m + %+ poke-our %graph-store + !> ^- update:graph-store + [%archive-graph (de-path:res i.groups)] +$(groups t.groups) From b4e66ec4edca42b0f48856e7d9f2cff88088b42d Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 12:50:38 -0600 Subject: [PATCH 02/24] thread: %group-leave-graph now compiles --- pkg/arvo/ted/group/leave-graph.hoon | 31 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/ted/group/leave-graph.hoon b/pkg/arvo/ted/group/leave-graph.hoon index 3ea41e1ad..da9b90c64 100644 --- a/pkg/arvo/ted/group/leave-graph.hoon +++ b/pkg/arvo/ted/group/leave-graph.hoon @@ -14,22 +14,27 @@ (pure:m !>(~)) :: :: get graphs associated with group and archive them +;< =associations:met bind:m + %+ scry associations:met + ;: weld + /gx/metadata-store/resource/group + (en-path:res resource.update) + /noun + == =/ graphs=(list path) - %+ turn - %~ tap in - %~ key by - ^- associations:met - %+ scry - %noun - (weld /group (en-path:res resource.update)) + %+ turn ~(tap in ~(key by associations)) |= [g=group-path:met m=md-resource:met] ^- path app-path.m -|- -?~ groups +;< =bowl:spider bind:m get-bowl:strandio +|- ^- form:m +=* loop $ +?~ graphs (pure:m !>(~)) ;< ~ bind:m - %+ poke-our %graph-store - !> ^- update:graph-store - [%archive-graph (de-path:res i.groups)] -$(groups t.groups) + %^ poke-our + %graph-store + %graph-update + !> ^- update:gra + [%0 now.bowl [%archive-graph (de-path:res i.graphs)]] +loop(graphs t.graphs) From f2e20efcf01fbab20bf5bf775000fdf895f55fd4 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 13:20:27 -0600 Subject: [PATCH 03/24] observe-hook: compiles --- pkg/arvo/app/observe-hook.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/observe-hook.hoon b/pkg/arvo/app/observe-hook.hoon index e2ec831e9..28d629169 100644 --- a/pkg/arvo/app/observe-hook.hoon +++ b/pkg/arvo/app/observe-hook.hoon @@ -10,7 +10,7 @@ +$ card card:agent:gall +$ versioned-state $% state-0 - state-0 + state-1 == :: +$ serial @uv @@ -70,7 +70,7 @@ %1 `this(state old-state) :: %0 - =. this(state [%1 observers.old-state]) + =. state [%1 observers.old-state] %+ on-poke %observe-action !> ^- action:sur From 1aa933730170e2b44823215447cd54957f5531db Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 14:33:22 -0600 Subject: [PATCH 04/24] leave-graph: emit %done upon failed poke-acks --- pkg/arvo/lib/strandio.hoon | 19 +++++++++++++++++++ pkg/arvo/ted/group/leave-graph.hoon | 10 +++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 80c4178a1..f0e06f4b9 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -219,6 +219,25 @@ ;< ~ bind:m (send-raw-card card) (take-poke-ack /poke) :: +++ raw-poke + |= [=dock =cage] + =/ m (strand ,~) + ^- form:m + =/ =card:agent:gall [%pass /poke %agent dock %poke cage] + ;< ~ bind:m (send-raw-card card) + =/ m (strand ,~) + ^- form:m + |= tin=strand-input:strand + ?+ in.tin `[%skip ~] + ~ + `[%wait ~] + :: + [~ %agent * %poke-ack *] + ?. =(/poke wire.u.in.tin) + `[%skip ~] + `[%done ~] + == +:: ++ poke-our |= [=term =cage] =/ m (strand ,~) diff --git a/pkg/arvo/ted/group/leave-graph.hoon b/pkg/arvo/ted/group/leave-graph.hoon index da9b90c64..ff0b8fb72 100644 --- a/pkg/arvo/ted/group/leave-graph.hoon +++ b/pkg/arvo/ted/group/leave-graph.hoon @@ -2,7 +2,7 @@ /+ strandio, res=resource :: =* strand strand:spider -=* poke-our poke-our:strandio +=* raw-poke raw-poke:strandio =* scry scry:strandio :: ^- thread:spider @@ -17,7 +17,7 @@ ;< =associations:met bind:m %+ scry associations:met ;: weld - /gx/metadata-store/resource/group + /gx/metadata-store/group (en-path:res resource.update) /noun == @@ -32,9 +32,9 @@ ?~ graphs (pure:m !>(~)) ;< ~ bind:m - %^ poke-our - %graph-store - %graph-update + %+ raw-poke + [our.bowl %graph-store] + :- %graph-update !> ^- update:gra [%0 now.bowl [%archive-graph (de-path:res i.graphs)]] loop(graphs t.graphs) From a6bf3ca92420d6fa791b24a2e3d1071f4f5509b7 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 16:20:26 -0600 Subject: [PATCH 05/24] observe-hook + thread: remove metadata when leaving a group --- pkg/arvo/app/observe-hook.hoon | 13 ++++++-- pkg/arvo/ted/group/leave-metadata.hoon | 43 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 pkg/arvo/ted/group/leave-metadata.hoon diff --git a/pkg/arvo/app/observe-hook.hoon b/pkg/arvo/app/observe-hook.hoon index 28d629169..720d81627 100644 --- a/pkg/arvo/app/observe-hook.hoon +++ b/pkg/arvo/app/observe-hook.hoon @@ -11,11 +11,13 @@ +$ versioned-state $% state-0 state-1 + state-2 == :: +$ serial @uv +$ state-0 [%0 observers=(map serial observer:sur)] +$ state-1 [%1 observers=(map serial observer:sur)] ++$ state-1 [%2 observers=(map serial observer:sur)] :: ++ got-by-val |= [a=(map serial observer:sur) b=observer:sur] @@ -27,7 +29,7 @@ -- :: %- agent:dbug -=| state-1 +=| state-2 =* state - :: ^- agent:gall @@ -67,7 +69,14 @@ ^- (quip card _this) =/ old-state !<(versioned-state old-vase) ?- -.old-state - %1 `this(state old-state) + %2 `this(state old-state) + :: + %1 + =. state [%2 observers.old-state] + %+ on-poke + %observe-action + !> ^- action:sur + [%watch %group-store /groups %group-leave-metadata] :: %0 =. state [%1 observers.old-state] diff --git a/pkg/arvo/ted/group/leave-metadata.hoon b/pkg/arvo/ted/group/leave-metadata.hoon new file mode 100644 index 000000000..5056f4389 --- /dev/null +++ b/pkg/arvo/ted/group/leave-metadata.hoon @@ -0,0 +1,43 @@ +/- spider, grp=group-store, met=metadata-store, hook=metadata-hook +/+ strandio, res=resource +:: +=* strand strand:spider +=* raw-poke raw-poke:strandio +=* scry scry:strandio +:: +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([=update:grp ~] arg) +?. ?=(%remove-group -.update) + (pure:m !>(~)) +;< =bowl:spider bind:m get-bowl:strandio +;< ~ bind:m + %+ raw-poke + [our.bowl %metadata-hook] + :- %metadata-hook-action + !> ^- metadata-hook-action:hook + [%remove (en-path:res resource.update)] +:: +:: get metadata associated with group and remove it +;< =associations:met bind:m + %+ scry associations:met + ;: weld + /gx/metadata-store/group + (en-path:res resource.update) + /noun + == +=/ entries=(list [g=group-path:met m=md-resource:met]) + ~(tap in ~(key by associations)) +|- ^- form:m +=* loop $ +?~ entries + (pure:m !>(~)) +;< ~ bind:m + %+ raw-poke + [our.bowl %metadata-store] + :- %metadata-action + !> ^- metadata-action:met + [%remove g.i.entries m.i.entries] +loop(entries t.entries) From 6c26a01655cb3b8e57f5b8735c49843ffc44449e Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 16:22:20 -0600 Subject: [PATCH 06/24] contact-view: remove (now) unnecessary metadata removal --- pkg/arvo/app/contact-view.hoon | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index 2abbbb0f6..198d4362c 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -195,7 +195,6 @@ (group-poke [%remove-group rid ~]) (contact-poke [%delete path.act]) == - (delete-metadata path.act) == :: %remove @@ -357,13 +356,6 @@ (metadata-hook-poke [%add-owned path]) == :: -++ delete-metadata - |= =path - ^- (list card) - :~ (metadata-poke [%remove path [%contacts path]]) - (metadata-hook-poke [%remove path]) - == -:: ++ all-scry ^- rolodex .^(rolodex %gx /(scot %p our.bol)/contact-store/(scot %da now.bol)/all/noun) From 41e3af25b34190a443ee3e5def76cdaf6f866ca8 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 16:30:20 -0600 Subject: [PATCH 07/24] threads: collapse them into a single %group-on-leave thread --- pkg/arvo/app/observe-hook.hoon | 15 ++---- pkg/arvo/ted/group/leave-graph.hoon | 40 --------------- pkg/arvo/ted/group/leave-metadata.hoon | 50 ++++++++++++++----- pkg/arvo/ted/group/on-leave.hoon | 69 ++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 64 deletions(-) delete mode 100644 pkg/arvo/ted/group/leave-graph.hoon create mode 100644 pkg/arvo/ted/group/on-leave.hoon diff --git a/pkg/arvo/app/observe-hook.hoon b/pkg/arvo/app/observe-hook.hoon index 720d81627..da2f3b8ba 100644 --- a/pkg/arvo/app/observe-hook.hoon +++ b/pkg/arvo/app/observe-hook.hoon @@ -11,13 +11,11 @@ +$ versioned-state $% state-0 state-1 - state-2 == :: +$ serial @uv +$ state-0 [%0 observers=(map serial observer:sur)] +$ state-1 [%1 observers=(map serial observer:sur)] -+$ state-1 [%2 observers=(map serial observer:sur)] :: ++ got-by-val |= [a=(map serial observer:sur) b=observer:sur] @@ -46,7 +44,7 @@ :: %+ act /grp-gra - [%watch %group-store /groups %group-leave-graph] + [%watch %group-store /groups %group-on-leave] == :: ++ act @@ -69,21 +67,14 @@ ^- (quip card _this) =/ old-state !<(versioned-state old-vase) ?- -.old-state - %2 `this(state old-state) - :: - %1 - =. state [%2 observers.old-state] - %+ on-poke - %observe-action - !> ^- action:sur - [%watch %group-store /groups %group-leave-metadata] + %1 `this(state old-state) :: %0 =. state [%1 observers.old-state] %+ on-poke %observe-action !> ^- action:sur - [%watch %group-store /groups %group-leave-graph] + [%watch %group-store /groups %group-on-leave] == :: ++ on-poke diff --git a/pkg/arvo/ted/group/leave-graph.hoon b/pkg/arvo/ted/group/leave-graph.hoon deleted file mode 100644 index ff0b8fb72..000000000 --- a/pkg/arvo/ted/group/leave-graph.hoon +++ /dev/null @@ -1,40 +0,0 @@ -/- spider, grp=group-store, gra=graph-store, met=metadata-store -/+ strandio, res=resource -:: -=* strand strand:spider -=* raw-poke raw-poke:strandio -=* scry scry:strandio -:: -^- thread:spider -|= arg=vase -=/ m (strand ,vase) -^- form:m -=+ !<([=update:grp ~] arg) -?. ?=(%remove-group -.update) - (pure:m !>(~)) -:: -:: get graphs associated with group and archive them -;< =associations:met bind:m - %+ scry associations:met - ;: weld - /gx/metadata-store/group - (en-path:res resource.update) - /noun - == -=/ graphs=(list path) - %+ turn ~(tap in ~(key by associations)) - |= [g=group-path:met m=md-resource:met] - ^- path - app-path.m -;< =bowl:spider bind:m get-bowl:strandio -|- ^- form:m -=* loop $ -?~ graphs - (pure:m !>(~)) -;< ~ bind:m - %+ raw-poke - [our.bowl %graph-store] - :- %graph-update - !> ^- update:gra - [%0 now.bowl [%archive-graph (de-path:res i.graphs)]] -loop(graphs t.graphs) diff --git a/pkg/arvo/ted/group/leave-metadata.hoon b/pkg/arvo/ted/group/leave-metadata.hoon index 5056f4389..bf235b029 100644 --- a/pkg/arvo/ted/group/leave-metadata.hoon +++ b/pkg/arvo/ted/group/leave-metadata.hoon @@ -5,6 +5,37 @@ =* raw-poke raw-poke:strandio =* scry scry:strandio :: +=> +|% +++ remove-metadata + |= entries=(list [g=group-path:met m=md-resource:met]) + ^- form:m + |- ^- form:m + =* loop $ + ?~ entries + (pure:m !>(~)) + ;< ~ bind:m + %+ raw-poke + [our.bowl %metadata-store] + :- %metadata-action + !> ^- metadata-action:met + [%remove g.i.entries m.i.entries] + loop(entries t.entries) +:: +++ archive-graphs + |= graphs=(list path) + |- ^- form:m + =* loop $ + ?~ graphs + (pure:m !>(~)) + ;< ~ bind:m + %+ raw-poke + [our.bowl %graph-store] + :- %graph-update + !> ^- update:gra + [%0 now.bowl [%archive-graph (de-path:res i.graphs)]] + loop(graphs t.graphs) +-- ^- thread:spider |= arg=vase =/ m (strand ,vase) @@ -28,16 +59,11 @@ (en-path:res resource.update) /noun == -=/ entries=(list [g=group-path:met m=md-resource:met]) - ~(tap in ~(key by associations)) -|- ^- form:m -=* loop $ -?~ entries - (pure:m !>(~)) ;< ~ bind:m - %+ raw-poke - [our.bowl %metadata-store] - :- %metadata-action - !> ^- metadata-action:met - [%remove g.i.entries m.i.entries] -loop(entries t.entries) + (remove-metadata ~(tap in ~(key by associations))) +=/ graphs=(list path) + %+ turn ~(tap in ~(key by associations)) + |= [g=group-path:met m=md-resource:met] + ^- path + app-path.m +(archive-graphs graphs) diff --git a/pkg/arvo/ted/group/on-leave.hoon b/pkg/arvo/ted/group/on-leave.hoon new file mode 100644 index 000000000..dfff1b179 --- /dev/null +++ b/pkg/arvo/ted/group/on-leave.hoon @@ -0,0 +1,69 @@ +/- spider, grp=group-store, gra=graph-store, met=metadata-store, hook=metadata-hook +/+ strandio, res=resource +:: +=* strand strand:spider +=* raw-poke raw-poke:strandio +=* scry scry:strandio +:: +=> +|% +++ remove-metadata + |= entries=(list [g=group-path:met m=md-resource:met]) + ^- form:m + |- ^- form:m + =* loop $ + ?~ entries + (pure:m !>(~)) + ;< ~ bind:m + %+ raw-poke + [our.bowl %metadata-store] + :- %metadata-action + !> ^- metadata-action:met + [%remove g.i.entries m.i.entries] + loop(entries t.entries) +:: +++ archive-graphs + |= graphs=(list path) + |- ^- form:m + =* loop $ + ?~ graphs + (pure:m !>(~)) + ;< ~ bind:m + %+ raw-poke + [our.bowl %graph-store] + :- %graph-update + !> ^- update:gra + [%0 now.bowl [%archive-graph (de-path:res i.graphs)]] + loop(graphs t.graphs) +-- +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([=update:grp ~] arg) +?. ?=(%remove-group -.update) + (pure:m !>(~)) +;< =bowl:spider bind:m get-bowl:strandio +;< ~ bind:m + %+ raw-poke + [our.bowl %metadata-hook] + :- %metadata-hook-action + !> ^- metadata-hook-action:hook + [%remove (en-path:res resource.update)] +:: +:: get metadata associated with group and remove it +;< =associations:met bind:m + %+ scry associations:met + ;: weld + /gx/metadata-store/group + (en-path:res resource.update) + /noun + == +;< ~ bind:m + (remove-metadata ~(tap in ~(key by associations))) +=/ graphs=(list path) + %+ turn ~(tap in ~(key by associations)) + |= [g=group-path:met m=md-resource:met] + ^- path + app-path.m +(archive-graphs graphs) From 1b0e19eb515598dfd011060482494c5e45dfdb68 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 16:32:53 -0600 Subject: [PATCH 08/24] observe-hook: state-2 typo --- pkg/arvo/app/observe-hook.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/observe-hook.hoon b/pkg/arvo/app/observe-hook.hoon index da2f3b8ba..9f93de49a 100644 --- a/pkg/arvo/app/observe-hook.hoon +++ b/pkg/arvo/app/observe-hook.hoon @@ -27,7 +27,7 @@ -- :: %- agent:dbug -=| state-2 +=| state-1 =* state - :: ^- agent:gall From 2a47b18be71a0adb8d3d59bc2da0118ed63e3916 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 16:33:48 -0600 Subject: [PATCH 09/24] thread: remove group-leave-metadata --- pkg/arvo/ted/group/leave-metadata.hoon | 69 -------------------------- 1 file changed, 69 deletions(-) delete mode 100644 pkg/arvo/ted/group/leave-metadata.hoon diff --git a/pkg/arvo/ted/group/leave-metadata.hoon b/pkg/arvo/ted/group/leave-metadata.hoon deleted file mode 100644 index bf235b029..000000000 --- a/pkg/arvo/ted/group/leave-metadata.hoon +++ /dev/null @@ -1,69 +0,0 @@ -/- spider, grp=group-store, met=metadata-store, hook=metadata-hook -/+ strandio, res=resource -:: -=* strand strand:spider -=* raw-poke raw-poke:strandio -=* scry scry:strandio -:: -=> -|% -++ remove-metadata - |= entries=(list [g=group-path:met m=md-resource:met]) - ^- form:m - |- ^- form:m - =* loop $ - ?~ entries - (pure:m !>(~)) - ;< ~ bind:m - %+ raw-poke - [our.bowl %metadata-store] - :- %metadata-action - !> ^- metadata-action:met - [%remove g.i.entries m.i.entries] - loop(entries t.entries) -:: -++ archive-graphs - |= graphs=(list path) - |- ^- form:m - =* loop $ - ?~ graphs - (pure:m !>(~)) - ;< ~ bind:m - %+ raw-poke - [our.bowl %graph-store] - :- %graph-update - !> ^- update:gra - [%0 now.bowl [%archive-graph (de-path:res i.graphs)]] - loop(graphs t.graphs) --- -^- thread:spider -|= arg=vase -=/ m (strand ,vase) -^- form:m -=+ !<([=update:grp ~] arg) -?. ?=(%remove-group -.update) - (pure:m !>(~)) -;< =bowl:spider bind:m get-bowl:strandio -;< ~ bind:m - %+ raw-poke - [our.bowl %metadata-hook] - :- %metadata-hook-action - !> ^- metadata-hook-action:hook - [%remove (en-path:res resource.update)] -:: -:: get metadata associated with group and remove it -;< =associations:met bind:m - %+ scry associations:met - ;: weld - /gx/metadata-store/group - (en-path:res resource.update) - /noun - == -;< ~ bind:m - (remove-metadata ~(tap in ~(key by associations))) -=/ graphs=(list path) - %+ turn ~(tap in ~(key by associations)) - |= [g=group-path:met m=md-resource:met] - ^- path - app-path.m -(archive-graphs graphs) From 46fd3004bf74fead4d262a3f0b184487e37af793 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 30 Nov 2020 16:59:30 -0600 Subject: [PATCH 10/24] %group-on-leave thread: simplified and got it to compile --- pkg/arvo/ted/group/on-leave.hoon | 64 +++++++++++++------------------- 1 file changed, 25 insertions(+), 39 deletions(-) diff --git a/pkg/arvo/ted/group/on-leave.hoon b/pkg/arvo/ted/group/on-leave.hoon index dfff1b179..33088c8c8 100644 --- a/pkg/arvo/ted/group/on-leave.hoon +++ b/pkg/arvo/ted/group/on-leave.hoon @@ -5,37 +5,6 @@ =* raw-poke raw-poke:strandio =* scry scry:strandio :: -=> -|% -++ remove-metadata - |= entries=(list [g=group-path:met m=md-resource:met]) - ^- form:m - |- ^- form:m - =* loop $ - ?~ entries - (pure:m !>(~)) - ;< ~ bind:m - %+ raw-poke - [our.bowl %metadata-store] - :- %metadata-action - !> ^- metadata-action:met - [%remove g.i.entries m.i.entries] - loop(entries t.entries) -:: -++ archive-graphs - |= graphs=(list path) - |- ^- form:m - =* loop $ - ?~ graphs - (pure:m !>(~)) - ;< ~ bind:m - %+ raw-poke - [our.bowl %graph-store] - :- %graph-update - !> ^- update:gra - [%0 now.bowl [%archive-graph (de-path:res i.graphs)]] - loop(graphs t.graphs) --- ^- thread:spider |= arg=vase =/ m (strand ,vase) @@ -44,6 +13,8 @@ ?. ?=(%remove-group -.update) (pure:m !>(~)) ;< =bowl:spider bind:m get-bowl:strandio +:: stop serving or syncing metadata associated with group +:: ;< ~ bind:m %+ raw-poke [our.bowl %metadata-hook] @@ -51,7 +22,7 @@ !> ^- metadata-hook-action:hook [%remove (en-path:res resource.update)] :: -:: get metadata associated with group and remove it +:: get metadata associated with group ;< =associations:met bind:m %+ scry associations:met ;: weld @@ -59,11 +30,26 @@ (en-path:res resource.update) /noun == +=/ entries=(list [g=group-path:met m=md-resource:met]) + ~(tap in ~(key by associations)) +|- ^- form:m +=* loop $ +?~ entries + (pure:m !>(~)) +:: remove metadata associated with group +:: ;< ~ bind:m - (remove-metadata ~(tap in ~(key by associations))) -=/ graphs=(list path) - %+ turn ~(tap in ~(key by associations)) - |= [g=group-path:met m=md-resource:met] - ^- path - app-path.m -(archive-graphs graphs) + %+ raw-poke + [our.bowl %metadata-store] + :- %metadata-action + !> ^- metadata-action:met + [%remove g.i.entries m.i.entries] +:: archive graph associated with group +:: +;< ~ bind:m + %+ raw-poke + [our.bowl %graph-store] + :- %graph-update + !> ^- update:gra + [%0 now.bowl [%archive-graph (de-path:res app-path.m.i.entries)]] +loop(entries t.entries) From 9e69cba237445a76c20375e1c7846958540cc607 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Tue, 1 Dec 2020 12:51:26 -0600 Subject: [PATCH 11/24] group-on-leave: poke %graph-pull-hook to allow resubscription --- pkg/arvo/ted/group/on-leave.hoon | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/arvo/ted/group/on-leave.hoon b/pkg/arvo/ted/group/on-leave.hoon index 33088c8c8..1fdc8ce0c 100644 --- a/pkg/arvo/ted/group/on-leave.hoon +++ b/pkg/arvo/ted/group/on-leave.hoon @@ -52,4 +52,9 @@ :- %graph-update !> ^- update:gra [%0 now.bowl [%archive-graph (de-path:res app-path.m.i.entries)]] +;< ~ bind:m + %+ raw-poke + [our.bowl %graph-pull-hook] + :- %pull-hook-action + !>([%remove (de-path:res app-path.m.i.entries)]) loop(entries t.entries) From 2760f79f6604a92722a31a44a495f251eb54fe1c Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Tue, 1 Dec 2020 15:20:45 -0600 Subject: [PATCH 12/24] group-on-leave thread: clean up contacts as well as everything else --- pkg/arvo/app/contact-view.hoon | 16 +------ pkg/arvo/lib/group-store.hoon | 1 + pkg/arvo/ted/group/on-leave.hoon | 42 +++++++++++++++++-- pkg/interface/src/logic/api/contacts.ts | 4 -- pkg/interface/src/logic/api/groups.ts | 7 +++- .../components/GroupSettings/Personal.tsx | 3 +- 6 files changed, 48 insertions(+), 25 deletions(-) diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index 198d4362c..4350e9d43 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -181,21 +181,7 @@ ~[(add-pending rid ship.act)] :: %delete - =/ rid=resource - (de-path:resource path.act) - =/ group-pokes=(list card) - ?: =(our.bol entity.rid) - ~[(group-push-poke %remove rid)] - :~ (group-proxy-poke %remove-members rid (sy our.bol ~)) - (group-pull-poke %remove rid) - == - ;: weld - group-pokes - :~ (contact-hook-poke [%remove path.act]) - (group-poke [%remove-group rid ~]) - (contact-poke [%delete path.act]) - == - == + ~ :: %remove =/ rid=resource diff --git a/pkg/arvo/lib/group-store.hoon b/pkg/arvo/lib/group-store.hoon index 56e663301..e2a14576b 100644 --- a/pkg/arvo/lib/group-store.hoon +++ b/pkg/arvo/lib/group-store.hoon @@ -417,6 +417,7 @@ :: ++ remove-group |= =json + ^- [resource ~] ?> ?=(%o -.json) =/ rid=resource (dejs:resource (~(got by p.json) 'resource')) diff --git a/pkg/arvo/ted/group/on-leave.hoon b/pkg/arvo/ted/group/on-leave.hoon index 1fdc8ce0c..aa3fcad4e 100644 --- a/pkg/arvo/ted/group/on-leave.hoon +++ b/pkg/arvo/ted/group/on-leave.hoon @@ -1,4 +1,4 @@ -/- spider, grp=group-store, gra=graph-store, met=metadata-store, hook=metadata-hook +/- spider, grp=group-store, gra=graph-store, met=metadata-store, con=contact-store /+ strandio, res=resource :: =* strand strand:spider @@ -13,16 +13,50 @@ ?. ?=(%remove-group -.update) (pure:m !>(~)) ;< =bowl:spider bind:m get-bowl:strandio +:: tell group host to remove us as member +:: +;< ~ bind:m + %+ raw-poke + [entity.resource.update %group-push-hook] + :- %group-update + !> ^- update:grp + [%remove-members resource.update (silt [our.bowl ~])] +:: stop serving or syncing group updates +:: +;< ~ bind:m + %+ raw-poke + [our.bowl %group-push-hook] + :- %push-hook-action + !>([%remove resource.update]) +;< ~ bind:m + %+ raw-poke + [our.bowl %group-pull-hook] + :- %pull-hook-action + !>([%remove resource.update]) +:: stop serving or syncing contacts associated with group +:: +;< ~ bind:m + %+ raw-poke + [our.bowl %contact-hook] + :- %contact-hook-action + !>([%remove (en-path:res resource.update)]) +:: remove contact data associated with group +:: +;< ~ bind:m + %+ raw-poke + [our.bowl %contact-store] + :- %contact-action + !> ^- contact-action:con + [%delete (en-path:res resource.update)] :: stop serving or syncing metadata associated with group :: ;< ~ bind:m %+ raw-poke [our.bowl %metadata-hook] :- %metadata-hook-action - !> ^- metadata-hook-action:hook - [%remove (en-path:res resource.update)] -:: + !>([%remove (en-path:res resource.update)]) :: get metadata associated with group +:: ;< =associations:met bind:m %+ scry associations:met ;: weld diff --git a/pkg/interface/src/logic/api/contacts.ts b/pkg/interface/src/logic/api/contacts.ts index 27f8faf25..3049442f5 100644 --- a/pkg/interface/src/logic/api/contacts.ts +++ b/pkg/interface/src/logic/api/contacts.ts @@ -32,10 +32,6 @@ export default class ContactsApi extends BaseApi { }); } - delete(path: Path) { - return this.viewAction({ delete: { path } }); - } - remove(path: Path, ship: Patp) { return this.viewAction({ remove: { path, ship } }); } diff --git a/pkg/interface/src/logic/api/groups.ts b/pkg/interface/src/logic/api/groups.ts index cdd1514ec..3901149fd 100644 --- a/pkg/interface/src/logic/api/groups.ts +++ b/pkg/interface/src/logic/api/groups.ts @@ -26,6 +26,10 @@ export default class GroupsApi extends BaseApi { return this.proxyAction({ addMembers: { resource, ships } }); } + removeGroup(resource: Resource) { + return this.storeAction({ removeGroup: { resource } }); + } + changePolicy(resource: Resource, diff: Enc) { return this.proxyAction({ changePolicy: { resource, diff } }); } @@ -35,6 +39,7 @@ export default class GroupsApi extends BaseApi { } private storeAction(action: GroupAction) { - return this.action('group-store', 'group-action', action); + console.log(action); + return this.action('group-store', 'group-update', action); } } diff --git a/pkg/interface/src/views/landscape/components/GroupSettings/Personal.tsx b/pkg/interface/src/views/landscape/components/GroupSettings/Personal.tsx index 9b036ec45..c5abd75bd 100644 --- a/pkg/interface/src/views/landscape/components/GroupSettings/Personal.tsx +++ b/pkg/interface/src/views/landscape/components/GroupSettings/Personal.tsx @@ -35,7 +35,8 @@ function DeleteGroup(props: { const onDelete = async () => { const name = props.association['group-path'].split('/').pop(); if (prompt(`To confirm deleting this group, type ${name}`) === name) { - await props.api.contacts.delete(props.association["group-path"]); + const resource = resourceFromPath(props.association["group-path"]) + await props.api.groups.removeGroup(resource); history.push("/"); } }; From f5137a51142b9371c1090d9f1abfcd44bd529c62 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Mon, 30 Nov 2020 13:04:54 -0800 Subject: [PATCH 13/24] userspace: data migration testing utilities --- pkg/arvo/gen/aqua-export.hoon | 45 +++++++ pkg/arvo/lib/ph/io.hoon | 16 +++ pkg/arvo/lib/strandio.hoon | 6 +- pkg/arvo/mar/contact/view-action.hoon | 12 ++ pkg/arvo/mar/import.hoon | 15 +++ pkg/arvo/mar/metadata/hook-action.hoon | 12 ++ pkg/arvo/ted/ph/migrate/breach.hoon | 22 ++++ pkg/arvo/ted/ph/migrate/commit-home.hoon | 61 ++++++++++ pkg/arvo/ted/ph/migrate/import.hoon | 22 ++++ pkg/arvo/ted/ph/migrate/init.hoon | 24 ++++ pkg/arvo/ted/ph/migrate/make-chats.hoon | 96 +++++++++++++++ pkg/arvo/ted/ph/migrate/make-graphs.hoon | 112 ++++++++++++++++++ pkg/arvo/ted/ph/migrate/make-groups.hoon | 46 +++++++ pkg/arvo/ted/ph/migrate/post-import-chat.hoon | 36 ++++++ .../ted/ph/migrate/post-import-graphs.hoon | 56 +++++++++ .../ted/ph/migrate/post-import-groups.hoon | 24 ++++ .../post-import-metadata-contacts.hoon | 61 ++++++++++ pkg/arvo/ted/ph/migrate/send-his.hoon | 18 +++ pkg/arvo/ted/ph/migrate/start.hoon | 73 ++++++++++++ pkg/arvo/ted/ph/start-drivers.hoon | 2 +- 20 files changed, 757 insertions(+), 2 deletions(-) create mode 100644 pkg/arvo/gen/aqua-export.hoon create mode 100644 pkg/arvo/mar/contact/view-action.hoon create mode 100644 pkg/arvo/mar/import.hoon create mode 100644 pkg/arvo/mar/metadata/hook-action.hoon create mode 100644 pkg/arvo/ted/ph/migrate/breach.hoon create mode 100644 pkg/arvo/ted/ph/migrate/commit-home.hoon create mode 100644 pkg/arvo/ted/ph/migrate/import.hoon create mode 100644 pkg/arvo/ted/ph/migrate/init.hoon create mode 100644 pkg/arvo/ted/ph/migrate/make-chats.hoon create mode 100644 pkg/arvo/ted/ph/migrate/make-graphs.hoon create mode 100644 pkg/arvo/ted/ph/migrate/make-groups.hoon create mode 100644 pkg/arvo/ted/ph/migrate/post-import-chat.hoon create mode 100644 pkg/arvo/ted/ph/migrate/post-import-graphs.hoon create mode 100644 pkg/arvo/ted/ph/migrate/post-import-groups.hoon create mode 100644 pkg/arvo/ted/ph/migrate/post-import-metadata-contacts.hoon create mode 100644 pkg/arvo/ted/ph/migrate/send-his.hoon create mode 100644 pkg/arvo/ted/ph/migrate/start.hoon diff --git a/pkg/arvo/gen/aqua-export.hoon b/pkg/arvo/gen/aqua-export.hoon new file mode 100644 index 000000000..046d85d24 --- /dev/null +++ b/pkg/arvo/gen/aqua-export.hoon @@ -0,0 +1,45 @@ +/+ *ph-util +:- %say +|= $: [now=@da eny=@uv bec=beak] + [who=@p ~] + ~ + == +|^ +:- %noun +(export-all who) +:: +++ export-app + |= [who=ship agent=term] + =/ aqua-pax=path + :~ %i + (scot %p who) + %gx + (scot %p who) + agent + (scot %da now) + %export + %noun + %noun + == + ~| agent + %- need + (scry-aqua (unit *) p.bec now aqua-pax) +:: +++ export-all + |= who=ship + %+ turn + ^- (list @tas) + :~ %group-store + %metadata-store + %metadata-hook + %contact-store + %contact-hook + %invite-store + %chat-store + %chat-hook + %graph-store + == + |= app=@tas + [app (export-app who app)] +:: +-- diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index 4433670ca..d0327ab2e 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -341,4 +341,20 @@ ?: =(warped (need (scry-aqua:util (unit @) our now aqua-pax))) (pure:m ~) loop +:: +:: Turns poke into a dojo command +:: +++ poke-app + |= [=ship app=term =mark data=*] + =/ m (strand ,~) + ^- form:m + =/ command=tape ":{(trip app)} &{(trip mark)} {}" + (send-events (dojo:util ship command)) +:: +++ dojo-thread + |= [=ship ted=term =mark data=*] + =/ m (strand ,~) + ^- form:m + =/ command=tape "-{(trip ted)} &{(trip mark)} {}" + (send-events (dojo:util ship command)) -- diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 58bc830b7..7fa9da0fa 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -670,12 +670,16 @@ :: ++ start-thread |= file=term + (start-thread-with-args file *vase) +:: +++ start-thread-with-args + |= [file=term args=vase] =/ m (strand ,tid:spider) ^- form:m ;< =bowl:spider bind:m get-bowl =/ tid (scot %ta (cat 3 (cat 3 'strand_' file) (scot %uv (sham file eny.bowl)))) - =/ poke-vase !>([`tid.bowl `tid file *vase]) + =/ poke-vase !>([`tid.bowl `tid file args]) ;< ~ bind:m (poke-our %spider %spider-start poke-vase) ;< ~ bind:m (sleep ~s0) :: wait for thread to start (pure:m tid) diff --git a/pkg/arvo/mar/contact/view-action.hoon b/pkg/arvo/mar/contact/view-action.hoon new file mode 100644 index 000000000..bd386555d --- /dev/null +++ b/pkg/arvo/mar/contact/view-action.hoon @@ -0,0 +1,12 @@ +/- *contact-view +|_ act=contact-view-action +++ grad %noun +++ grow + |% + ++ noun act + -- +++ grab + |% + ++ noun contact-view-action + -- +-- diff --git a/pkg/arvo/mar/import.hoon b/pkg/arvo/mar/import.hoon new file mode 100644 index 000000000..53ee978c2 --- /dev/null +++ b/pkg/arvo/mar/import.hoon @@ -0,0 +1,15 @@ +=, mimes:html +|_ non=* +++ grab + |% + ++ noun * + ++ mime + |= [* p=octs] + (cue q.p) + -- +++ grow + |% + ++ mime [/application/x-urb-import (as-octs (jam non))] + -- +++ grad %mime +-- diff --git a/pkg/arvo/mar/metadata/hook-action.hoon b/pkg/arvo/mar/metadata/hook-action.hoon new file mode 100644 index 000000000..690355524 --- /dev/null +++ b/pkg/arvo/mar/metadata/hook-action.hoon @@ -0,0 +1,12 @@ +/- *metadata-hook +|_ act=metadata-hook-action +++ grad %noun +++ grow + |% + ++ noun act + -- +++ grab + |% + ++ noun metadata-hook-action + -- +-- diff --git a/pkg/arvo/ted/ph/migrate/breach.hoon b/pkg/arvo/ted/ph/migrate/breach.hoon new file mode 100644 index 000000000..4678690cc --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/breach.hoon @@ -0,0 +1,22 @@ +/- spider +/+ *ph-io +=, strand=strand:spider +^- thread:spider +|= arg=vase +=+ !<(who=(list @p) arg) +=/ m (strand ,vase) +;< ~ bind:m start-simple +=? who ?=(~ who) ~[~zod ~bus ~web] +|- +=* loop $ +?~ who +:: ;< ~ bind:m (send-hi ~zod ~bus) +:: ;< ~ bind:m (send-hi ~zod ~web) +:: ;< ~ bind:m (send-hi ~bus ~zod) +:: ;< ~ bind:m (send-hi ~bus ~web) +:: ;< ~ bind:m (send-hi ~web ~zod) +:: ;< ~ bind:m (send-hi ~web ~bus) + (pure:m *vase) +;< ~ bind:m (breach-aqua i.who) +;< ~ bind:m (init-ship i.who) +loop(who t.who) diff --git a/pkg/arvo/ted/ph/migrate/commit-home.hoon b/pkg/arvo/ted/ph/migrate/commit-home.hoon new file mode 100644 index 000000000..8f168f3ab --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/commit-home.hoon @@ -0,0 +1,61 @@ +:: +:: warning: using this thread will clobber aqua's currently active piers +:: +/- spider, *aquarium +/+ *ph-io +=, strand=strand:spider +=> +|% +++ commit + |= [our=@p now=@da ships=(list @p)] + ^- (list aqua-event) + %+ turn ships + |= her=@p + :+ %event her + =/ paths .^((list path) %ct /(scot %p our)/home/(scot %da now)) + =/ mod=mode:clay + %+ murn paths + |= pat=path + ^- (unit [path (unit mime)]) + ?. =((snag (dec (lent pat)) pat) %hoon) + ~ + =/ clay-pax=path (weld /(scot %p our)/home/(scot %da now) pat) + =/ file [/text/plain (as-octs:mimes:html .^(@ %cx clay-pax))] + `[pat `file] + :- //sync/0v1n.2m9vh + [%into %home | mod] +:: +++ restore-fleet + |= label=term + ^- (list aqua-event) + [%restore-snap label]~ +:: +++ snap-fleet + |= [label=term ships=(list @p)] + ^- (list aqua-event) + [%snap-ships label ships]~ +-- +^- thread:spider +|= arg=vase +=+ !<(fleets=(list term) arg) +=/ m (strand ,vase) +;< ~ bind:m start-simple +=/ ships=(list @p) ~[~zod ~bus ~web] +;< =bowl:spider bind:m get-bowl +=/ commit-events (commit our.bowl now.bowl ships) +|- +=* fleet-loop $ +?~ fleets + (pure:m *vase) +:: +;< ~ bind:m (send-events (restore-fleet i.fleets)) +;< ~ bind:m (sleep ~s0) +;< ~ bind:m (send-events commit-events) +;< ~ bind:m (sleep ~s0) +;< =bowl:spider bind:m get-bowl +=/ full-ships + .^((list @p) %gx /(scot %p our.bowl)/aqua/(scot %da now.bowl)/ships/noun) +;< ~ bind:m (send-events (snap-fleet i.fleets full-ships)) +;< ~ bind:m (sleep ~s0) +:: +fleet-loop(fleets t.fleets) diff --git a/pkg/arvo/ted/ph/migrate/import.hoon b/pkg/arvo/ted/ph/migrate/import.hoon new file mode 100644 index 000000000..57d054c4c --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/import.hoon @@ -0,0 +1,22 @@ +/- spider +/+ *ph-io +=, strand=strand:spider +=> +|% +++ import-all + |= [who=@p by-app=(list [@tas *])] + =/ m (strand:spider ,~) + ^- form:m + =* loop $ + ?~ by-app (pure:m ~) + =/ [app=@tas data=*] i.by-app + ;< ~ bind:m (poke-app who app %import data) + loop(by-app t.by-app) +-- +^- thread:spider +|= arg=vase +=+ !<([who=@p by-app=(list [@tas *]) ~] arg) +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< ~ bind:m (import-all who by-app) +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/init.hoon b/pkg/arvo/ted/ph/migrate/init.hoon new file mode 100644 index 000000000..3433e80ab --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/init.hoon @@ -0,0 +1,24 @@ +/- spider +/+ *ph-io +=, strand=strand:spider +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< ~ bind:m init-azimuth +;< ~ bind:m (spawn-aqua ~zod) +;< ~ bind:m (spawn-aqua ~bus) +;< ~ bind:m (spawn-aqua ~web) +:: +;< ~ bind:m (init-ship ~zod) +;< ~ bind:m (init-ship ~bus) +;< ~ bind:m (init-ship ~web) +:: +;< ~ bind:m (send-hi ~zod ~web) +;< ~ bind:m (send-hi ~zod ~bus) +;< ~ bind:m (send-hi ~web ~zod) +;< ~ bind:m (send-hi ~bus ~zod) +;< ~ bind:m (send-hi ~bus ~web) +;< ~ bind:m (send-hi ~web ~bus) +:: +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/make-chats.hoon b/pkg/arvo/ted/ph/migrate/make-chats.hoon new file mode 100644 index 000000000..43b9b572e --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/make-chats.hoon @@ -0,0 +1,96 @@ +/- spider, + chat-view, + *resource, + chat-store +/+ *ph-io, strandio +=, strand=strand:spider +=> +|% +++ chat-message + |= [our=@p =path wen=@da mes=cord] + =/ act=action:chat-store + :* %message path `@uvH`(sham [our path mes]) + 0 our wen [%text mes] + == + (poke-app our %chat-hook %chat-action act) +-- +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +:: chat setup +:: - ~zod creates a chat associated with group-1 +:: - ~bus creates a chat associated with group-1 +:: - ~web creates a dm with ~zod +:: +=/ chat-1=action:chat-view + :* %create + 'Chat 1' '' + /~zod/chat-1 + /ship/~zod/group-1 + [%invite ~] + ~ + %.y + %.n + == +=/ chat-2=action:chat-view + :* %create + 'Chat 2' '' + /~bus/chat-2 + /ship/~zod/group-1 + [%invite ~] + ~ + %.y + %.n + == +=/ web-zod-dm=action:chat-view + :* %create + '~web <-> ~zod' '' + /~web/dm--zod + /ship/~web/dm--zod + [%invite (sy ~zod ~)] + (sy ~zod ~) + %.y + %.n + == +=/ join-1 [%join ~zod /~zod/chat-1 %.y] +=/ join-2 [%join ~bus /~bus/chat-2 %.y] +=/ join-3 [%join ~web /~web/dm--zod %.y] +;< ~ bind:m (poke-app ~zod %chat-view %chat-view-action chat-1) +;< ~ bind:m (wait-for-output ~zod ">=") +;< ~ bind:m (poke-app ~bus %chat-view %chat-view-action chat-2) +;< ~ bind:m (wait-for-output ~bus ">=") +;< ~ bind:m (poke-app ~web %chat-view %chat-view-action web-zod-dm) +;< ~ bind:m (wait-for-output ~web ">=") +;< ~ bind:m (sleep ~s20) +:: +;< ~ bind:m (poke-app ~bus %chat-view %chat-view-action join-1) +;< ~ bind:m (wait-for-output ~bus ">=") +;< ~ bind:m (poke-app ~web %chat-view %chat-view-action join-1) +;< ~ bind:m (wait-for-output ~web ">=") +:: +;< ~ bind:m (poke-app ~zod %chat-view %chat-view-action join-2) +;< ~ bind:m (wait-for-output ~zod ">=") +;< ~ bind:m (poke-app ~web %chat-view %chat-view-action join-2) +;< ~ bind:m (wait-for-output ~web ">=") +:: +;< ~ bind:m (poke-app ~zod %chat-view %chat-view-action join-3) +;< ~ bind:m (wait-for-output ~zod ">=") +;< ~ bind:m (sleep ~s20) +:: +;< ~ bind:m (chat-message ~zod /~zod/chat-1 now.bol 'message 1') +;< ~ bind:m (chat-message ~bus /~zod/chat-1 now.bol 'message 2') +;< ~ bind:m (chat-message ~web /~bus/chat-2 now.bol 'message 3') +;< ~ bind:m (chat-message ~zod /~web/dm--zod now.bol 'message 4') +:: +;< ~ bind:m (send-hi ~zod ~bus) +;< ~ bind:m (send-hi ~zod ~web) +;< ~ bind:m (send-hi ~bus ~zod) +;< ~ bind:m (send-hi ~bus ~web) +;< ~ bind:m (send-hi ~web ~zod) +;< ~ bind:m (send-hi ~web ~bus) +:: +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/make-graphs.hoon b/pkg/arvo/ted/ph/migrate/make-graphs.hoon new file mode 100644 index 000000000..0bbfe6dbf --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/make-graphs.hoon @@ -0,0 +1,112 @@ +/- spider, + graph-store, + graph-view, + post, + *resource +/+ *ph-io, strandio +=, strand=strand:spider +=> +|% +:: +++ graph-post + |= [our=@p wen=@da rid=resource body=cord id=@] + =/ =index:post [id]~ + =/ =post:post [our index wen [%text body]~ ~ ~] + =/ =node:graph-store [post %empty ~] + =/ act=update:graph-store [%0 wen %add-nodes rid (my [index node] ~)] + (poke-app our %graph-push-hook %graph-update act) +-- +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +:: create graphs +:: +=/ group-rid [~zod %group-1] +=/ group-path /ship/~zod/group-1 +=/ create-1=action:graph-view + :* %create + [~zod %graph-1] + 'graph 1' + 'desc 1' + ~ + [%group group-rid] + 'fake' + == +:: +=/ create-2=action:graph-view + :* %create + [~bus %graph-2] + 'graph 2' + 'desc 2' + ~ + [%group group-rid] + 'fake' + == +:: +=/ create-3=action:graph-view + :* %create + [~web %graph-3] + 'graph 3' + 'desc 3' + ~ + [%policy %invite (sy ~zod ~bus ~)] + 'fake' + == +:: +;< ~ bind:m (dojo-thread ~zod %graph-create %graph-view-action create-1) +;< ~ bind:m (dojo-thread ~bus %graph-create %graph-view-action create-2) +;< ~ bind:m (dojo-thread ~web %graph-create %graph-view-action create-3) +;< ~ bind:m (sleep ~s30) +:: +:: join graphs +:: +=/ join-1=action:graph-view + [%join [~zod %graph-1] ~zod] +=/ join-2=action:graph-view + [%join [~bus %graph-2] ~bus] +=/ join-3=action:graph-view + [%join [~web %graph-3] ~web] +:: +;< ~ bind:m (dojo-thread ~zod %graph-join %graph-view-action join-2) +;< ~ bind:m (dojo-thread ~zod %graph-join %graph-view-action join-3) +;< ~ bind:m (dojo-thread ~bus %graph-join %graph-view-action join-1) +;< ~ bind:m (dojo-thread ~bus %graph-join %graph-view-action join-3) +;< ~ bind:m (dojo-thread ~web %graph-join %graph-view-action join-1) +;< ~ bind:m (dojo-thread ~web %graph-join %graph-view-action join-2) +;< ~ bind:m (sleep ~s30) +:: +:: make posts +:: +;< ~ bind:m (graph-post ~zod now.bol [~zod %graph-1] 'post 1' 1) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~bus now.bol [~zod %graph-1] 'post 2' 2) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~web now.bol [~zod %graph-1] 'post 3' 3) +;< ~ bind:m (sleep ~s5) +:: +;< ~ bind:m (graph-post ~zod now.bol [~bus %graph-2] 'post 4' 4) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~bus now.bol [~bus %graph-2] 'post 5' 5) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~web now.bol [~bus %graph-2] 'post 6' 6) +;< ~ bind:m (sleep ~s5) +:: +;< ~ bind:m (graph-post ~zod now.bol [~web %graph-3] 'post 7' 7) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~bus now.bol [~web %graph-3] 'post 8' 8) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~web now.bol [~web %graph-3] 'post 9' 9) +;< ~ bind:m (sleep ~s5) +:: +;< ~ bind:m (send-hi ~zod ~bus) +;< ~ bind:m (send-hi ~zod ~web) +;< ~ bind:m (send-hi ~bus ~zod) +;< ~ bind:m (send-hi ~bus ~web) +;< ~ bind:m (send-hi ~web ~zod) +;< ~ bind:m (send-hi ~web ~bus) +:: +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/make-groups.hoon b/pkg/arvo/ted/ph/migrate/make-groups.hoon new file mode 100644 index 000000000..62a09dffa --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/make-groups.hoon @@ -0,0 +1,46 @@ +/- spider, + contact-view, + *resource +/+ *ph-io, strandio +=, strand=strand:spider +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +:: group setup +:: - ~zod creates an open group +:: - ~zod creates and invite-only group, and invites ~bus and ~web +:: - ~bus and ~web join the first, but not the second group, to keep +:: invite-store populated +:: +=/ group-1=contact-view-action:contact-view + :* %create + %group-1 + [%open ~ ~] + 'Group 1' + 'this is group 1' + == +=/ group-2=contact-view-action:contact-view + :* %create + %group-2 + [%invite (sy ~bus ~web ~)] + 'Group 2' + 'this is group 2' + == +=/ join=contact-view-action:contact-view [%join ~zod %group-1] +;< ~ bind:m (poke-app ~zod %contact-view %contact-view-action group-1) +;< ~ bind:m (wait-for-output ~zod ">=") +;< ~ bind:m (poke-app ~zod %contact-view %contact-view-action group-2) +;< ~ bind:m (wait-for-output ~zod ">=") +;< ~ bind:m (sleep ~s10) +;< ~ bind:m (poke-app ~bus %contact-view %contact-view-action join) +;< ~ bind:m (wait-for-output ~bus ">=") +;< ~ bind:m (poke-app ~web %contact-view %contact-view-action join) +;< ~ bind:m (wait-for-output ~web ">=") +;< ~ bind:m (send-hi ~bus ~zod) +;< ~ bind:m (send-hi ~web ~zod) +;< ~ bind:m (sleep ~s2) +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/post-import-chat.hoon b/pkg/arvo/ted/ph/migrate/post-import-chat.hoon new file mode 100644 index 000000000..b25da4f7c --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/post-import-chat.hoon @@ -0,0 +1,36 @@ +/- spider, + chat-view, + *resource, + chat-store +/+ *ph-io, strandio +=, strand=strand:spider +=> +|% +++ chat-message + |= [our=@p =path wen=@da mes=cord] + =/ act=action:chat-store + :* %message path `@uvH`(sham [our path mes]) + 0 our wen [%text mes] + == + (poke-app our %chat-hook %chat-action act) +-- +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +;< ~ bind:m (chat-message ~zod /~zod/chat-1 now.bol 'message 5') +;< ~ bind:m (chat-message ~bus /~zod/chat-1 now.bol 'message 6') +;< ~ bind:m (chat-message ~web /~bus/chat-2 now.bol 'message 7') +;< ~ bind:m (chat-message ~zod /~web/dm--zod now.bol 'message 8') +:: +;< ~ bind:m (send-hi ~zod ~bus) +;< ~ bind:m (send-hi ~zod ~web) +;< ~ bind:m (send-hi ~bus ~zod) +;< ~ bind:m (send-hi ~bus ~web) +;< ~ bind:m (send-hi ~web ~zod) +;< ~ bind:m (send-hi ~web ~bus) +:: +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/post-import-graphs.hoon b/pkg/arvo/ted/ph/migrate/post-import-graphs.hoon new file mode 100644 index 000000000..eed757263 --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/post-import-graphs.hoon @@ -0,0 +1,56 @@ +/- spider, + graph-store, + graph-view, + post, + *resource +/+ *ph-io, strandio +=, strand=strand:spider +=> +|% +:: +++ graph-post + |= [our=@p wen=@da rid=resource body=cord id=@] + =/ =index:post [id]~ + =/ =post:post [our index wen [%text body]~ ~ ~] + =/ =node:graph-store [post %empty ~] + =/ act=update:graph-store [%0 wen %add-nodes rid (my [index node] ~)] + (poke-app our %graph-push-hook %graph-update act) +-- +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +:: make posts +:: +;< ~ bind:m (graph-post ~zod now.bol [~zod %graph-1] 'post 10' 10) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~bus now.bol [~zod %graph-1] 'post 20' 20) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~web now.bol [~zod %graph-1] 'post 30' 30) +;< ~ bind:m (sleep ~s5) +:: +;< ~ bind:m (graph-post ~zod now.bol [~bus %graph-2] 'post 40' 40) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~bus now.bol [~bus %graph-2] 'post 50' 50) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~web now.bol [~bus %graph-2] 'post 60' 60) +;< ~ bind:m (sleep ~s5) +:: +;< ~ bind:m (graph-post ~zod now.bol [~web %graph-3] 'post 70' 70) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~bus now.bol [~web %graph-3] 'post 80' 80) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (graph-post ~web now.bol [~web %graph-3] 'post 90' 90) +;< ~ bind:m (sleep ~s5) +:: +;< ~ bind:m (send-hi ~zod ~bus) +;< ~ bind:m (send-hi ~zod ~web) +;< ~ bind:m (send-hi ~bus ~zod) +;< ~ bind:m (send-hi ~bus ~web) +;< ~ bind:m (send-hi ~web ~zod) +;< ~ bind:m (send-hi ~web ~bus) +:: +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/post-import-groups.hoon b/pkg/arvo/ted/ph/migrate/post-import-groups.hoon new file mode 100644 index 000000000..8681c1452 --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/post-import-groups.hoon @@ -0,0 +1,24 @@ +/- spider, + contact-view, + *resource, + group-store +/+ *ph-io, strandio +=, strand=strand:spider +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +=/ join-2=contact-view-action:contact-view [%join ~zod %group-2] +=/ add-members-1=action:group-store + [%add-members [~zod %group-1] (sy ~def ~ten ~)] +=/ add-members-2=action:group-store + [%add-members [~zod %group-2] (sy ~def ~ten ~)] +;< ~ bind:m (poke-app ~bus %contact-view %contact-view-action join-2) +;< ~ bind:m (poke-app ~web %contact-view %contact-view-action join-2) +;< ~ bind:m (poke-app ~zod %group-store %group-action add-members-1) +;< ~ bind:m (poke-app ~zod %group-store %group-action add-members-2) +:: +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/post-import-metadata-contacts.hoon b/pkg/arvo/ted/ph/migrate/post-import-metadata-contacts.hoon new file mode 100644 index 000000000..81a982593 --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/post-import-metadata-contacts.hoon @@ -0,0 +1,61 @@ +/- spider, + contact-view, + contact-store, + group-store, + metadata-store, + post, + graph-store, + *resource +/+ *ph-io, strandio +=, strand=strand:spider +:: +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +:: test metadata import +:: +=/ change-group-1=metadata-action:metadata-store + :* %add + /ship/~zod/group-1 + [%contacts /ship/~zod/group-1] + 'New Group 1 Title' + 'new description' + 0x0 + now.bol + ~zod + 'fake' + == +=/ change-web-book=metadata-action:metadata-store + :* %add + /ship/~web/graph-3 + [%graph /ship/~web/graph-3] + 'New Graph 3 Title' + 'new description' + 0x0 + now.bol + ~web + 'fake' + == +;< ~ bind:m (poke-app ~zod %metadata-hook %metadata-action change-group-1) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (poke-app ~web %metadata-hook %metadata-action change-web-book) +;< ~ bind:m (sleep ~s5) +:: +:: test contacts import +:: +=/ add-zod=contact-action:contact-store + :* %add /ship/~zod/group-1 ~zod + 'ZOD' '' '' '' '' 0x0 ~ + == +=/ add-bus=contact-action:contact-store + :* %add /ship/~zod/group-2 ~bus + 'BUS' '' '' '' '' 0x0 ~ + == +;< ~ bind:m (poke-app ~zod %contact-hook %contact-action add-zod) +;< ~ bind:m (sleep ~s5) +;< ~ bind:m (poke-app ~bus %contact-hook %contact-action add-bus) +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/send-his.hoon b/pkg/arvo/ted/ph/migrate/send-his.hoon new file mode 100644 index 000000000..bb7a58909 --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/send-his.hoon @@ -0,0 +1,18 @@ +/- spider +/+ *ph-io, strandio +=, strand=strand:spider +:: +^- thread:spider +|= vase +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< bol=bowl:spider bind:m get-bowl:strandio +:: +;< ~ bind:m (send-hi ~zod ~bus) +;< ~ bind:m (send-hi ~zod ~web) +;< ~ bind:m (send-hi ~bus ~zod) +;< ~ bind:m (send-hi ~bus ~web) +;< ~ bind:m (send-hi ~web ~zod) +;< ~ bind:m (send-hi ~web ~bus) +:: +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/migrate/start.hoon b/pkg/arvo/ted/ph/migrate/start.hoon new file mode 100644 index 000000000..6eede6042 --- /dev/null +++ b/pkg/arvo/ted/ph/migrate/start.hoon @@ -0,0 +1,73 @@ +/- spider +/+ *ph-io +=, strand=strand:spider +=> +|% +++ start-agent + |= [=ship agent=term] + =/ m (strand:spider ,~) + ^- form:m + =* loop $ + ;< ~ bind:m (dojo ship "|start {}") + ;< ~ bind:m ::(wait-for-agent-start ship agent) + (wait-for-output ship "activated app home/{(trip agent)}") + (pure:m ~) +:: +++ wait-for-agent-start + |= [=ship agent=term] + =/ m (strand:spider ,~) + ^- form:m + =* loop $ + ;< [her=^ship =unix-effect] bind:m take-unix-effect + ?: (is-dojo-output:util ship her unix-effect "activated app home/{(trip agent)}") + (pure:m ~) + loop +:: +++ start-agents + |= =ship + =/ m (strand:spider ,~) + ~& %starting-agents + ^- form:m + ;< ~ bind:m (start-agent ship %group-store) + ;< ~ bind:m (start-agent ship %group-pull-hook) + ;< ~ bind:m (start-agent ship %group-push-hook) + :: + ;< ~ bind:m (start-agent ship %metadata-store) + ;< ~ bind:m (start-agent ship %metadata-hook) + :: + ;< ~ bind:m (start-agent ship %invite-store) + ;< ~ bind:m (start-agent ship %invite-hook) + :: + ;< ~ bind:m (start-agent ship %chat-store) + ;< ~ bind:m (start-agent ship %chat-hook) + ;< ~ bind:m (start-agent ship %chat-view) + :: + ;< ~ bind:m (start-agent ship %contact-store) + ;< ~ bind:m (start-agent ship %contact-hook) + ;< ~ bind:m (start-agent ship %contact-view) + :: + ;< ~ bind:m (start-agent ship %graph-store) + ;< ~ bind:m (start-agent ship %graph-push-hook) + ;< ~ bind:m (start-agent ship %graph-pull-hook) + :: + (pure:m ~) +:: +-- +^- thread:spider +|= arg=vase +=+ !<(who=?(~ [@p ~]) arg) +=/ m (strand ,vase) +;< ~ bind:m start-simple +:: +?~ who + ;< ~ bind:m (dojo ~zod "|mount %") + ;< ~ bind:m (dojo ~bus "|mount %") + ;< ~ bind:m (dojo ~web "|mount %") + ;< ~ bind:m (start-agents ~zod) + ;< ~ bind:m (start-agents ~bus) + ;< ~ bind:m (start-agents ~web) + (pure:m *vase) +:: +;< ~ bind:m (dojo -.who "|mount %") +;< ~ bind:m (start-agents -.who) +(pure:m *vase) diff --git a/pkg/arvo/ted/ph/start-drivers.hoon b/pkg/arvo/ted/ph/start-drivers.hoon index 825a2b814..e4480b03f 100644 --- a/pkg/arvo/ted/ph/start-drivers.hoon +++ b/pkg/arvo/ted/ph/start-drivers.hoon @@ -6,8 +6,8 @@ =/ m (strand ,vase) ;< =bowl:spider bind:m get-bowl ;< ~ bind:m start-simple +:: must be a better way to background threads |- =* loop $ -~& >> %looping ;< ~ bind:m (sleep ~s5) loop From 4668ddf84dee452a7b4b4819a4f905c92bb51f75 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Mon, 30 Nov 2020 13:06:05 -0800 Subject: [PATCH 14/24] groups: import/export --- pkg/arvo/app/group-store.hoon | 89 +++++++++++++++++++++++++++++++---- pkg/arvo/lib/pull-hook.hoon | 1 + 2 files changed, 82 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/app/group-store.hoon b/pkg/arvo/app/group-store.hoon index 57552866a..f61d14569 100644 --- a/pkg/arvo/app/group-store.hoon +++ b/pkg/arvo/app/group-store.hoon @@ -29,7 +29,7 @@ :: Modify the group. Further documented in /sur/group-store.hoon :: :: -/- *group, permission-store +/- *group, permission-store, *contact-view /+ store=group-store, default-agent, verb, dbug, resource |% +$ card card:agent:gall @@ -165,12 +165,15 @@ ^- (quip card _this) ?> (team:title our.bowl src.bowl) =^ cards state - ?+ mark (on-poke:def mark vase) - %noun (poke-noun:gc vase) - :: + ?+ mark (on-poke:def mark vase) + %noun + (poke-noun:gc vase) + :: ?(%group-update %group-action) (poke-group-update:gc !<(update:store vase)) - :: + :: + %import + (poke-import:gc q.vase) == [cards this] :: @@ -214,10 +217,42 @@ (slav %p i.t.t.t.t.t.t.path) ?~ rid ~ ``noun+!>((peek-group-join u.rid ship)) + :: + [%x %export ~] + ``noun+!>(state) == :: - ++ on-agent on-agent:def - ++ on-arvo on-arvo:def + ++ on-agent + |= [=wire =sign:agent:gall] + ^- (quip card _this) + ?. ?=([%try-rejoin @ *] wire) + (on-agent:def wire sign) + ?> ?=(%poke-ack -.sign) + =/ rid=resource (de-path:resource t.t.wire) + ?~ p.sign + =/ =cage + [%pull-hook-action !>([%add entity.rid rid])] + :_ this + [%pass / %agent [our.bowl %group-pull-hook] %poke cage]~ + =/ nack-count=@ud (slav %ud i.t.wire) + =/ wakeup=@da + (add now.bowl (mul ~s1 (bex (min 19 nack-count)))) + :_ this + [%pass wire %arvo %b %wait wakeup]~ + :: + ++ on-arvo + |= [=wire =sign-arvo] + ^- (quip card _this) + ?. ?=([%try-rejoin @ *] wire) + (on-arvo:def wire sign-arvo) + =/ =resource (de-path:resource t.t.wire) + =/ nack-count=@ud (slav %ud i.t.wire) + ?> ?=([%b %wake *] sign-arvo) + ~? ?=(^ error.sign-arvo) + "behn errored in backoff timers, continuing anyway" + :_ this + [(try-rejoin:gc resource +(nack-count))]~ + :: ++ on-fail on-fail:def -- :: @@ -226,7 +261,7 @@ |= rid=resource ^- (unit group) (~(get by groups) rid) - +:: ++ peek-group-join |= [rid=resource =ship] =/ ugroup @@ -246,6 +281,39 @@ (~(has in ban-ranks.policy) (clan:title ship)) == == +:: +++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-one ;;(state-one arc) + :_ sty + %+ roll ~(tap by groups.sty) + |= [[=resource =group] out=(list card)] + ?: =(entity.resource our.bol) + %+ weld out + %+ roll ~(tap in members.group) + |= [recipient=@p out=(list card)] + ?: =(recipient our.bol) + out + :_ out + %- poke-contact + :* %invite resource recipient + (crip "Rejoin disconnected group {}/{}") + == + :_ out + (try-rejoin resource 0) +:: +++ try-rejoin + |= [rid=resource nack-count=@ud] + ^- card + =/ =cage + :- %group-update + !> ^- update:store + [%add-members rid (sy our.bol ~)] + =/ =wire + [%try-rejoin (scot %ud nack-count) (en-path:resource rid)] + [%pass wire %agent [entity.rid %group-push-hook] %poke cage] +:: ++ poke-noun |= =vase ^- (quip card _state) @@ -604,6 +672,11 @@ |= =action:store ^- card [%pass / %agent [our.bol %group-store] %poke %group-action !>(action)] +:: +++ poke-contact + |= act=contact-view-action + ^- card + [%pass / %agent [our.bol %contact-view] %poke %contact-view-action !>(act)] :: +send-diff: update subscribers of new state :: :: We only allow subscriptions on /groups diff --git a/pkg/arvo/lib/pull-hook.hoon b/pkg/arvo/lib/pull-hook.hoon index cb3b5e6f7..eb91242e7 100644 --- a/pkg/arvo/lib/pull-hook.hoon +++ b/pkg/arvo/lib/pull-hook.hoon @@ -196,6 +196,7 @@ =. inner-state on-save:og !>(state) + :: ++ on-poke |= [=mark =vase] ^- [(list card:agent:gall) agent:gall] From 9ea14aa5589865d47fa36c8e22d9e716733569d0 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Mon, 30 Nov 2020 13:06:41 -0800 Subject: [PATCH 15/24] metadata: import/export --- pkg/arvo/app/metadata-hook.hoon | 62 ++++++++++++++++++++++++++++++-- pkg/arvo/app/metadata-store.hoon | 13 +++++++ 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/metadata-hook.hoon b/pkg/arvo/app/metadata-hook.hoon index 5cad89319..1d3e6dbce 100644 --- a/pkg/arvo/app/metadata-hook.hoon +++ b/pkg/arvo/app/metadata-hook.hoon @@ -51,9 +51,30 @@ `this :: ++ on-leave on-leave:def - ++ on-peek on-peek:def - ++ on-arvo on-arvo:def + ++ on-peek + |= =path + ^- (unit (unit cage)) + ?+ path (on-peek:def path) + [%x %export ~] + ``noun+!>(state) + == + :: + ++ on-arvo + |= [=wire =sign-arvo] + ^- (quip card _this) + ?. ?=([%try-rejoin @ @ *] wire) + (on-arvo:def wire sign-arvo) + =/ nack-count=@ud (slav %ud i.t.wire) + =/ who=@p (slav %p i.t.t.wire) + =/ pax t.t.t.wire + ?> ?=([%b %wake *] sign-arvo) + ~? ?=(^ error.sign-arvo) + "behn errored in backoff timers, continuing anyway" + :_ this + [(try-rejoin:hc who pax +(nack-count))]~ + :: ++ on-fail on-fail:def + :: ++ on-poke |= [=mark =vase] ^- (quip card _this) @@ -65,6 +86,12 @@ :: %metadata-action [(poke-action:hc !<(metadata-action vase)) this] + :: + %import + ?> (team:title our.bowl src.bowl) + =^ cards state + (poke-import:hc q.vase) + [cards this] == :: ++ on-watch @@ -166,6 +193,25 @@ !=(i.path '~') -- :: +++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-one ;;(state-one arc) + :_ sty + %+ murn ~(tap by synced.sty) + |= [=group-path =ship] + ?: =(ship our.bowl) + ~ + =/ =path [%group group-path] + `(try-rejoin ship path 0) +:: +++ try-rejoin + |= [who=@p pax=path nack-count=@ud] + ^- card + =/ =wire + [%try-rejoin (scot %ud nack-count) (scot %p who) pax] + [%pass wire %agent [who %metadata-hook] %watch pax] +:: ++ watch-group |= =path ^- (list card) @@ -240,7 +286,11 @@ |= wir=wire ^- (quip card _state) :_ state + |- ?+ wir !! + [%try-rejoin @ @ *] + $(wir t.t.t.wir) + :: [%updates ~] [%pass /updates %agent [our.bowl %metadata-store] %watch /updates]~ :: @@ -255,6 +305,14 @@ ++ watch-ack |= [wir=wire saw=(unit tang)] ^- (quip card _state) + ?: ?=([%try-rejoin @ *] wir) + ?~ saw + [~ state] + =/ nack-count=@ud (slav %ud i.t.wir) + =/ wakeup=@da + (add now.bowl (mul ~s1 (bex (min 19 nack-count)))) + :_ state + [%pass wir %arvo %b %wait wakeup]~ ?> ?=(^ wir) [~ ?~(saw state state(synced (~(del by synced) t.wir)))] :: diff --git a/pkg/arvo/app/metadata-store.hoon b/pkg/arvo/app/metadata-store.hoon index ec32cf818..402e39501 100644 --- a/pkg/arvo/app/metadata-store.hoon +++ b/pkg/arvo/app/metadata-store.hoon @@ -278,6 +278,7 @@ ?+ mark (on-poke:def mark vase) %metadata-action (poke-metadata-action:mc !<(metadata-action vase)) + :: %noun =/ val=(each [%cleanup path] tang) (mule |.(!<([%cleanup path] vase))) @@ -296,6 +297,9 @@ [app-name.r group app-path.r] == out + :: + %import + (poke-import:mc q.vase) == [cards this] :: @@ -350,6 +354,9 @@ =/ app=term i.t.t.path =/ app-path=^path t.t.t.path ``noun+!>((~(get by resource-indices) app app-path)) + :: + [%x %export ~] + ``noun+!>(state) == :: ++ on-leave on-leave:def @@ -368,6 +375,12 @@ %remove (handle-remove group-path.act resource.act) == :: +++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-6 ;;(state-6 arc) + [~ sty] +:: ++ handle-add |= [=group-path =md-resource =metadata] ^- (quip card _state) From 4f0e599cb10209016cf88fae90a456393c3e38c2 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Mon, 30 Nov 2020 13:07:04 -0800 Subject: [PATCH 16/24] contacts: import/export --- pkg/arvo/app/contact-hook.hoon | 57 +++++++++++++++++++++++++++++++-- pkg/arvo/app/contact-store.hoon | 17 ++++++++-- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/contact-hook.hoon b/pkg/arvo/app/contact-hook.hoon index 087120183..379b8fdc1 100644 --- a/pkg/arvo/app/contact-hook.hoon +++ b/pkg/arvo/app/contact-hook.hoon @@ -132,6 +132,10 @@ :: %contact-hook-action (poke-hook-action:cc !<(contact-hook-action vase)) + :: + %import + ?> (team:title our.bol src.bol) + (poke-import:cc q.vase) == [cards this] :: @@ -170,8 +174,27 @@ == :: ++ on-leave on-leave:def - ++ on-peek on-peek:def - ++ on-arvo on-arvo:def + ++ on-peek + |= =path + ^- (unit (unit cage)) + ?+ path (on-peek:def path) + [%x %export ~] + ``noun+!>(state) + == + ++ on-arvo + |= [=wire =sign-arvo] + ^- (quip card _this) + ?. ?=([%try-rejoin @ @ *] wire) + (on-arvo:def wire sign-arvo) + =/ nack-count=@ud (slav %ud i.t.wire) + =/ who=@p (slav %p i.t.t.wire) + =/ pax t.t.t.wire + ?> ?=([%b %wake *] sign-arvo) + ~? ?=(^ error.sign-arvo) + "behn errored in backoff timers, continuing anyway" + :_ this + [(try-rejoin:cc who pax +(nack-count))]~ + :: ++ on-fail on-fail:def -- :: @@ -260,6 +283,26 @@ == == :: +++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-three ;;(state-three arc) + :_ sty + %+ turn ~(tap by synced.sty) + |= [=path =ship] + ^- card + =/ contact-path [%contacts path] + ?: =(our.bol ship) + [%pass contact-path %agent [our.bol %contact-store] %watch contact-path] + (try-rejoin ship contact-path 0) +:: +++ try-rejoin + |= [who=@p pax=path nack-count=@ud] + ^- card + =/ =wire + [%try-rejoin (scot %ud nack-count) (scot %p who) pax] + [%pass wire %agent [who %contact-hook] %watch pax] +:: ++ watch-contacts |= pax=path ^- (list card) @@ -282,6 +325,13 @@ ^- (quip card _state) ?~ saw [~ state] + ?: ?=([%try-rejoin @ *] wir) + =/ nack-count=@ud (slav %ud i.t.wir) + =/ wakeup=@da + (add now.bol (mul ~s1 (bex (min 19 nack-count)))) + :_ state + [%pass wir %arvo %b %wait wakeup]~ + :: ?> ?=(^ wir) [~ state(synced (~(del by synced) t.wir))] :: @@ -295,6 +345,9 @@ |= wir=wire ^- (list card) ?+ wir !! + [%try-rejoin @ @ *] + $(wir t.t.t.wir) + :: [%inv ~] [%pass /inv %agent [our.bol %invite-store] %watch /invitatory/contacts]~ :: diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 6089cae80..8ed19228a 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -121,8 +121,12 @@ ?> (team:title our.bowl src.bowl) =^ cards state ?+ mark (on-poke:def mark vase) - ::%json (poke-json:cc !<(json vase)) - %contact-action (poke-contact-action:cc !<(contact-action vase)) + ::%json (poke-json:cc !<(json vase)) + %contact-action + (poke-contact-action:cc !<(contact-action vase)) + :: + %import + (poke-import:cc q.vase) == [cards this] :: @@ -169,6 +173,9 @@ ?~ contacts ~ ``noun+!>((~(get by u.contacts) ship)) + :: + [%x %export ~] + ``noun+!>(state) == :: ++ on-agent on-agent:def @@ -197,6 +204,12 @@ %edit (handle-edit +.action) == :: +++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-three ;;(state-three arc) + [~ sty] +:: ++ handle-create |= =path ^- (quip card _state) From 398fb5de5096dec41450f20f8bc39c2848b90f23 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Mon, 30 Nov 2020 13:07:26 -0800 Subject: [PATCH 17/24] invites: import/export --- pkg/arvo/app/invite-store.hoon | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/arvo/app/invite-store.hoon b/pkg/arvo/app/invite-store.hoon index 258f61a4c..5e504be74 100644 --- a/pkg/arvo/app/invite-store.hoon +++ b/pkg/arvo/app/invite-store.hoon @@ -102,9 +102,16 @@ =^ cards state ?+ mark (on-poke:def mark vase) %invite-action (poke-invite-action !<(action:store vase)) + %import (poke-import q.vase) == [cards this] :: + ++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-1 ;;(state-1 arc) + [~ sty] + :: ++ poke-invite-action |= =action:store ^- (quip card _state) @@ -205,5 +212,7 @@ :^ ~ ~ %noun !> ^- (unit invite:store) (~(get by invitatory) serial) + :: + [%x %export ~] ``noun+!>(state) == -- From feab60f8a91c70bf95a52e534cabdddecd3bceeb Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Mon, 30 Nov 2020 13:07:51 -0800 Subject: [PATCH 18/24] chat: import/export --- pkg/arvo/app/chat-hook.hoon | 59 ++++++++++++++++++++++++++++++++++-- pkg/arvo/app/chat-store.hoon | 16 ++++++++-- 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index 340d1e6c1..a0f7a4ee9 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -369,6 +369,10 @@ :: %chat-hook-action (poke-chat-hook-action:cc !<(action:hook vase)) + :: + %import + ?> (team:title our.bol src.bol) + (poke-import:cc q.vase) == [cards this] :: @@ -417,8 +421,28 @@ == :: ++ on-leave on-leave:def - ++ on-peek on-peek:def - ++ on-arvo on-arvo:def + ++ on-peek + |= =path + ^- (unit (unit cage)) + ?+ path (on-peek:def path) + [%x %export ~] + ``noun+!>(state) + == + :: + ++ on-arvo + |= [=wire =sign-arvo] + ^- (quip card _this) + ?. ?=([%try-rejoin @ @ *] wire) + (on-arvo:def wire sign-arvo) + =/ nack-count=@ud (slav %ud i.t.wire) + =/ who=@p (slav %p i.t.t.wire) + =/ pax t.t.t.wire + ?> ?=([%b %wake *] sign-arvo) + ~? ?=(^ error.sign-arvo) + "behn errored in backoff timers, continuing anyway" + :_ this + [(try-rejoin:cc who pax +(nack-count))]~ + :: ++ on-fail on-fail:def -- :: @@ -677,6 +701,27 @@ == == :: +++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-10 ;;(state-10 arc) + :_ sty + %+ turn ~(tap by synced.sty) + |= [=path =ship] + ^- card + =/ watch-path=^path [%mailbox path] + ?: =(our.bol ship) + =/ store-wire=wire [%store path] + [%pass store-wire %agent [our.bol %chat-store] %watch watch-path] + (try-rejoin ship watch-path 0) +:: +++ try-rejoin + |= [who=@p pax=path nack-count=@ud] + ^- card + =/ =wire + [%try-rejoin (scot %ud nack-count) (scot %p who) pax] + [%pass wire %agent [who %chat-hook] %watch pax] +:: ++ watch-synced |= pax=path ^- (list card) @@ -835,6 +880,9 @@ [%pass /permissions %agent [our.bol %permission-store] %watch /updates]~ :: ?+ wir !! + [%try-rejoin @ @ *] + $(wir t.t.t.wir) + :: [%groups ~] [~[watch-groups] state] :: [%store @ *] @@ -909,6 +957,13 @@ ?> ?=(^ chat) (migrate-listen t.chat) [~ state] + :: + [%try-rejoin @ *] + =/ nack-count=@ud (slav %ud i.t.wir) + =/ wakeup=@da + (add now.bol (mul ~s1 (bex (min 19 nack-count)))) + :_ state + [%pass wir %arvo %b %wait wakeup]~ == :: ++ chat-poke diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index 5118babbc..e1fab3631 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -89,9 +89,10 @@ ?> (team:title our.bowl src.bowl) =^ cards state ?+ mark (on-poke:def mark vase) - %json (poke-json:cc !<(json vase)) - %chat-action (poke-chat-action:cc !<(action:store vase)) - %noun [~ (poke-noun:cc !<(admin-action vase))] + %json (poke-json:cc !<(json vase)) + %chat-action (poke-chat-action:cc !<(action:store vase)) + %noun [~ (poke-noun:cc !<(admin-action vase))] + %import (poke-import:cc q.vase) == [cards this] :: @@ -139,6 +140,9 @@ ?~ mailbox ~ ``noun+!>(config.u.mailbox) + :: + [%x %export ~] + ``noun+!>(state) == :: ++ on-agent on-agent:def @@ -235,6 +239,12 @@ [(weld message-moves read-moves) state] == :: +++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty=state-3 ;;(state-3 arc) + [~ sty] +:: ++ handle-create |= =action:store ^- (quip card _state) From 2f53524e2ffcdb76f522191c60e1545ac5c3824e Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Mon, 30 Nov 2020 13:08:15 -0800 Subject: [PATCH 19/24] graphs: import-export --- pkg/arvo/app/graph-store.hoon | 54 ++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index df39fb0ae..1104fb412 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -218,6 +218,7 @@ ?+ mark (on-poke:def mark vase) %graph-update (graph-update !<(update:store vase)) %noun (debug !<(debug-input vase)) + %import (poke-import q.vase) == [cards this] :: @@ -612,6 +613,26 @@ %graph ^$(graph p.children.node) == == + :: + ++ poke-import + |= arc=* + ^- (quip card _state) + =/ sty ;;(state-2 arc) + :_ sty + %+ turn ~(tap by graphs.sty) + |= [rid=resource:store =marked-graph:store] + ^- card + ?: =(our.bowl entity.rid) + =/ =cage [%push-hook-action !>([%add rid])] + [%pass / %agent [our.bowl %graph-push-hook] %poke cage] + (try-rejoin rid 0) + :: + ++ try-rejoin + |= [rid=resource:store nack-count=@] + ^- card + =/ res-path (en-path:res rid) + =/ wire [%try-rejoin (scot %ud nack-count) res-path] + [%pass wire %agent [entity.rid %graph-push-hook] %watch resource+res-path] -- :: ++ on-peek @@ -668,6 +689,9 @@ :+ %0 now.bowl [%add-graph [ship term] `graph:store`p.u.result q.u.result %.y] + :: + [%x %export ~] + ``noun+!>(state) :: [%x %graph-subset @ @ @ @ ~] =/ =ship (slav %p i.t.t.path) @@ -792,9 +816,37 @@ =* validator i.t.wire =/ =rave:clay [%next %b [%da now.bowl] /[validator]] [%pass wire %arvo %c %warp our.bowl [%home `rave]]~ + :: + [%try-rejoin @ *] + =/ rid=resource:store (de-path:res t.t.wire) + =/ nack-count (slav %ud i.t.wire) + ?> ?=([%b %wake *] sign-arvo) + ~? ?=(^ error.sign-arvo) + "behn errored in backoff timers, continuing anyway" + =/ new=^wire [%try-rejoin (scot %ud +(nack-count)) t.t.wire] + :_ this + [%pass new %agent [entity.rid %graph-push-hook] %watch resource+t.t.wire]~ == :: -++ on-agent on-agent:def +++ on-agent + |= [=wire =sign:agent:gall] + ^- (quip card _this) + ?. ?=([%try-rejoin @ *] wire) + (on-agent:def wire sign) + ?. ?=(%watch-ack -.sign) + [~ this] + =/ rid=resource:store (de-path:res t.t.wire) + ?~ p.sign + :: leave and poke our graph-pull-hook + =/ =cage [%pull-hook-action !>([%add entity.rid rid])] + :_ this + [%pass / %agent [our.bowl %graph-pull-hook] %poke cage]~ + =/ nack-count=@ud (slav %ud i.t.wire) + =/ wakeup=@da + (add now.bowl (mul ~s1 (bex (min 19 nack-count)))) + :_ this + [%pass wire %arvo %b %wait wakeup]~ +:: ++ on-leave on-leave:def ++ on-fail on-fail:def -- From 9ea43121a5ffc4a71ae486a24fc7914da7100115 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Tue, 1 Dec 2020 17:52:24 -0800 Subject: [PATCH 20/24] graph-store: leave try-rejoin wire when subscription succeeds --- pkg/arvo/app/graph-store.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index 1104fb412..c863a1a0e 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -837,10 +837,11 @@ [~ this] =/ rid=resource:store (de-path:res t.t.wire) ?~ p.sign - :: leave and poke our graph-pull-hook =/ =cage [%pull-hook-action !>([%add entity.rid rid])] :_ this - [%pass / %agent [our.bowl %graph-pull-hook] %poke cage]~ + :~ [%pass / %agent [our.bowl %graph-pull-hook] %poke cage] + [%pass wire %agent [entity.rid %graph-push-hook] %leave ~] + == =/ nack-count=@ud (slav %ud i.t.wire) =/ wakeup=@da (add now.bowl (mul ~s1 (bex (min 19 nack-count)))) From 0c3edb1ca9ded9e64b48cf48c2db15c56d9fa7f6 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Tue, 1 Dec 2020 23:03:05 -0800 Subject: [PATCH 21/24] apps: reorder maps, sets, and jugs --- pkg/arvo/app/chat-hook.hoon | 9 ++- pkg/arvo/app/chat-store.hoon | 4 +- pkg/arvo/app/contact-hook.hoon | 12 ++- pkg/arvo/app/contact-store.hoon | 7 +- pkg/arvo/app/graph-store.hoon | 130 ++++++++++++++++++++++++++++++- pkg/arvo/app/group-store.hoon | 54 +++++++++++-- pkg/arvo/app/invite-store.hoon | 7 +- pkg/arvo/app/metadata-hook.hoon | 5 +- pkg/arvo/app/metadata-store.hoon | 23 +++++- pkg/arvo/lib/migrate.hoon | 19 +++++ 10 files changed, 246 insertions(+), 24 deletions(-) create mode 100644 pkg/arvo/lib/migrate.hoon diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index a0f7a4ee9..cfeb069ee 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -8,7 +8,7 @@ view=chat-view, *group /+ default-agent, verb, dbug, store=chat-store, group-store, grpl=group, - resource + resource, *migrate ~% %chat-hook-top ..is ~ |% +$ card card:agent:gall @@ -704,7 +704,12 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-10 ;;(state-10 arc) + =/ sty=state-10 + :* %10 + (remake-map ;;((tree [path ship]) -.arc)) + ;;(? +<.arc) + (remake-map ;;((tree [path ?]) +>.arc)) + == :_ sty %+ turn ~(tap by synced.sty) |= [=path =ship] diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index e1fab3631..6726c12e0 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -2,7 +2,7 @@ :: :: data store that holds linear sequences of chat messages :: -/+ store=chat-store, default-agent, verb, dbug, group-store +/+ store=chat-store, default-agent, verb, dbug, group-store, *migrate ~% %chat-store-top ..is ~ |% +$ card card:agent:gall @@ -242,7 +242,7 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-3 ;;(state-3 arc) + =/ sty=state-3 [%3 (remake-map ;;((tree [path mailbox:store]) +.arc))] [~ sty] :: ++ handle-create diff --git a/pkg/arvo/app/contact-hook.hoon b/pkg/arvo/app/contact-hook.hoon index 379b8fdc1..87767faac 100644 --- a/pkg/arvo/app/contact-hook.hoon +++ b/pkg/arvo/app/contact-hook.hoon @@ -8,7 +8,14 @@ *metadata-hook, *metadata-store, *group -/+ *contact-json, default-agent, dbug, group-store, verb, resource, grpl=group +/+ *contact-json, + default-agent, + dbug, + group-store, + verb, + resource, + grpl=group, + *migrate ~% %contact-hook-top ..is ~ |% +$ card card:agent:gall @@ -286,7 +293,8 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-three ;;(state-three arc) + =/ sty=state-three + [%3 (remake-map ;;((tree [path ship]) +<.arc)) ;;(? +>.arc)] :_ sty %+ turn ~(tap by synced.sty) |= [=path =ship] diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 8ed19228a..7f4323a64 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -2,7 +2,7 @@ :: :: data store that holds group-based contact data :: -/+ *contact-json, default-agent, dbug +/+ *contact-json, default-agent, dbug, *migrate |% +$ card card:agent:gall +$ versioned-state @@ -207,7 +207,10 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-three ;;(state-three arc) + =/ sty=state-three + :- %3 + %- remake-map-of-map + ;;((tree [path (tree [ship contact])]) +.arc) [~ sty] :: ++ handle-create diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index c863a1a0e..4af84305a 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -1,7 +1,8 @@ :: graph-store [landscape] :: :: -/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug +/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug, + *migrate ~% %graph-store-top ..is ~ |% +$ card card:agent:gall @@ -617,7 +618,8 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty ;;(state-2 arc) + |^ + =/ sty=state-2 [%2 (remake-network ;;(tree-network +.arc))] :_ sty %+ turn ~(tap by graphs.sty) |= [rid=resource:store =marked-graph:store] @@ -626,6 +628,130 @@ =/ =cage [%push-hook-action !>([%add rid])] [%pass / %agent [our.bowl %graph-push-hook] %poke cage] (try-rejoin rid 0) + :: + +$ tree-network + $: graphs=tree-graphs + tag-queries=(tree [term (tree resource:store)]) + update-logs=tree-update-logs + archive=tree-graphs + validators=(tree ^mark) + == + +$ tree-graphs (tree [resource:store tree-marked-graph]) + +$ tree-marked-graph [p=tree-graph q=(unit ^mark)] + +$ tree-graph (tree [atom tree-node]) + +$ tree-node [post=tree-post children=tree-internal-graph] + +$ tree-internal-graph + $~ [%empty ~] + $% [%graph p=tree-graph] + [%empty ~] + == + +$ tree-update-logs (tree [resource:store tree-update-log]) + +$ tree-update-log (tree [time tree-logged-update]) + +$ tree-logged-update + $: %0 + p=time + $= q + $% [%add-nodes =resource:store nodes=(tree [index:store tree-node])] + [%remove-nodes =resource:store indices=(tree index:store)] + [%add-signatures =uid:store signatures=tree-signatures] + [%remove-signatures =uid:store signatures=tree-signatures] + == + == + +$ tree-signatures (tree signature:store) + +$ tree-post + $: author=ship + =index:store + time-sent=time + contents=(list content:store) + hash=(unit hash:store) + signatures=tree-signatures + == + :: + ++ remake-network + |= t=tree-network + ^- network:store + :* (remake-graphs graphs.t) + (remake-jug tag-queries.t) + (remake-update-logs update-logs.t) + (remake-graphs archive.t) + (remake-set validators.t) + == + :: + ++ remake-graphs + |= t=tree-graphs + ^- graphs:store + %- remake-map + (~(run by t) remake-marked-graph) + :: + ++ remake-marked-graph + |= t=tree-marked-graph + ^- marked-graph:store + [(remake-graph p.t) q.t] + :: + ++ remake-graph + |= t=tree-graph + ^- graph:store + %+ gas:orm *graph:store + %+ turn ~(tap by t) + |= [a=atom tn=tree-node] + ^- [atom node:store] + [a (remake-node tn)] + :: + ++ remake-internal-graph + |= t=tree-internal-graph + ^- internal-graph:store + ?: ?=(%empty -.t) + [%empty ~] + [%graph (remake-graph p.t)] + :: + ++ remake-node + |= t=tree-node + ^- node:store + :- (remake-post post.t) + (remake-internal-graph children.t) + :: + ++ remake-update-logs + |= t=tree-update-logs + ^- update-logs:store + %- remake-map + (~(run by t) remake-update-log) + :: + ++ remake-update-log + |= t=tree-update-log + ^- update-log:store + =/ ulm ((ordered-map time logged-update:store) gth) + %+ gas:ulm *update-log:store + %+ turn ~(tap by t) + |= [=time tlu=tree-logged-update] + ^- [^time logged-update:store] + [time (remake-logged-update tlu)] + :: + ++ remake-logged-update + |= t=tree-logged-update + ^- logged-update:store + :+ %0 p.t + ?- -.q.t + %add-nodes + :- %add-nodes + :- resource.q.t + %- remake-map + (~(run by nodes.q.t) remake-node) + :: + %remove-nodes + [%remove-nodes resource.q.t (remake-set indices.q.t)] + :: + %add-signatures + [%add-signatures uid.q.t (remake-set signatures.q.t)] + :: + %remove-signatures + [%remove-signatures uid.q.t (remake-set signatures.q.t)] + == + :: + ++ remake-post + |= t=tree-post + ^- post:store + t(signatures (remake-set signatures.t)) + -- :: ++ try-rejoin |= [rid=resource:store nack-count=@] diff --git a/pkg/arvo/app/group-store.hoon b/pkg/arvo/app/group-store.hoon index f61d14569..0a838195e 100644 --- a/pkg/arvo/app/group-store.hoon +++ b/pkg/arvo/app/group-store.hoon @@ -30,7 +30,7 @@ :: :: /- *group, permission-store, *contact-view -/+ store=group-store, default-agent, verb, dbug, resource +/+ store=group-store, default-agent, verb, dbug, resource, *migrate |% +$ card card:agent:gall :: @@ -285,23 +285,61 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-one ;;(state-one arc) + |^ + =/ sty=state-one + [%1 (remake-groups ;;((tree [resource tree-group]) +.arc))] :_ sty %+ roll ~(tap by groups.sty) - |= [[=resource =group] out=(list card)] - ?: =(entity.resource our.bol) + |= [[rid=resource grp=group] out=(list card)] + ?: =(entity.rid our.bol) %+ weld out - %+ roll ~(tap in members.group) + %+ roll ~(tap in members.grp) |= [recipient=@p out=(list card)] ?: =(recipient our.bol) out :_ out %- poke-contact - :* %invite resource recipient - (crip "Rejoin disconnected group {}/{}") + :* %invite rid recipient + (crip "Rejoin disconnected group {}/{}") == :_ out - (try-rejoin resource 0) + (try-rejoin rid 0) + :: + ++ remake-groups + |= grps=(tree [resource tree-group]) + ^- ^groups + %- remake-map + (~(run by grps) remake-group) + :: + ++ remake-group + |= grp=tree-group + ^- group + %= grp + members (remake-set members.grp) + tags (remake-jug tags.grp) + policy (remake-policy policy.grp) + == + :: + +$ tree-group + $: members=(tree ship) + tags=(tree [tag (tree ship)]) + policy=tree-policy + hidden=? + == + :: + +$ tree-policy + $% [%invite pending=(tree ship)] + [%open ban-ranks=(tree rank:title) banned=(tree ship)] + == + :: + ++ remake-policy + |= pl=tree-policy + ^- policy + ?- -.pl + %invite [%invite (remake-set pending.pl)] + %open [%open (remake-set ban-ranks.pl) (remake-set banned.pl)] + == + -- :: ++ try-rejoin |= [rid=resource nack-count=@ud] diff --git a/pkg/arvo/app/invite-store.hoon b/pkg/arvo/app/invite-store.hoon index 5e504be74..ae74a4e5f 100644 --- a/pkg/arvo/app/invite-store.hoon +++ b/pkg/arvo/app/invite-store.hoon @@ -1,6 +1,6 @@ :: invite-store [landscape] /- store=invite-store -/+ res=resource, default-agent, dbug +/+ res=resource, default-agent, dbug, *migrate |% +$ card card:agent:gall +$ versioned-state @@ -109,7 +109,10 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-1 ;;(state-1 arc) + =/ sty=state-1 + :- %1 + %- remake-map-of-map + ;;((tree [term (tree [serial:store invite:store])]) +.arc) [~ sty] :: ++ poke-invite-action diff --git a/pkg/arvo/app/metadata-hook.hoon b/pkg/arvo/app/metadata-hook.hoon index 1d3e6dbce..2558a4481 100644 --- a/pkg/arvo/app/metadata-hook.hoon +++ b/pkg/arvo/app/metadata-hook.hoon @@ -6,7 +6,7 @@ :: /group/%group-path all updates related to this group :: /- *metadata-store, *metadata-hook -/+ default-agent, dbug, verb, grpl=group +/+ default-agent, dbug, verb, grpl=group, *migrate ~% %metadata-hook-top ..is ~ |% +$ card card:agent:gall @@ -196,7 +196,8 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-one ;;(state-one arc) + =/ sty=state-one + [%1 (remake-map ;;((tree [group-path ship]) +.arc))] :_ sty %+ murn ~(tap by synced.sty) |= [=group-path =ship] diff --git a/pkg/arvo/app/metadata-store.hoon b/pkg/arvo/app/metadata-store.hoon index 402e39501..10ca142d0 100644 --- a/pkg/arvo/app/metadata-store.hoon +++ b/pkg/arvo/app/metadata-store.hoon @@ -24,7 +24,7 @@ :: /group/%group-path associations for group :: /- *metadata-store, *metadata-hook -/+ *metadata-json, default-agent, verb, dbug, resource +/+ *metadata-json, default-agent, verb, dbug, resource, *migrate |% +$ card card:agent:gall +$ base-state-0 @@ -378,8 +378,27 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-6 ;;(state-6 arc) + |^ + =/ sty=state-6 + [%6 (remake-metadata ;;(tree-metadata +.arc))] [~ sty] + :: + +$ tree-metadata + $: associations=(tree [[group-path md-resource] metadata]) + group-indices=(tree [group-path (tree md-resource)]) + app-indices=(tree [app-name (tree [group-path app-path])]) + resource-indices=(tree [md-resource (tree group-path)]) + == + :: + ++ remake-metadata + |= tm=tree-metadata + ^- base-state-1 + :* (remake-map associations.tm) + (remake-jug group-indices.tm) + (remake-jug app-indices.tm) + (remake-jug resource-indices.tm) + == + -- :: ++ handle-add |= [=group-path =md-resource =metadata] diff --git a/pkg/arvo/lib/migrate.hoon b/pkg/arvo/lib/migrate.hoon new file mode 100644 index 000000000..2f1d3b015 --- /dev/null +++ b/pkg/arvo/lib/migrate.hoon @@ -0,0 +1,19 @@ +|% +++ remake-set + |* s=(tree) + (sy ~(tap in s)) +:: +++ remake-map + |* m=(tree) + (my ~(tap by m)) +:: +++ remake-jug + |* j=(tree [* (tree)]) + %- remake-map + (~(run by j) remake-set) +:: +++ remake-map-of-map + |* mm=(tree [* (tree)]) + %- remake-map + (~(run by mm) remake-map) +-- From 1d6a4603457edcd722ad72b9d29bd6ac3de6551b Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Tue, 1 Dec 2020 23:03:05 -0800 Subject: [PATCH 22/24] apps: reorder maps, sets, and jugs --- pkg/arvo/app/chat-hook.hoon | 9 ++- pkg/arvo/app/chat-store.hoon | 4 +- pkg/arvo/app/contact-hook.hoon | 12 ++- pkg/arvo/app/contact-store.hoon | 7 +- pkg/arvo/app/graph-store.hoon | 130 ++++++++++++++++++++++++++++++- pkg/arvo/app/group-store.hoon | 54 +++++++++++-- pkg/arvo/app/invite-store.hoon | 7 +- pkg/arvo/app/metadata-hook.hoon | 5 +- pkg/arvo/app/metadata-store.hoon | 23 +++++- pkg/arvo/lib/migrate.hoon | 19 +++++ 10 files changed, 246 insertions(+), 24 deletions(-) create mode 100644 pkg/arvo/lib/migrate.hoon diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index a0f7a4ee9..cfeb069ee 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -8,7 +8,7 @@ view=chat-view, *group /+ default-agent, verb, dbug, store=chat-store, group-store, grpl=group, - resource + resource, *migrate ~% %chat-hook-top ..is ~ |% +$ card card:agent:gall @@ -704,7 +704,12 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-10 ;;(state-10 arc) + =/ sty=state-10 + :* %10 + (remake-map ;;((tree [path ship]) -.arc)) + ;;(? +<.arc) + (remake-map ;;((tree [path ?]) +>.arc)) + == :_ sty %+ turn ~(tap by synced.sty) |= [=path =ship] diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index e1fab3631..6726c12e0 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -2,7 +2,7 @@ :: :: data store that holds linear sequences of chat messages :: -/+ store=chat-store, default-agent, verb, dbug, group-store +/+ store=chat-store, default-agent, verb, dbug, group-store, *migrate ~% %chat-store-top ..is ~ |% +$ card card:agent:gall @@ -242,7 +242,7 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-3 ;;(state-3 arc) + =/ sty=state-3 [%3 (remake-map ;;((tree [path mailbox:store]) +.arc))] [~ sty] :: ++ handle-create diff --git a/pkg/arvo/app/contact-hook.hoon b/pkg/arvo/app/contact-hook.hoon index 379b8fdc1..87767faac 100644 --- a/pkg/arvo/app/contact-hook.hoon +++ b/pkg/arvo/app/contact-hook.hoon @@ -8,7 +8,14 @@ *metadata-hook, *metadata-store, *group -/+ *contact-json, default-agent, dbug, group-store, verb, resource, grpl=group +/+ *contact-json, + default-agent, + dbug, + group-store, + verb, + resource, + grpl=group, + *migrate ~% %contact-hook-top ..is ~ |% +$ card card:agent:gall @@ -286,7 +293,8 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-three ;;(state-three arc) + =/ sty=state-three + [%3 (remake-map ;;((tree [path ship]) +<.arc)) ;;(? +>.arc)] :_ sty %+ turn ~(tap by synced.sty) |= [=path =ship] diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 8ed19228a..7f4323a64 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -2,7 +2,7 @@ :: :: data store that holds group-based contact data :: -/+ *contact-json, default-agent, dbug +/+ *contact-json, default-agent, dbug, *migrate |% +$ card card:agent:gall +$ versioned-state @@ -207,7 +207,10 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-three ;;(state-three arc) + =/ sty=state-three + :- %3 + %- remake-map-of-map + ;;((tree [path (tree [ship contact])]) +.arc) [~ sty] :: ++ handle-create diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index 1104fb412..688be9d9c 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -1,7 +1,8 @@ :: graph-store [landscape] :: :: -/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug +/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug, + *migrate ~% %graph-store-top ..is ~ |% +$ card card:agent:gall @@ -617,7 +618,8 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty ;;(state-2 arc) + |^ + =/ sty=state-2 [%2 (remake-network ;;(tree-network +.arc))] :_ sty %+ turn ~(tap by graphs.sty) |= [rid=resource:store =marked-graph:store] @@ -626,6 +628,130 @@ =/ =cage [%push-hook-action !>([%add rid])] [%pass / %agent [our.bowl %graph-push-hook] %poke cage] (try-rejoin rid 0) + :: + +$ tree-network + $: graphs=tree-graphs + tag-queries=(tree [term (tree resource:store)]) + update-logs=tree-update-logs + archive=tree-graphs + validators=(tree ^mark) + == + +$ tree-graphs (tree [resource:store tree-marked-graph]) + +$ tree-marked-graph [p=tree-graph q=(unit ^mark)] + +$ tree-graph (tree [atom tree-node]) + +$ tree-node [post=tree-post children=tree-internal-graph] + +$ tree-internal-graph + $~ [%empty ~] + $% [%graph p=tree-graph] + [%empty ~] + == + +$ tree-update-logs (tree [resource:store tree-update-log]) + +$ tree-update-log (tree [time tree-logged-update]) + +$ tree-logged-update + $: %0 + p=time + $= q + $% [%add-nodes =resource:store nodes=(tree [index:store tree-node])] + [%remove-nodes =resource:store indices=(tree index:store)] + [%add-signatures =uid:store signatures=tree-signatures] + [%remove-signatures =uid:store signatures=tree-signatures] + == + == + +$ tree-signatures (tree signature:store) + +$ tree-post + $: author=ship + =index:store + time-sent=time + contents=(list content:store) + hash=(unit hash:store) + signatures=tree-signatures + == + :: + ++ remake-network + |= t=tree-network + ^- network:store + :* (remake-graphs graphs.t) + (remake-jug tag-queries.t) + (remake-update-logs update-logs.t) + (remake-graphs archive.t) + (remake-set validators.t) + == + :: + ++ remake-graphs + |= t=tree-graphs + ^- graphs:store + %- remake-map + (~(run by t) remake-marked-graph) + :: + ++ remake-marked-graph + |= t=tree-marked-graph + ^- marked-graph:store + [(remake-graph p.t) q.t] + :: + ++ remake-graph + |= t=tree-graph + ^- graph:store + %+ gas:orm *graph:store + %+ turn ~(tap by t) + |= [a=atom tn=tree-node] + ^- [atom node:store] + [a (remake-node tn)] + :: + ++ remake-internal-graph + |= t=tree-internal-graph + ^- internal-graph:store + ?: ?=(%empty -.t) + [%empty ~] + [%graph (remake-graph p.t)] + :: + ++ remake-node + |= t=tree-node + ^- node:store + :- (remake-post post.t) + (remake-internal-graph children.t) + :: + ++ remake-update-logs + |= t=tree-update-logs + ^- update-logs:store + %- remake-map + (~(run by t) remake-update-log) + :: + ++ remake-update-log + |= t=tree-update-log + ^- update-log:store + =/ ulm ((ordered-map time logged-update:store) gth) + %+ gas:ulm *update-log:store + %+ turn ~(tap by t) + |= [=time tlu=tree-logged-update] + ^- [^time logged-update:store] + [time (remake-logged-update tlu)] + :: + ++ remake-logged-update + |= t=tree-logged-update + ^- logged-update:store + :+ %0 p.t + ?- -.q.t + %add-nodes + :- %add-nodes + :- resource.q.t + %- remake-map + (~(run by nodes.q.t) remake-node) + :: + %remove-nodes + [%remove-nodes resource.q.t (remake-set indices.q.t)] + :: + %add-signatures + [%add-signatures uid.q.t (remake-set signatures.q.t)] + :: + %remove-signatures + [%remove-signatures uid.q.t (remake-set signatures.q.t)] + == + :: + ++ remake-post + |= t=tree-post + ^- post:store + t(signatures (remake-set signatures.t)) + -- :: ++ try-rejoin |= [rid=resource:store nack-count=@] diff --git a/pkg/arvo/app/group-store.hoon b/pkg/arvo/app/group-store.hoon index f61d14569..0a838195e 100644 --- a/pkg/arvo/app/group-store.hoon +++ b/pkg/arvo/app/group-store.hoon @@ -30,7 +30,7 @@ :: :: /- *group, permission-store, *contact-view -/+ store=group-store, default-agent, verb, dbug, resource +/+ store=group-store, default-agent, verb, dbug, resource, *migrate |% +$ card card:agent:gall :: @@ -285,23 +285,61 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-one ;;(state-one arc) + |^ + =/ sty=state-one + [%1 (remake-groups ;;((tree [resource tree-group]) +.arc))] :_ sty %+ roll ~(tap by groups.sty) - |= [[=resource =group] out=(list card)] - ?: =(entity.resource our.bol) + |= [[rid=resource grp=group] out=(list card)] + ?: =(entity.rid our.bol) %+ weld out - %+ roll ~(tap in members.group) + %+ roll ~(tap in members.grp) |= [recipient=@p out=(list card)] ?: =(recipient our.bol) out :_ out %- poke-contact - :* %invite resource recipient - (crip "Rejoin disconnected group {}/{}") + :* %invite rid recipient + (crip "Rejoin disconnected group {}/{}") == :_ out - (try-rejoin resource 0) + (try-rejoin rid 0) + :: + ++ remake-groups + |= grps=(tree [resource tree-group]) + ^- ^groups + %- remake-map + (~(run by grps) remake-group) + :: + ++ remake-group + |= grp=tree-group + ^- group + %= grp + members (remake-set members.grp) + tags (remake-jug tags.grp) + policy (remake-policy policy.grp) + == + :: + +$ tree-group + $: members=(tree ship) + tags=(tree [tag (tree ship)]) + policy=tree-policy + hidden=? + == + :: + +$ tree-policy + $% [%invite pending=(tree ship)] + [%open ban-ranks=(tree rank:title) banned=(tree ship)] + == + :: + ++ remake-policy + |= pl=tree-policy + ^- policy + ?- -.pl + %invite [%invite (remake-set pending.pl)] + %open [%open (remake-set ban-ranks.pl) (remake-set banned.pl)] + == + -- :: ++ try-rejoin |= [rid=resource nack-count=@ud] diff --git a/pkg/arvo/app/invite-store.hoon b/pkg/arvo/app/invite-store.hoon index 5e504be74..ae74a4e5f 100644 --- a/pkg/arvo/app/invite-store.hoon +++ b/pkg/arvo/app/invite-store.hoon @@ -1,6 +1,6 @@ :: invite-store [landscape] /- store=invite-store -/+ res=resource, default-agent, dbug +/+ res=resource, default-agent, dbug, *migrate |% +$ card card:agent:gall +$ versioned-state @@ -109,7 +109,10 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-1 ;;(state-1 arc) + =/ sty=state-1 + :- %1 + %- remake-map-of-map + ;;((tree [term (tree [serial:store invite:store])]) +.arc) [~ sty] :: ++ poke-invite-action diff --git a/pkg/arvo/app/metadata-hook.hoon b/pkg/arvo/app/metadata-hook.hoon index 1d3e6dbce..2558a4481 100644 --- a/pkg/arvo/app/metadata-hook.hoon +++ b/pkg/arvo/app/metadata-hook.hoon @@ -6,7 +6,7 @@ :: /group/%group-path all updates related to this group :: /- *metadata-store, *metadata-hook -/+ default-agent, dbug, verb, grpl=group +/+ default-agent, dbug, verb, grpl=group, *migrate ~% %metadata-hook-top ..is ~ |% +$ card card:agent:gall @@ -196,7 +196,8 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-one ;;(state-one arc) + =/ sty=state-one + [%1 (remake-map ;;((tree [group-path ship]) +.arc))] :_ sty %+ murn ~(tap by synced.sty) |= [=group-path =ship] diff --git a/pkg/arvo/app/metadata-store.hoon b/pkg/arvo/app/metadata-store.hoon index 402e39501..10ca142d0 100644 --- a/pkg/arvo/app/metadata-store.hoon +++ b/pkg/arvo/app/metadata-store.hoon @@ -24,7 +24,7 @@ :: /group/%group-path associations for group :: /- *metadata-store, *metadata-hook -/+ *metadata-json, default-agent, verb, dbug, resource +/+ *metadata-json, default-agent, verb, dbug, resource, *migrate |% +$ card card:agent:gall +$ base-state-0 @@ -378,8 +378,27 @@ ++ poke-import |= arc=* ^- (quip card _state) - =/ sty=state-6 ;;(state-6 arc) + |^ + =/ sty=state-6 + [%6 (remake-metadata ;;(tree-metadata +.arc))] [~ sty] + :: + +$ tree-metadata + $: associations=(tree [[group-path md-resource] metadata]) + group-indices=(tree [group-path (tree md-resource)]) + app-indices=(tree [app-name (tree [group-path app-path])]) + resource-indices=(tree [md-resource (tree group-path)]) + == + :: + ++ remake-metadata + |= tm=tree-metadata + ^- base-state-1 + :* (remake-map associations.tm) + (remake-jug group-indices.tm) + (remake-jug app-indices.tm) + (remake-jug resource-indices.tm) + == + -- :: ++ handle-add |= [=group-path =md-resource =metadata] diff --git a/pkg/arvo/lib/migrate.hoon b/pkg/arvo/lib/migrate.hoon new file mode 100644 index 000000000..2f1d3b015 --- /dev/null +++ b/pkg/arvo/lib/migrate.hoon @@ -0,0 +1,19 @@ +|% +++ remake-set + |* s=(tree) + (sy ~(tap in s)) +:: +++ remake-map + |* m=(tree) + (my ~(tap by m)) +:: +++ remake-jug + |* j=(tree [* (tree)]) + %- remake-map + (~(run by j) remake-set) +:: +++ remake-map-of-map + |* mm=(tree [* (tree)]) + %- remake-map + (~(run by mm) remake-map) +-- From 13f49d42e17d8b877e29fa27b0d833ca5aad8c5a Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Wed, 2 Dec 2020 01:32:25 -0800 Subject: [PATCH 23/24] chat-hook: fix poke-import issue --- pkg/arvo/app/chat-hook.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index cfeb069ee..cbc70f991 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -706,9 +706,9 @@ ^- (quip card _state) =/ sty=state-10 :* %10 - (remake-map ;;((tree [path ship]) -.arc)) - ;;(? +<.arc) - (remake-map ;;((tree [path ?]) +>.arc)) + (remake-map ;;((tree [path ship]) +<.arc)) + ;;(? +<-.arc) + (remake-map ;;((tree [path ?]) +>+.arc)) == :_ sty %+ turn ~(tap by synced.sty) From 79308eb4edfadd94af76a20fb9b4c9417e0e275f Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Wed, 2 Dec 2020 22:48:33 -0800 Subject: [PATCH 24/24] chat-hook: fix another poke-import issue --- pkg/arvo/app/chat-hook.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index cbc70f991..15e374624 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -707,7 +707,7 @@ =/ sty=state-10 :* %10 (remake-map ;;((tree [path ship]) +<.arc)) - ;;(? +<-.arc) + ;;(? +>-.arc) (remake-map ;;((tree [path ?]) +>+.arc)) == :_ sty