From 233b61199d95e88bd9e4f84085263bfa71a3800a Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 6 Jul 2020 20:02:15 -0400 Subject: [PATCH] graph: improved type naming --- pkg/arvo/app/graph-push-hook.hoon | 6 ++-- pkg/arvo/app/graph-store.hoon | 49 ++++++++++++++++--------------- pkg/arvo/app/graph-view.hoon | 4 +-- pkg/arvo/lib/graph.hoon | 5 ++-- pkg/arvo/sur/graph-store.hoon | 18 +++++++----- 5 files changed, 46 insertions(+), 36 deletions(-) diff --git a/pkg/arvo/app/graph-push-hook.hoon b/pkg/arvo/app/graph-push-hook.hoon index bd19572ff7..08d36c8cfe 100644 --- a/pkg/arvo/app/graph-push-hook.hoon +++ b/pkg/arvo/app/graph-push-hook.hoon @@ -28,6 +28,7 @@ +* this . def ~(. (default-agent this %|) bowl) grp ~(. group bowl) + gra ~(. graph bowl) :: ++ on-init on-init:def ++ on-save !>(~) @@ -88,9 +89,10 @@ ?> (can-join:grp resource src.bowl) ?~ path :: new subscribe - =/ =graph:store (get-graph:graph resource) + =/ [=graph:store mark=(unit mark:store)] + (get-graph:gra resource) !> ^- update:store - [%0 now.bowl [%add-graph resource graph ~]] + [%0 now.bowl [%add-graph resource graph mark]] :: resubscribe :: :: TODO: use action-log diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index c59321be3f..cad87053d7 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -77,9 +77,6 @@ %archive-graph (archive-graph +.q.update) %unarchive-graph (unarchive-graph +.q.update) %run-updates (run-updates +.q.update) - :: - :: NOTE: cannot send these updates as pokes - :: %keys ~|('cannot send %keys as poke' !!) %tags ~|('cannot send %tags as poke' !!) %tag-queries ~|('cannot send %tag-queries as poke' !!) @@ -95,7 +92,6 @@ graphs (~(put by graphs) resource [graph mark]) update-logs (~(put by update-logs) resource (gas:orm-log ~ ~)) == - ^- (list card) %- zing :~ (give [/updates /keys ~] [%add-graph resource graph mark]) ?~ mark ~ @@ -437,23 +433,26 @@ [%x %graph @ @ ~] =/ =ship (slav %p i.t.t.path) =/ =term i.t.t.t.path - =/ graph=(unit [graph:store *]) (~(get by graphs) [ship term]) - ?~ graph ~ - ``noun+!>(-.u.graph) + =/ result=(unit marked-graph:store) + (~(get by graphs) [ship term]) + ?~ result ~ + ``noun+!>(u.result) :: [%x %graph-subset @ @ @ @ ~] - =/ =ship (slav %p i.t.t.path) - =/ =term i.t.t.t.path + =/ =ship (slav %p i.t.t.path) + =/ =term i.t.t.t.path =/ start=(unit atom:store) (rush i.t.t.t.t.path dem:ag) =/ end=(unit atom:store) (rush i.t.t.t.t.t.path dem:ag) - =/ graph=(unit [graph:store *]) (~(get by graphs) [ship term]) + =/ graph=(unit marked-graph:store) + (~(get by graphs) [ship term]) ?~ graph ~ - ``noun+!>(`graph:store`(subset:orm -.u.graph start end)) + ``noun+!>(`graph:store`(subset:orm p.u.graph start end)) :: [%x %node @ @ @ *] - =/ =ship (slav %p i.t.t.path) - =/ =term i.t.t.t.path - =/ =index:store (turn t.t.t.t.path |=(=cord (slav %ud cord))) + =/ =ship (slav %p i.t.t.path) + =/ =term i.t.t.t.path + =/ =index:store + (turn t.t.t.t.path |=(=cord (slav %ud cord))) =/ node=(unit node:store) (get-node ship term index) ?~ node ~ ``noun+!>(u.node) @@ -461,15 +460,17 @@ [%x %post @ @ @ *] =/ =ship (slav %p i.t.t.path) =/ =term i.t.t.t.path - =/ =index:store (turn t.t.t.t.path |=(=cord (slav %ud cord))) + =/ =index:store + (turn t.t.t.t.path |=(=cord (slav %ud cord))) =/ node=(unit node:store) (get-node ship term index) ?~ node ~ ``noun+!>(post.u.node) :: [%x %node-children @ @ @ *] - =/ =ship (slav %p i.t.t.path) - =/ =term i.t.t.t.path - =/ =index:store (turn t.t.t.t.path |=(=cord (slav %ud cord))) + =/ =ship (slav %p i.t.t.path) + =/ =term i.t.t.t.path + =/ =index:store + (turn t.t.t.t.path |=(=cord (slav %ud cord))) =/ node=(unit node:store) (get-node ship term index) ?~ node ~ ?- -.children.u.node @@ -478,11 +479,12 @@ == :: [%x %node-children-subset @ @ @ @ @ *] - =/ =ship (slav %p i.t.t.path) - =/ =term i.t.t.t.path + =/ =ship (slav %p i.t.t.path) + =/ =term i.t.t.t.path =/ start=(unit atom:store) (rush i.t.t.t.t.path dem:ag) =/ end=(unit atom:store) (rush i.t.t.t.t.t.path dem:ag) - =/ =index:store (turn t.t.t.t.t.t.path |=(=cord (slav %ud cord))) + =/ =index:store + (turn t.t.t.t.t.t.path |=(=cord (slav %ud cord))) =/ node=(unit node:store) (get-node ship term index) ?~ node ~ ?- -.children.u.node @@ -511,10 +513,11 @@ ++ get-node |= [=ship =term =index:store] ^- (unit node:store) - =/ parent-graph=(unit [graph:store *]) (~(get by graphs) [ship term]) + =/ parent-graph=(unit marked-graph:store) + (~(get by graphs) [ship term]) ?~ parent-graph ~ =/ node=(unit node:store) ~ - =/ =graph:store -.u.parent-graph + =/ =graph:store p.u.parent-graph |- ?~ index node diff --git a/pkg/arvo/app/graph-view.hoon b/pkg/arvo/app/graph-view.hoon index 679763bff0..3dd1b03a64 100644 --- a/pkg/arvo/app/graph-view.hoon +++ b/pkg/arvo/app/graph-view.hoon @@ -1,7 +1,7 @@ /+ view=graph-view /+ store=graph-store /+ sigs=signatures -/+ grph=graph +/+ graph /+ default-agent /+ dbug ~% %graph-view-top ..is ~ @@ -26,7 +26,7 @@ |_ =bowl:gall +* this . def ~(. (default-agent this %|) bowl) - gra ~(. grph bowl) + gra ~(. graph bowl) :: ++ on-init ^- (quip card _this) diff --git a/pkg/arvo/lib/graph.hoon b/pkg/arvo/lib/graph.hoon index 870cb82bd4..395c0554fa 100644 --- a/pkg/arvo/lib/graph.hoon +++ b/pkg/arvo/lib/graph.hoon @@ -13,8 +13,9 @@ :: ++ get-graph |= res=resource - ^- graph:store - (scry-for graph:store /graph/(scot %p entity.res)/[name.res]) + ^- marked-graph:store + %+ scry-for marked-graph:store + /graph/(scot %p entity.res)/[name.res] :: ++ peek-log |= res=resource diff --git a/pkg/arvo/sur/graph-store.hoon b/pkg/arvo/sur/graph-store.hoon index c79261f876..b674d22cfa 100644 --- a/pkg/arvo/sur/graph-store.hoon +++ b/pkg/arvo/sur/graph-store.hoon @@ -8,13 +8,17 @@ ?> (check-balance:((ordered-map key value) ord) b) b :: -+$ mark term -+$ graph ((mop atom node) gth) -+$ node [=post children=internal-graph] -+$ graphs (map resource [p=graph q=(unit mark)]) -+$ tag-queries (jug term resource) -+$ update-log ((mop time logged-update) gth) -+$ update-logs (map resource update-log) ++$ mark term ++$ graph ((mop atom node) gth) ++$ marked-graph [p=graph q=(unit mark)] +:: ++$ node [=post children=internal-graph] ++$ graphs (map resource marked-graph) +:: ++$ tag-queries (jug term resource) +:: ++$ update-log ((mop time logged-update) gth) ++$ update-logs (map resource update-log) :: +$ internal-graph $~ [%empty ~]