From 83ec7eae246f4962cdac2d397191fb0eca224d49 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Tue, 2 Jun 2020 15:44:22 -0400 Subject: [PATCH] graph-store: cleaned up structures --- pkg/arvo/app/graph-store.hoon | 1 - pkg/arvo/sur/graph-store.hoon | 26 +++++++++++++++++++------- pkg/arvo/sur/post.hoon | 26 ++++++++++++++++++++++++++ pkg/arvo/sur/resource.hoon | 10 ++++++++++ 4 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 pkg/arvo/sur/post.hoon create mode 100644 pkg/arvo/sur/resource.hoon diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index f974d86288..8a02cf243a 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -5,7 +5,6 @@ $% state-0 == +$ state-0 [%0 network:store] -++ ordered-graph ((ordered-map ,time ,node:store) gth) -- :: =| state-0 diff --git a/pkg/arvo/sur/graph-store.hoon b/pkg/arvo/sur/graph-store.hoon index cb6ce7e417..83e3c0de61 100644 --- a/pkg/arvo/sur/graph-store.hoon +++ b/pkg/arvo/sur/graph-store.hoon @@ -1,23 +1,35 @@ /- *post |% +++ mop + |* [key=mold value=mold] + |= ord=$-([key key] ?) + |= a=* + =/ b ;;((tree [key=key val=value]) a) + ?> (check-balance:((ordered-map key value) ord) b) + b +:: +$ network $: graphs=(map resource graph) tags=(set term) tag-queries=(map term resources) == :: -+$ internal-graph (tree [key=time val=node]) -+$ graph - $~ [%empty ~] - $% [%graph u=internal-graph] - [%empty ~] ++$ graph ((mop atom node) lte) ++$ internal-graph + $~ [%not-loaded ~] + $% :: + :: a graph and timestamp of when it was last modified + [%graph p=graph q=time] + [%empty-when-fetched p=time] + [%not-loaded ~] == -+$ node [=post replies=graph] +:: ++$ node [=post children=internal-graph] +$ action $% [%add-graph =resource =graph] [%remove-graph =resource] :: - [%add-nodes uids=(set [=uid =node])] + [%add-nodes nodes=(map uid node)] [%remove-nodes uids=(set uid)] :: [%add-signatures =uid =signatures] diff --git a/pkg/arvo/sur/post.hoon b/pkg/arvo/sur/post.hoon new file mode 100644 index 0000000000..72905b43ef --- /dev/null +++ b/pkg/arvo/sur/post.hoon @@ -0,0 +1,26 @@ +/- *resource +|% ++$ atom @ ++$ index (list atom) ++$ uid [=resource =index] +:: ++$ hash @ux ++$ signature @ux ++$ signatures (set signature) ++$ post + $: author=ship + =hash + =index + contents=(list content) + signatures=[p=signatures q=hash] + time-sent=time + == +:: ++$ content + $% [%text =cord] + [%url =cord] + [%code expression=cord output=(list tank)] + [%reference =uid] + :: [%cage =cage] + == +-- diff --git a/pkg/arvo/sur/resource.hoon b/pkg/arvo/sur/resource.hoon new file mode 100644 index 0000000000..c4a43ddba1 --- /dev/null +++ b/pkg/arvo/sur/resource.hoon @@ -0,0 +1,10 @@ +|% ++$ resource [=entity =term] ++$ resources (set resource) +:: ++$ entity + $@ ship + $% [%ships ships=(set ship)] + :: [%ring ...] + == +--