Merge pull request #4795 from urbit/la/fast-index

graph-store, metadata-store lib: skip trip and crip, use rap
This commit is contained in:
L 2021-04-23 14:36:57 -05:00 committed by GitHub
commit f11a66a381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 18 deletions

View File

@ -145,18 +145,17 @@
==
::
++ index
|= i=^index
|= ind=^index
^- json
?: =(~ i) s+'/'
=/ j=^tape ""
|-
?~ i [%s (crip j)]
=/ k=json (numb i.i)
?> ?=(%n -.k)
%_ $
i t.i
j (weld j (weld "/" (trip +.k)))
==
:- %s
?: =(~ ind)
'/'
%+ roll ind
|= [cur=@ acc=@t]
^- @t
=/ num (numb cur)
?> ?=(%n -.num)
(rap 3 acc '/' p.num ~)
::
++ uid
|= u=^uid

View File

@ -23,13 +23,13 @@
%+ turn ~(tap by associations)
|= [=md-resource [group=resource =^metadatum]]
^- [cord json]
:-
%- crip
;: weld
(trip (spat (en-path:resource group)))
(weld "/" (trip app-name.md-resource))
(trip (spat (en-path:resource resource.md-resource)))
==
:- %: rap 3
(spat (en-path:resource group))
'/'
app-name.md-resource
(spat (en-path:resource resource.md-resource))
~
==
%- pairs
:~ [%group s+(enjs-path:resource group)]
[%app-name s+app-name.md-resource]