sources: rename download -> fetch_all
Not all sources download things and `fetch_all` is consistent with `fetch_one`.
This commit is contained in:
parent
382ac8e960
commit
f9b55ff6a0
6 changed files with 8 additions and 8 deletions
|
|
@ -67,8 +67,8 @@ class SourceService(host.Service):
|
|||
"""Performs the actual fetch of an element described by its checksum and its descriptor"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def download(self, items: Dict) -> None:
|
||||
"""Download all sources."""
|
||||
def fetch_all(self, items: Dict) -> None:
|
||||
"""Fetch all sources."""
|
||||
|
||||
def exists(self, checksum, _desc) -> bool:
|
||||
"""Returns True if the item to download is in cache. """
|
||||
|
|
@ -94,7 +94,7 @@ class SourceService(host.Service):
|
|||
if method == "download":
|
||||
self.setup(args)
|
||||
with tempfile.TemporaryDirectory(prefix=".unverified-", dir=self.cache) as self.tmpdir:
|
||||
self.download(SourceService.load_items(fds))
|
||||
self.fetch_all(SourceService.load_items(fds))
|
||||
return None, None
|
||||
|
||||
raise host.ProtocolError("Unknown method")
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class CurlSource(sources.SourceService):
|
|||
quoted = purl._replace(path=path)
|
||||
return quoted.geturl()
|
||||
|
||||
def download(self, items: Dict) -> None:
|
||||
def fetch_all(self, items: Dict) -> None:
|
||||
filtered = filter(lambda i: not self.exists(i[0], i[1]), items.items()) # discards items already in cache
|
||||
transformed = map(lambda i: self.transform(i[0], i[1]), filtered) # prepare each item to be downloaded
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class InlineSource(sources.SourceService):
|
|||
|
||||
content_type = "org.osbuild.files"
|
||||
|
||||
def download(self, items: Dict) -> None:
|
||||
def fetch_all(self, items: Dict) -> None:
|
||||
filtered = filter(lambda i: not self.exists(i[0], i[1]), items.items()) # discards items already in cache
|
||||
transformed = map(lambda i: self.transform(i[0], i[1]), filtered) # prepare each item to be downloaded
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class OSTreeSource(sources.SourceService):
|
|||
super().__init__(*args, **kwargs)
|
||||
self.repo = None
|
||||
|
||||
def download(self, items: Dict) -> None:
|
||||
def fetch_all(self, items: Dict) -> None:
|
||||
filtered = filter(lambda i: not self.exists(i[0], i[1]), items.items()) # discards items already in cache
|
||||
transformed = map(lambda i: self.transform(i[0], i[1]), filtered) # prepare each item to be downloaded
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class SkopeoSource(sources.SourceService):
|
|||
return f"containers-storage:{reference}"
|
||||
raise RuntimeError("Unrecognized containers transport")
|
||||
|
||||
def download(self, items: Dict) -> None:
|
||||
def fetch_all(self, items: Dict) -> None:
|
||||
filtered = filter(lambda i: not self.exists(i[0], i[1]), items.items()) # discards items already in cache
|
||||
transformed = map(lambda i: self.transform(i[0], i[1]), filtered) # prepare each item to be downloaded
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class SkopeoIndexSource(sources.SourceService):
|
|||
return f"containers-storage:{reference}"
|
||||
raise RuntimeError("Unrecognized containers transport")
|
||||
|
||||
def download(self, items: Dict) -> None:
|
||||
def fetch_all(self, items: Dict) -> None:
|
||||
filtered = filter(lambda i: not self.exists(i[0], i[1]), items.items()) # discards items already in cache
|
||||
transformed = map(lambda i: self.transform(i[0], i[1]), filtered) # prepare each item to be downloaded
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue