Zero Install .NET API 2.20.0
ZeroInstall.Store.Implementations.ImplementationStore Class Reference

Manages a directory that stores implementations. Also known as an implementation cache. More...

Inheritance diagram for ZeroInstall.Store.Implementations.ImplementationStore:
ZeroInstall.Store.Implementations.ImplementationSink ZeroInstall.Store.Implementations.IImplementationStore NanoByte::Common::Threading::MarshalNoTimeout ZeroInstall.Store.Implementations.IImplementationSink ZeroInstall.Store.Implementations.IImplementationSink

Public Member Functions

 ImplementationStore (string path, bool useWriteProtection=true)
 Creates a new implementation store using a specific path to a directory. More...
 
bool Contains (ManifestDigest manifestDigest)
 Determines whether the store contains a local copy of an implementation identified by a specific ManifestDigest. More...
 
string? GetPath (ManifestDigest manifestDigest)
 Determines the local path of an implementation with a given ManifestDigest. More...
 
IEnumerable< ManifestDigestListAll ()
 Returns a list of all implementations currently in the store. More...
 
IEnumerable< string > ListAllTemp ()
 Returns a list of temporary directories currently in the store. More...
 
void Verify (ManifestDigest manifestDigest, ITaskHandler handler)
 Checks whether an implementation in the store still matches the expected digest. Asks the user whether to delete the implementation if it does not match. More...
 
bool Remove (ManifestDigest manifestDigest, ITaskHandler handler)
 Removes a specific implementation from the cache. More...
 
long Optimise (ITaskHandler handler)
 Reads in all the manifest files in the store and looks for duplicates (files with the same permissions, modification time and digest). When it finds a pair, it deletes one and replaces it with a hard-link to the other. More...
 
override string ToString ()
 Creates string representation suitable for console output.
 
bool Equals (ImplementationStore? other)
 
override bool Equals (object? obj)
 
override int GetHashCode ()
 
- Public Member Functions inherited from ZeroInstall.Store.Implementations.ImplementationSink
 ImplementationSink (string path, bool useWriteProtection=true)
 Creates a new implementation sink using a specific path to a directory. More...
 
void Add (ManifestDigest manifestDigest, Action< IBuilder > build)
 Adds a new implementation. More...
 

Static Package Functions

static void DisableWriteProtection (string path)
 Removes write-protection from a directory read-only using platform-specific mechanisms. Logs any errors and continues. More...
 

Properties

ImplementationStoreKind Kind [get]
 
- Properties inherited from ZeroInstall.Store.Implementations.ImplementationSink
string Path [get]
 The path to the underlying directory in the file system.
 
- Properties inherited from ZeroInstall.Store.Implementations.IImplementationStore
ImplementationStoreKind Kind [get]
 Indicates what kind of access to this store is possible.
 
string Path [get]
 The path to the underlying directory in the file system.
 

Additional Inherited Members

- Protected Attributes inherited from ZeroInstall.Store.Implementations.ImplementationSink
readonly bool UseWriteProtection
 Controls whether implementation directories are made write-protected once added to prevent unintentional modification (which would invalidate the manifest digests).
 
readonly bool ReadOnly
 Indicates whether this implementation sink does not support write access.
 

Detailed Description

Manages a directory that stores implementations. Also known as an implementation cache.

Constructor & Destructor Documentation

◆ ImplementationStore()

ZeroInstall.Store.Implementations.ImplementationStore.ImplementationStore ( string  path,
bool  useWriteProtection = true 
)
inline

Creates a new implementation store using a specific path to a directory.

Parameters
pathA fully qualified directory path. The directory will be created if it doesn't exist yet.
useWriteProtectionControls whether implementation directories are made write-protected once added to the store to prevent unintentional modification (which would invalidate the manifest digests).
Exceptions
IOExceptionThe path could not be created or the underlying filesystem can not store file-changed times accurate to the second.
UnauthorizedAccessExceptionCreating the path is not permitted.

Member Function Documentation

◆ Contains()

bool ZeroInstall.Store.Implementations.ImplementationStore.Contains ( ManifestDigest  manifestDigest)

Determines whether the store contains a local copy of an implementation identified by a specific ManifestDigest.

Parameters
manifestDigestThe digest of the implementation to check for.
Returns
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.

If read access to the store is not permitted, no exception is thrown.

Implements ZeroInstall.Store.Implementations.IImplementationStore.

◆ DisableWriteProtection()

static void ZeroInstall.Store.Implementations.ImplementationStore.DisableWriteProtection ( string  path)
inlinestaticpackage

Removes write-protection from a directory read-only using platform-specific mechanisms. Logs any errors and continues.

Parameters
pathThe directory to unprotect.

◆ GetPath()

string? ZeroInstall.Store.Implementations.ImplementationStore.GetPath ( ManifestDigest  manifestDigest)

Determines the local path of an implementation with a given ManifestDigest.

Implements ZeroInstall.Store.Implementations.IImplementationStore.

◆ ListAll()

IEnumerable< ManifestDigest > ZeroInstall.Store.Implementations.ImplementationStore.ListAll ( )
inline

Returns a list of all implementations currently in the store.

Implements ZeroInstall.Store.Implementations.IImplementationStore.

◆ ListAllTemp()

IEnumerable< string > ZeroInstall.Store.Implementations.ImplementationStore.ListAllTemp ( )
inline

Returns a list of temporary directories currently in the store.

Implements ZeroInstall.Store.Implementations.IImplementationStore.

◆ Optimise()

long ZeroInstall.Store.Implementations.ImplementationStore.Optimise ( ITaskHandler  handler)
inline

Reads in all the manifest files in the store and looks for duplicates (files with the same permissions, modification time and digest). When it finds a pair, it deletes one and replaces it with a hard-link to the other.

Implements ZeroInstall.Store.Implementations.IImplementationStore.

◆ Remove()

bool ZeroInstall.Store.Implementations.ImplementationStore.Remove ( ManifestDigest  manifestDigest,
ITaskHandler  handler 
)
inline

Removes a specific implementation from the cache.

Implements ZeroInstall.Store.Implementations.IImplementationStore.

◆ Verify()

void ZeroInstall.Store.Implementations.ImplementationStore.Verify ( ManifestDigest  manifestDigest,
ITaskHandler  handler 
)
inline

Checks whether an implementation in the store still matches the expected digest. Asks the user whether to delete the implementation if it does not match.

Implements ZeroInstall.Store.Implementations.IImplementationStore.


The documentation for this class was generated from the following file: