Page MenuHomeSoftware Heritage

Add endpoint raw_extrinsic_metadata_get_authorities
ClosedPublic

Authored by vlorentz on Jun 28 2021, 3:30 PM.

Details

Summary

This will make it easier for users of swh-web to discover metadata
on a given SWHID, as you otherwise need to specify an authority to
fetch metadata.

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D5934 (id=21308)

Rebasing onto ec2fac4478...

Current branch diff-target is up to date.
Changes applied before test
commit c5beb49a73cd0004459ceea736efe3d989037420
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jun 28 15:30:41 2021 +0200

    Add endpoint raw_extrinsic_metadata_get_authorities
    
    This will make it easier for users of swh-web to discover metadata
    on a given SWHID, as you otherwise need to specify an authority to
    fetch metadata.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1346/ for more details.

Looks good to me except I have a doubt on a parameter type (see inline comment). I will accept the diff after it has been checked.

swh/storage/postgresql/storage.py
1455 ↗(On Diff #21308)

That call to str(target) looks suspicious. I think it should rather be in db.raw_extrinsic_metadata_get_authorities(target.object_id, cur) but I might miss something here.

swh/storage/postgresql/storage.py
1455 ↗(On Diff #21308)

raw_extrinsic_metadata_* endpoints work on SWHIDs, not sha1_gits, so it's fine.

(Yes it's inconsistent with other methods of swh-storage, but it's easier to deal with multiple object types this way, and it keeps the table "standalone" if we want to break it out of swh-storage one day)

anlambert added inline comments.
swh/storage/postgresql/storage.py
1455 ↗(On Diff #21308)

Ack, why mypy did not yell here ? Sha1Git is an alias to bytes no ?

This revision is now accepted and ready to land.Jun 28 2021, 4:57 PM
swh/storage/postgresql/storage.py
1455 ↗(On Diff #21308)

About what? There are no Sha1Git or bytes here, just str and ExtendedSWHID

swh/storage/postgresql/storage.py
1455 ↗(On Diff #21308)

In db.py, the signature is the following: def raw_extrinsic_metadata_get_authorities(self, id: Sha1Git, cur=None):, so my initial doubt.

swh/storage/postgresql/storage.py
1455 ↗(On Diff #21308)

oh that's definitely a mistake. mypy doesn't see it because the db parameter has no type annotation

Build is green

Patch application report for D5934 (id=21315)

Rebasing onto ec2fac4478...

Current branch diff-target is up to date.
Changes applied before test
commit dd8a590b629dc322ef42c111ab710dce06f2542e
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jun 28 17:21:18 2021 +0200

    --amend

commit c5beb49a73cd0004459ceea736efe3d989037420
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jun 28 15:30:41 2021 +0200

    Add endpoint raw_extrinsic_metadata_get_authorities
    
    This will make it easier for users of swh-web to discover metadata
    on a given SWHID, as you otherwise need to specify an authority to
    fetch metadata.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1347/ for more details.

This revision was automatically updated to reflect the committed changes.