From 87a5de919faae31f1d3b4510055fdd9e6d01e578 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Fri, 4 Jun 2021 13:21:40 -0500 Subject: [PATCH] userspace: adding a variety of casts to avoid nest checks --- pkg/arvo/app/contact-store.hoon | 9 ++++----- pkg/arvo/app/graph-store.hoon | 8 ++++---- pkg/arvo/app/metadata-store.hoon | 16 ++++++++++++---- pkg/arvo/app/settings-store.hoon | 10 +++++----- pkg/arvo/lib/contact.hoon | 2 ++ 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 8f39e7540..e3f750715 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -233,7 +233,7 @@ |= =path ^- (unit (unit cage)) ?+ path (on-peek:def path) - [%x %all ~] ``noun+!>(rolodex) + [%x %all ~] ``noun+!>(`rolodex:store`rolodex) :: [%x %contact @ ~] =/ =ship (slav %p i.t.t.path) @@ -245,14 +245,13 @@ :: [%x %allowed-ship @ ~] =/ =ship (slav %p i.t.t.path) - ``noun+!>((~(has in allowed-ships) ship)) + ``noun+!>(`?`(~(has in allowed-ships) ship)) :: [%x %is-public ~] - ``noun+!>(is-public) + ``noun+!>(`?`is-public) :: [%x %allowed-groups ~] - ``noun+!>(allowed-groups) - + ``noun+!>(`(set resource)`allowed-groups) :: [%x %is-allowed @ @ @ @ ~] =/ is-personal =(i.t.t.t.t.t.path 'true') diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index cf9e84ea4..f2e611903 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -676,7 +676,7 @@ =/ result=(unit marked-graph:store) (~(get by graphs) [ship term]) ?~ result [~ ~] - ``noun+!>(q.u.result) + ``noun+!>(`(unit mark)`q.u.result) :: [%x %keys ~] :- ~ :- ~ :- %graph-update-2 @@ -745,7 +745,7 @@ (turn t.t.t.t.path (cury slav %ud)) =/ node=(unit node:store) (get-node ship term index) - ``noun+!>(?=(^ node)) + ``noun+!>(`?`?=(^ node)) :: [%x %node @ @ @ *] =/ =ship (slav %p i.t.t.path) @@ -973,14 +973,14 @@ =/ update-log=(unit update-log:store) (~(get by update-logs) [ship term]) ?~ update-log [~ ~] :: orm-log is ordered backwards, so swap start and end - ``noun+!>((lot:orm-log u.update-log end start)) + ``noun+!>(`update-log:store`(lot:orm-log u.update-log end start)) :: [%x %update-log @ @ ~] =/ =ship (slav %p i.t.t.path) =/ =term i.t.t.t.path =/ update-log=(unit update-log:store) (~(get by update-logs) [ship term]) ?~ update-log [~ ~] - ``noun+!>(u.update-log) + ``noun+!>(`update-log:store`u.update-log) :: [%x %peek-update-log @ @ ~] =/ =ship (slav %p i.t.t.path) diff --git a/pkg/arvo/app/metadata-store.hoon b/pkg/arvo/app/metadata-store.hoon index ed2322976..78e331bf0 100644 --- a/pkg/arvo/app/metadata-store.hoon +++ b/pkg/arvo/app/metadata-store.hoon @@ -194,10 +194,18 @@ |= =path ^- (unit (unit cage)) ?+ path (on-peek:def path) - [%y %group-indices ~] ``noun+!>(group-indices) - [%y %app-indices ~] ``noun+!>(app-indices) - [%y %resource-indices ~] ``noun+!>(resource-indices) - [%x %associations ~] ``noun+!>(associations) + [%y %group-indices ~] + ``noun+!>(`(jug resource md-resource:store)`group-indices) + :: + [%y %app-indices ~] + ``noun+!>(`(jug app-name:store [group=resource =resource])`app-indices) + :: + [%y %resource-indices ~] + ``noun+!>(`(map md-resource:store resource)`resource-indices) + :: + [%x %associations ~] + ``noun+!>(`associations:store`associations) + :: [%x %app-name @ ~] =/ =app-name:store i.t.t.path ``noun+!>(`associations:store`(metadata-for-app:mc app-name)) diff --git a/pkg/arvo/app/settings-store.hoon b/pkg/arvo/app/settings-store.hoon index 2dbb0778b..0350196d8 100644 --- a/pkg/arvo/app/settings-store.hoon +++ b/pkg/arvo/app/settings-store.hoon @@ -83,13 +83,13 @@ ^- (unit (unit cage)) ?+ pax (on-peek:def pax) [%x %all ~] - ``settings-data+!>(all+settings) + ``settings-data+!>(`data`all+settings) :: [%x %bucket @ ~] =* buc i.t.t.pax =/ bucket=(unit bucket) (~(get by settings) buc) ?~ bucket [~ ~] - ``settings-data+!>(bucket+u.bucket) + ``settings-data+!>(`data`bucket+u.bucket) :: [%x %entry @ @ ~] =* buc i.t.t.pax @@ -97,19 +97,19 @@ =/ =bucket (fall (~(get by settings) buc) ~) =/ entry=(unit val) (~(get by bucket) key) ?~ entry [~ ~] - ``settings-data+!>(entry+u.entry) + ``settings-data+!>(`data`entry+u.entry) :: [%x %has-bucket @ ~] =* buc i.t.t.pax =/ has-bucket=? (~(has by settings) buc) - ``noun+!>(has-bucket) + ``noun+!>(`?`has-bucket) :: [%x %has-entry @ @ ~] =* buc i.t.t.pax =* key i.t.t.t.pax =/ =bucket (fall (~(get by settings) buc) ~) =/ has-entry=? (~(has by bucket) key) - ``noun+!>(has-entry) + ``noun+!>(`?`has-entry) == :: ++ on-agent on-agent:def diff --git a/pkg/arvo/lib/contact.hoon b/pkg/arvo/lib/contact.hoon index 2f3c6106a..1db471888 100644 --- a/pkg/arvo/lib/contact.hoon +++ b/pkg/arvo/lib/contact.hoon @@ -42,6 +42,7 @@ (snoc rids [our.bowl %'']) -- ++ scry-sharing + ^- (set resource) .^ (set resource) %gx (scot %p our.bowl) @@ -58,6 +59,7 @@ (~(get by rolodex) ship) :: ++ scry-is-public + ^- ? .^ ? %gx (scot %p our.bowl)