graph-store: structure compiles

This commit is contained in:
Logan Allen 2020-06-01 17:07:31 -04:00
parent 4fded00005
commit fcfcf95aed
2 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,73 @@
/+ store=graph-store, default-agent, dbug
|%
+$ card card:agent:gall
+$ versioned-state
$% state-0
==
+$ state-0 [%0 network:store]
++ ordered-graph ((ordered-map ,time ,node:store) gth)
--
::
=| state-0
=* state -
::
%- agent:dbug
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init [~ this]
++ on-save !>(state)
++ on-load
|= old=vase
^- (quip card _this)
[~ this(state !<(state-0 old))]
::
++ on-poke
|= [=mark =vase]
^- (quip card _this)
|^
?> (team:title our.bowl src.bowl)
=^ cards state
?+ mark (on-poke:def mark vase)
%graph-action (graph-action !<(action:store vase))
==
[cards this]
::
++ graph-action
|= =action:store
^- (quip card _state)
[~ state]
--
::
++ on-watch
|= =path
^- (quip card _this)
|^
?> (team:title our.bowl src.bowl)
=/ cards=(list card)
?+ path (on-watch:def path)
[%all ~] (give [%initial graphs tags tag-queries])
[%keys ~] (give [%keys ~(key by graphs)])
==
[cards this]
::
++ give
|= =update:store
^- (list card)
[%give %fact ~ [%graph-update !>(update)]]~
--
::
++ on-peek
|= =path
^- (unit (unit cage))
?+ path (on-peek:def path)
[%x %keys ~] ``noun+!>(~(key by graphs))
==
::
++ on-arvo on-arvo:def
++ on-agent on-agent:def
++ on-leave on-leave:def
++ on-fail on-fail:def
--

View File

@ -0,0 +1,35 @@
/- *post
|%
+$ 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 ~]
==
+$ node [=post replies=graph]
+$ action
$% [%add-graph =resource =graph]
[%remove-graph =resource]
::
[%add-nodes uids=(set [=uid =node])]
[%remove-nodes uids=(set uid)]
::
[%add-signatures =uid =signatures]
[%remove-signatures =uid =signatures]
::
[%add-tag =term =resources]
[%remove-tag =term =resources]
==
::
+$ update
$% [%keys =resources]
[%initial =network]
action
==
--