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
config
ConfigUser settings controlling network behaviour, solving, etc.
store
IImplementationStoreThe location to store the downloaded and unpacked Implementations in.
handler
ITaskHandlerA 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
builder
IBuilderThe builder used to build the implementation.
step
IRecipeStepInstructions for downloading the file.
tag
stringA 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
archives
IEnumerable<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
builder
IBuilderThe builder used to build the implementation.
download
DownloadRetrievalMethodInstructions for downloading the file.
tag
stringA Tag used to group progress bars.
Fetch(Implementation)
Downloads an Implementation to the IImplementationStore.
public void Fetch(Implementation implementation)
Parameters
implementation
ImplementationThe 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
implementation
ImplementationThe implementation to download.
tag
stringA Tag used to group progress bars.
GetPath(ImplementationBase)
Determines the local path of an implementation.
protected string? GetPath(ImplementationBase implementation)
Parameters
implementation
ImplementationBase
Returns
- string
A fully qualified path to the directory containing the implementation;
null
if 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
steps
IReadOnlyCollection<IRecipeStep>The retrieval method steps.
manifestDigest
ManifestDigestThe expected manifest digest of the implementation.
tag
stringA 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
retrievalMethod
RetrievalMethodThe retrieval method.
manifestDigest
ManifestDigestThe expected manifest digest of the implementation.
tag
stringA Tag used to group progress bars.
Retrieve(ExternalRetrievalMethod)
Executes an external retrieval method.
protected virtual void Retrieve(ExternalRetrievalMethod retrievalMethod)
Parameters
retrievalMethod
ExternalRetrievalMethod
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
retrievalMethods
IEnumerable<RetrievalMethod>The available retrieval method.
manifestDigest
ManifestDigestThe expected manifest digest of the implementation.
tag
stringA Tag used to group progress bars.