Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/interface.py
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | class RelationData: | ||||
dst: Sha1Git | dst: Sha1Git | ||||
path: Optional[bytes] | path: Optional[bytes] | ||||
@runtime_checkable | @runtime_checkable | ||||
class ProvenanceStorageInterface(Protocol): | class ProvenanceStorageInterface(Protocol): | ||||
@remote_api_endpoint("content_add") | @remote_api_endpoint("content_add") | ||||
def content_add( | def content_add( | ||||
self, cnts: Union[Iterable[Sha1Git], Dict[Sha1Git, datetime]] | self, cnts: Union[Iterable[Sha1Git], Dict[Sha1Git, Optional[datetime]]] | ||||
) -> bool: | ) -> bool: | ||||
"""Add blobs identified by sha1 ids, with an optional associated date (as paired | """Add blobs identified by sha1 ids, with an optional associated date (as paired | ||||
in `cnts`) to the provenance storage. Return a boolean stating whether the | in `cnts`) to the provenance storage. Return a boolean stating whether the | ||||
information was successfully stored. | information was successfully stored. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("content_find_first") | @remote_api_endpoint("content_find_first") | ||||
Show All 12 Lines | class ProvenanceStorageInterface(Protocol): | ||||
def content_get(self, ids: Iterable[Sha1Git]) -> Dict[Sha1Git, datetime]: | def content_get(self, ids: Iterable[Sha1Git]) -> Dict[Sha1Git, datetime]: | ||||
"""Retrieve the associated date for each blob sha1 in `ids`. If some blob has | """Retrieve the associated date for each blob sha1 in `ids`. If some blob has | ||||
no associated date, it is not present in the resulting dictionary. | no associated date, it is not present in the resulting dictionary. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("directory_add") | @remote_api_endpoint("directory_add") | ||||
def directory_add( | def directory_add( | ||||
self, dirs: Union[Iterable[Sha1Git], Dict[Sha1Git, datetime]] | self, dirs: Union[Iterable[Sha1Git], Dict[Sha1Git, Optional[datetime]]] | ||||
) -> bool: | ) -> bool: | ||||
"""Add directories identified by sha1 ids, with an optional associated date (as | """Add directories identified by sha1 ids, with an optional associated date (as | ||||
paired in `dirs`) to the provenance storage. Return a boolean stating if the | paired in `dirs`) to the provenance storage. Return a boolean stating if the | ||||
information was successfully stored. | information was successfully stored. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("directory_get") | @remote_api_endpoint("directory_get") | ||||
▲ Show 20 Lines • Show All 223 Lines • Show Last 20 Lines |