mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 04:48:00 +03:00
100 lines
2.2 KiB
Plaintext
100 lines
2.2 KiB
Plaintext
/- *resource
|
|
/+ store=graph-store
|
|
|_ =bowl:gall
|
|
++ scry-for
|
|
|* [=mold =path]
|
|
.^ mold
|
|
%gx
|
|
(scot %p our.bowl)
|
|
%graph-store
|
|
(scot %da now.bowl)
|
|
(snoc `^path`path %noun)
|
|
==
|
|
::
|
|
++ get-graph
|
|
|= res=resource
|
|
^- update:store
|
|
%+ scry-for update:store
|
|
/graph/(scot %p entity.res)/[name.res]
|
|
::
|
|
++ get-graph-mop
|
|
|= res=resource
|
|
^- graph:store
|
|
=/ =update:store
|
|
(get-graph res)
|
|
?> ?=(%0 -.res)
|
|
?> ?=(%add-graph -.q.update)
|
|
graph.q.update
|
|
::
|
|
++ gut-younger-node-siblings
|
|
|= [res=resource =index:store]
|
|
^- (map index:store node:store)
|
|
=+ %+ scry-for ,=update:store
|
|
%+ weld
|
|
/node-siblings/younger/(scot %p entity.res)/[name.res]/all
|
|
(turn index (cury scot %ud))
|
|
?> ?=(%0 -.update)
|
|
?> ?=(%add-nodes -.q.update)
|
|
nodes.q.update
|
|
::
|
|
++ got-node
|
|
|= [res=resource =index:store]
|
|
^- node:store
|
|
=+ %+ scry-for ,=update:store
|
|
%+ weld
|
|
/node/(scot %p entity.res)/[name.res]
|
|
(turn index (cury scot %ud))
|
|
?> ?=(%0 -.update)
|
|
?> ?=(%add-nodes -.q.update)
|
|
?> ?=(^ nodes.q.update)
|
|
q.n.nodes.q.update
|
|
::
|
|
++ get-update-log
|
|
|= rid=resource
|
|
^- update-log:store
|
|
%+ scry-for update-log:store
|
|
/update-log/(scot %p entity.rid)/[name.rid]
|
|
::
|
|
++ peek-update-log
|
|
|= res=resource
|
|
^- (unit time)
|
|
(scry-for (unit time) /peek-update-log/(scot %p entity.res)/[name.res])
|
|
::
|
|
++ get-update-log-subset
|
|
|= [res=resource start=@da]
|
|
^- update-log:store
|
|
%+ scry-for update-log:store
|
|
/update-log-subset/(scot %p entity.res)/[name.res]/(scot %da start)/'~'
|
|
::
|
|
++ get-keys
|
|
^- resources
|
|
=+ %+ scry-for ,=update:store
|
|
/keys
|
|
?> ?=(%0 -.update)
|
|
?> ?=(%keys -.q.update)
|
|
resources.q.update
|
|
::
|
|
++ tap-deep
|
|
|= =graph:store
|
|
^- (list [index:store node:store])
|
|
=| =index:store
|
|
=/ nodes=(list [atom node:store])
|
|
(tap:orm:store graph)
|
|
|- =* tap-nodes $
|
|
^- (list [index:store node:store])
|
|
%- zing
|
|
%+ turn
|
|
nodes
|
|
|= [=atom =node:store]
|
|
^- (list [index:store node:store])
|
|
%+ welp
|
|
^- (list [index:store node:store])
|
|
[(snoc index atom) node]~
|
|
?. ?=(%graph -.children.node)
|
|
~
|
|
%_ tap-nodes
|
|
index (snoc index atom)
|
|
nodes (tap:orm:store p.children.node)
|
|
==
|
|
--
|