Class ImplementationSink
- Namespace
- ZeroInstall.Store.Implementations
- Assembly
- ZeroInstall.Store.dll
Accepts implementations and stores them.
public class ImplementationSink : MarshalNoTimeout, IImplementationSink
- Inheritance
-
ImplementationSink
- Implements
- Derived
- Inherited Members
Constructors
ImplementationSink(string, bool)
Creates a new implementation sink using a specific path to a directory.
public ImplementationSink(string path, bool useWriteProtection = true)
Parameters
path
stringA fully qualified directory path. The directory will be created if it doesn't exist yet.
useWriteProtection
boolControls whether implementation directories are made write-protected once added to prevent unintentional modification (which would invalidate the manifest digests).
Exceptions
- IOException
The
path
could not be created or the underlying filesystem can not store file-changed times accurate to the second.- UnauthorizedAccessException
Creating the
path
is not permitted.
Fields
ReadOnly
Indicates whether this implementation sink does not support write access.
protected readonly bool ReadOnly
Field Value
UseWriteProtection
Controls whether implementation directories are made write-protected once added to prevent unintentional modification (which would invalidate the manifest digests).
protected readonly bool UseWriteProtection
Field Value
Properties
Path
The path to the underlying directory in the file system.
public string Path { get; }
Property Value
Methods
Add(ManifestDigest, Action<IBuilder>)
Adds a new implementation.
public void Add(ManifestDigest manifestDigest, Action<IBuilder> build)
Parameters
manifestDigest
ManifestDigestThe digest the implementation is supposed to match.
build
Action<IBuilder>Callback for building the implementation.
Exceptions
- OperationCanceledException
The user canceled the task.
- ImplementationAlreadyInStoreException
There is already an implementation with the specified
manifestDigest
in the store.- UnauthorizedAccessException
Access to a resource was denied.
- IOException
An IO operation failed.
- DigestMismatchException
The implementation's content doesn't match the
manifestDigest
.
Contains(ManifestDigest)
Determines whether the sink/store contains an implementation identified by a specific ManifestDigest.
public bool Contains(ManifestDigest manifestDigest)
Parameters
manifestDigest
ManifestDigestThe digest of the implementation to check for.
Returns
- bool
true
if the specified implementation is available in the store;false
if the specified implementation is not available in the store or if read access to the store is not permitted.
Remarks
If read access to the store is not permitted, no exception is thrown.
GetPath(ManifestDigest)
Determines the local path of an implementation with a given ManifestDigest.
public string? GetPath(ManifestDigest manifestDigest)
Parameters
manifestDigest
ManifestDigestThe digest the implementation to look for.
Returns
- string
A fully qualified path to the directory containing the implementation;
null
if the requested implementation could not be found in the store.
RemoveDeleteInfoFile()
Removes the file explaining to users how to delete files with write protection.
protected void RemoveDeleteInfoFile()