Class Fetcher
- Namespace
- ZeroInstall.Services.Fetchers
- Assembly
- ZeroInstall.Services.dll
Downloads Implementations, extracts them and adds them to an IImplementationStore.
public class Fetcher : IFetcher
- Inheritance
-
Fetcher
- Implements
- Inherited Members
Remarks
This class is immutable and thread-safe.
Constructors
Fetcher(Config, IImplementationStore, ITaskHandler)
Downloads Implementations, extracts them and adds them to an IImplementationStore.
public Fetcher(Config config, IImplementationStore store, ITaskHandler handler)
Parameters
configConfigUser settings controlling network behaviour, solving, etc.
storeIImplementationStoreThe location to store the downloaded and unpacked Implementations in.
handlerITaskHandlerA callback object used when the user needs to be informed about progress.
Remarks
This class is immutable and thread-safe.
Properties
Discovery
Discovers implementations in implementation stores on other machines in the local network instead of fetching them from their original source.
public IImplementationDiscovery? Discovery { get; set; }
Property Value
Methods
Apply(IBuilder, IRecipeStep, string)
Applies a retrieval method step.
protected virtual void Apply(IBuilder builder, IRecipeStep step, string tag)
Parameters
builderIBuilderThe builder used to build the implementation.
stepIRecipeStepInstructions for downloading the file.
tagstringA Tag used to group progress bars.
CheckArchiveTypes(IEnumerable<Archive>)
Infers missing MimeTypes and ensures suitable IArchiveExtractors are available.
protected void CheckArchiveTypes(IEnumerable<Archive> archives)
Parameters
archivesIEnumerable<Archive>
Exceptions
- NotSupportedException
No extractor registered for the specified or inferred MimeType.
Download(IBuilder, DownloadRetrievalMethod, string)
Applies a download step.
protected virtual void Download(IBuilder builder, DownloadRetrievalMethod download, string tag)
Parameters
builderIBuilderThe builder used to build the implementation.
downloadDownloadRetrievalMethodInstructions for downloading the file.
tagstringA Tag used to group progress bars.
Fetch(Implementation)
Downloads an Implementation to the IImplementationStore.
public void Fetch(Implementation implementation)
Parameters
implementationImplementationThe implementation to download.
Exceptions
- OperationCanceledException
A download or IO task was canceled from another thread.
- WebException
A file could not be downloaded from the internet.
- NotSupportedException
A file format, protocol, etc. is unknown or not supported.
- IOException
A downloaded file could not be written to the disk or extracted.
- UnauthorizedAccessException
Write access to IImplementationStore is not permitted.
- DigestMismatchException
An Implementation's Archives don't match the associated ManifestDigest.
Fetch(Implementation, string)
Downloads an Implementation to the IImplementationStore.
protected virtual void Fetch(Implementation implementation, string tag)
Parameters
implementationImplementationThe implementation to download.
tagstringA Tag used to group progress bars.
GetPath(ImplementationBase)
Determines the local path of an implementation.
protected string? GetPath(ImplementationBase implementation)
Parameters
implementationImplementationBase
Returns
- string
A fully qualified path to the directory containing the implementation;
nullif the requested implementation could not be found in the store or is a package implementation.
Retrieve(IReadOnlyCollection<IRecipeStep>, ManifestDigest, string)
Executes the steps of a retrieval method to build an implementation.
protected virtual void Retrieve(IReadOnlyCollection<IRecipeStep> steps, ManifestDigest manifestDigest, string tag)
Parameters
stepsIReadOnlyCollection<IRecipeStep>The retrieval method steps.
manifestDigestManifestDigestThe expected manifest digest of the implementation.
tagstringA Tag used to group progress bars.
Retrieve(RetrievalMethod, ManifestDigest, string)
Executes a retrieval method to build an implementation.
protected virtual void Retrieve(RetrievalMethod retrievalMethod, ManifestDigest manifestDigest, string tag)
Parameters
retrievalMethodRetrievalMethodThe retrieval method.
manifestDigestManifestDigestThe expected manifest digest of the implementation.
tagstringA Tag used to group progress bars.
Retrieve(ExternalRetrievalMethod)
Executes an external retrieval method.
protected virtual void Retrieve(ExternalRetrievalMethod retrievalMethod)
Parameters
retrievalMethodExternalRetrievalMethod
TryRetrieve(IEnumerable<RetrievalMethod>, ManifestDigest, string)
Tries one or more RetrievalMethods until one succeeds.
protected virtual void TryRetrieve(IEnumerable<RetrievalMethod> retrievalMethods, ManifestDigest manifestDigest, string tag)
Parameters
retrievalMethodsIEnumerable<RetrievalMethod>The available retrieval method.
manifestDigestManifestDigestThe expected manifest digest of the implementation.
tagstringA Tag used to group progress bars.