Skip to content
Snippets Groups Projects

Normalize _add() methods of the ProvenanceStorage interface

2 unresolved threads

make them all accept a Dict[Sha1Git, xxx] as argument, ie:

  • remove support for Iterable[bytes] in revision_add, and
  • replace Iterable[bytes] by Dict[Sha1Git, bytes] for location_add

Currently, the sha1 of location path in location_add() is not really used by any backend, so the computation of said hashed is a waste of resource, but it makes the API of this interface much more consistent which will be helpful for coming features (like kafka journal).

Related to #4616 (closed)


Migrated from D8656 (view on Phabricator)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
4 4 # See top-level LICENSE file for more information
5 5
6 6 from datetime import datetime
7 import hashlib
  • I'm not a huge fan of import ... from with stdlib modules in general, but here in particular there is the extra issue of sha1 being a common variable name

    (and then you can undo the variable name change below)

  • Author Maintainer

    yeah I guess you are right, let me change this (thx)

  • Please register or sign in to reply
  • vlorentz
    vlorentz @vlorentz started a thread on the diff
  • 4 4 # See top-level LICENSE file for more information
    5 5
    6 6 from datetime import datetime, timezone
    7 import hashlib
  • vlorentz mentioned in merge request !153 (closed)

    mentioned in merge request !153 (closed)

  • Merge request was accepted

  • vlorentz approved this merge request

    approved this merge request

  • Author Maintainer

    apply vlorentz' comments

  • Build is green

    Patch application report for D8656 (id=31270)

    Rebasing onto 6f4a193e...

    Current branch diff-target is up to date.
    Changes applied before test
    commit 2bd74fc7d97d40d7132a6530cd0078e3ffb8c614
    Author: David Douard <david.douard@sdfa3.org>
    Date:   Fri Oct 7 14:51:09 2022 +0200
    
        Normalize _add() methods of the ProvenanceStorage interface
        
        make them all accept a Dict[Sha1Git, xxx] as argument, ie:
        
        - remove support for Iterable[bytes] in revision_add, and
        - replace Iterable[bytes] by Dict[Sha1Git, bytes] for location_add
        
        Currently, the sha1 of location path in location_add() is not really
        used by any backend, so the computation of said hashed is a waste of
        resource, but it makes the API of this interface much more consistent
        which will be helpful for coming features (like kafka journal).

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

  • Author Maintainer

    also rename ProvenanceInterface.directory_xxx_flattenned as directory_xxx_flattened

    (included in this Diff by lazyness)

  • Build is green

    Patch application report for D8656 (id=31273)

    Rebasing onto 6f4a193e...

    Current branch diff-target is up to date.
    Changes applied before test
    commit 7e6a62c990b76ac63ee53be1f4c1c147bba4b806
    Author: David Douard <david.douard@sdfa3.org>
    Date:   Tue Oct 11 16:30:46 2022 +0200
    
        Rename ProvenanceInterface.directory_xxx_flattenned as directory_xxx_flattened
        
        and fix all occurrences of the typo.
    
    commit 2bd74fc7d97d40d7132a6530cd0078e3ffb8c614
    Author: David Douard <david.douard@sdfa3.org>
    Date:   Fri Oct 7 14:51:09 2022 +0200
    
        Normalize _add() methods of the ProvenanceStorage interface
        
        make them all accept a Dict[Sha1Git, xxx] as argument, ie:
        
        - remove support for Iterable[bytes] in revision_add, and
        - replace Iterable[bytes] by Dict[Sha1Git, bytes] for location_add
        
        Currently, the sha1 of location path in location_add() is not really
        used by any backend, so the computation of said hashed is a waste of
        resource, but it makes the API of this interface much more consistent
        which will be helpful for coming features (like kafka journal).

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

  • Author Maintainer

    Merge request was merged

  • closed

  • Please register or sign in to reply
    Loading