mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
graph-store: add shallow-children scry
This commit is contained in:
parent
64db58fa6f
commit
3f7d08285e
@ -748,6 +748,26 @@
|
||||
|= [=atom =node:store]
|
||||
^- [index:store node:store]
|
||||
[(snoc parent atom) node]
|
||||
::
|
||||
[%x %shallow-children @ @ *]
|
||||
=/ newest ?=(%newest i.t.path)
|
||||
=/ =ship (slav %p i.t.t.path)
|
||||
=/ =term i.t.t.t.path
|
||||
=/ =index:store
|
||||
(turn t.t.t.t.path (cury slav %ud))
|
||||
=/ children
|
||||
(get-node-children ship term index)
|
||||
?~ children [~ ~]
|
||||
:- ~ :- ~ :- %graph-update-1
|
||||
!> ^- update:store
|
||||
:+ now.bowl %add-nodes
|
||||
:- [ship term]
|
||||
%- ~(gas by *(map index:store node:store))
|
||||
%+ turn (tap:orm u.children)
|
||||
|= [=atom =node:store]
|
||||
^- [index:store node:store]
|
||||
:- index.post.node
|
||||
node(children [%empty ~])
|
||||
::
|
||||
[%x ?(%newest %oldest) @ @ @ *]
|
||||
=/ newest ?=(%newest i.t.path)
|
||||
|
@ -349,6 +349,14 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
this.store.handleEvent({ data });
|
||||
}
|
||||
|
||||
async getShallowChildren(ship: string, name: string, index = '') {
|
||||
const idx = index.split('/').map(decToUd).join('/');
|
||||
const data = await this.scry<any>('graph-store',
|
||||
`/shallow-children/${ship}/${name}${idx}`
|
||||
)
|
||||
this.store.handleEvent({ data });
|
||||
}
|
||||
|
||||
getGraphSubset(ship: string, resource: string, start: string, end: string) {
|
||||
return this.scry<any>(
|
||||
'graph-store',
|
||||
|
Loading…
Reference in New Issue
Block a user