new queries to find dir/occurrence of some content
queries:
- swh_content_find_directory(content_id sha1): content_dir
- swh_revision_find_occurrence(revision_id sha1_git): occurrence
Sample use:
zack-linuxgit-arrays=> select sha1 from content offset 100000 limit 1;
sha1
\xdd63ccef43879c3d7ea47c3f637ef2453f7a58a1
(1 row)
Time: 21,751 ms
zack-linuxgit-arrays=> select * from swh_content_find_directory('\xdd63ccef43879c3d7ea47c3f637ef2453f7a58a1'::sha1);
directory | path
--------------------------------------------+----------------------------
\x24f14db9cc7aa0b106dcb09c9927dfa6712dfd1e | drivers/md/dm-log-writes.c
(1 row)
Time: 729,122 ms
zack-linuxgit-arrays=> select id from revision where directory = '\x24f14db9cc7aa0b106dcb09c9927dfa6712dfd1e'::sha1_git;
id
\x0450b2d120ed9e6d4ac7a6eade0ad116f69b88f7
(1 row)
Time: 395,754 ms
zack-linuxgit-arrays=> select * from swh_revision_find_occurrence('\x0450b2d120ed9e6d4ac7a6eade0ad116f69b88f7'::sha1_git);
origin | branch | revision
--------+--------------------+--------------------------------------------
1 | refs/tags/v4.1-rc3 | \x030bbdbf4c833bc69f502eae58498bc5572db736
(1 row)
Time: 22,006 ms
zack-linuxgit-arrays=>