mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
graph-store: added archiving functionality
This commit is contained in:
parent
634b0d1175
commit
a245a1b095
@ -54,6 +54,8 @@
|
||||
%remove-signatures (remove-signatures +>.action)
|
||||
%add-tag (add-tag +>.action)
|
||||
%remove-tag (remove-tag +>.action)
|
||||
%archive-graph (archive-graph +>.action)
|
||||
%unarchive-graph (unarchive-graph +>.action)
|
||||
==
|
||||
::
|
||||
++ add-graph
|
||||
@ -293,6 +295,30 @@
|
||||
tag-queries (~(del ju tag-queries) term resource)
|
||||
==
|
||||
::
|
||||
++ archive-graph
|
||||
|= =resource:store
|
||||
^- (quip card _state)
|
||||
?< (~(has by archive) resource)
|
||||
?> (~(has by graphs) resource)
|
||||
:- (give [/updates /keys ~] [%archive-graph resource])
|
||||
%_ state
|
||||
archive (~(put by archive) resource (~(got by graphs) resource))
|
||||
graphs (~(del by graphs) resource)
|
||||
action-logs (~(del by action-logs) resource)
|
||||
==
|
||||
::
|
||||
++ unarchive-graph
|
||||
|= =resource:store
|
||||
^- (quip card _state)
|
||||
?> (~(has by archive) resource)
|
||||
?< (~(has by graphs) resource)
|
||||
:- (give [/updates /keys ~] [%unarchive-graph resource])
|
||||
%_ state
|
||||
archive (~(del by archive) resource)
|
||||
graphs (~(put by graphs) resource (~(got by archive) resource))
|
||||
action-logs (~(put by action-logs) resource (gas:orm-log ~ ~))
|
||||
==
|
||||
::
|
||||
++ give
|
||||
|= [paths=(list path) update=update-0:store]
|
||||
^- (list card)
|
||||
|
10
pkg/arvo/gen/graph-store/archive-graph.hoon
Normal file
10
pkg/arvo/gen/graph-store/archive-graph.hoon
Normal file
@ -0,0 +1,10 @@
|
||||
:: graph-store|archive-graph: archive graph
|
||||
::
|
||||
/- *graph-store
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource ~] ~]
|
||||
==
|
||||
:- %graph-action
|
||||
^- action
|
||||
[%0 [%archive-graph resource]]
|
10
pkg/arvo/gen/graph-store/unarchive-graph.hoon
Normal file
10
pkg/arvo/gen/graph-store/unarchive-graph.hoon
Normal file
@ -0,0 +1,10 @@
|
||||
:: graph-store|unarchive-graph: unarchive graph
|
||||
::
|
||||
/- *graph-store
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ =beak]
|
||||
[[=resource ~] ~]
|
||||
==
|
||||
:- %graph-action
|
||||
^- action
|
||||
[%0 [%unarchive-graph resource]]
|
@ -98,6 +98,12 @@
|
||||
:~ [%term s+term.upd]
|
||||
[%resource (enjs:res resource.upd)]
|
||||
==
|
||||
::
|
||||
%archive-graph
|
||||
[%archive-graph (enjs:res resource.upd)]
|
||||
::
|
||||
%unarchive-graph
|
||||
[%unarchive-graph (enjs:res resource.upd)]
|
||||
==
|
||||
::
|
||||
++ graph
|
||||
@ -107,8 +113,6 @@
|
||||
%+ turn (tap:orm g)
|
||||
|= [a=atom n=^node]
|
||||
^- json
|
||||
:: experiment at making JSON structure more closely represent Map
|
||||
:: input
|
||||
:- %a
|
||||
:~ (index [a]~)
|
||||
(node n)
|
||||
@ -181,7 +185,6 @@
|
||||
%+ turn ~(tap by m)
|
||||
|= [n=^index o=^node]
|
||||
^- json
|
||||
:: experiment, more closely represent Map structure
|
||||
:- %a
|
||||
:~ (index n)
|
||||
(node o)
|
||||
@ -236,6 +239,8 @@
|
||||
[%remove-signatures remove-signatures]
|
||||
[%add-tag add-tag]
|
||||
[%remove-tag remove-tag]
|
||||
[%archive-graph archive-graph]
|
||||
[%unarchive-graph unarchive-graph]
|
||||
==
|
||||
::
|
||||
++ add-graph
|
||||
@ -256,6 +261,8 @@
|
||||
[(rash b dem) c]
|
||||
::
|
||||
++ remove-graph (ot [%resource dejs:res]~)
|
||||
++ archive-graph (ot [%resource dejs:res]~)
|
||||
++ unarchive-graph (ot [%resource dejs:res]~)
|
||||
::
|
||||
++ add-nodes
|
||||
%- ot
|
||||
|
@ -15,6 +15,7 @@
|
||||
$: =graphs
|
||||
=tag-queries
|
||||
=action-logs
|
||||
archive=graphs
|
||||
==
|
||||
::
|
||||
+$ action-log ((mop time action) lth)
|
||||
@ -45,6 +46,9 @@
|
||||
::
|
||||
[%add-tag =term =resource]
|
||||
[%remove-tag =term =resource]
|
||||
::
|
||||
[%archive-graph =resource]
|
||||
[%unarchive-graph =resource]
|
||||
==
|
||||
::
|
||||
+$ update
|
||||
|
@ -31,6 +31,7 @@
|
||||
[%url url=cord]
|
||||
[%code expression=cord output=(list tank)]
|
||||
[%reference =uid]
|
||||
:: [%cage =cage]
|
||||
:: TODO: maybe use a cask?
|
||||
::[%cage =cage]
|
||||
==
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user