Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/fossology_license.py
Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | class FossologyLicenseRangeIndexer( | ||||
""" | """ | ||||
def indexed_contents_in_range(self, start, end): | def indexed_contents_in_range(self, start, end): | ||||
"""Retrieve indexed content id within range [start, end]. | """Retrieve indexed content id within range [start, end]. | ||||
Args | Args | ||||
**start** (bytes): Starting bound from range identifier | **start** (bytes): Starting bound from range identifier | ||||
**end** (bytes): End range identifier | **end** (bytes): End range identifier | ||||
Yields: | Returns: | ||||
Content identifier (bytes) present in the range [start, end] | a dict with keys: | ||||
- **ids** [bytes]: iterable of content ids within the range. | |||||
- **next** (Optional[bytes]): The next range of sha1 starts at | |||||
this sha1 if any | |||||
""" | """ | ||||
while start: | return self.idx_storage.content_fossology_license_get_range( | ||||
result = self.idx_storage.content_fossology_license_get_range( | |||||
start, end, self.tool['id']) | start, end, self.tool['id']) | ||||
contents = result['ids'] | |||||
for _id in contents: | |||||
yield _id | |||||
start = result['next'] |