Table of Contents

Class ImplementationStore

Namespace
ZeroInstall.Store.Implementations
Assembly
ZeroInstall.Store.dll

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

public class ImplementationStore : ImplementationSink, IImplementationStore, IImplementationSink, IEquatable<ImplementationStore>
Inheritance
ImplementationStore
Implements
Inherited Members
Extension Methods

Constructors

ImplementationStore(string, ITaskHandler, bool)

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

public ImplementationStore(string path, ITaskHandler handler, bool useWriteProtection = true)

Parameters

path string

A fully qualified directory path. The directory will be created if it doesn't exist yet.

handler ITaskHandler

A callback object used when the user is to be informed about progress or asked questions.

useWriteProtection bool

Controls whether implementation directories are made write-protected once added to the store 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.

Properties

Kind

Indicates what kind of access to this store is possible.

public ImplementationStoreKind Kind { get; }

Property Value

ImplementationStoreKind

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.

Methods

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

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.

Equals(ImplementationStore?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ImplementationStore? other)

Parameters

other ImplementationStore

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

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.

ListAll()

Returns a list of all implementations currently in the store.

public IEnumerable<ManifestDigest> ListAll()

Returns

IEnumerable<ManifestDigest>

A list of implementations formatted as "algorithm=digest" (e.g. "sha256=123abc").

Exceptions

IOException

A problem occurred while reading from the store.

UnauthorizedAccessException

Read access to the store is not permitted.

ListTemp()

Returns a list of temporary directories currently in the store.

public IEnumerable<string> ListTemp()

Returns

IEnumerable<string>

A list of fully qualified paths.

Exceptions

IOException

A problem occurred while reading from the store.

UnauthorizedAccessException

Read access to the store is not permitted.

Optimise()

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.

public long Optimise()

Returns

long

The number of bytes saved by deduplication.

Remarks

If the store does not support optimising this method call may be silently ignored.

Exceptions

OperationCanceledException

The user canceled the task.

IOException

Two files could not be hard-linked together.

UnauthorizedAccessException

Write access to the store is not permitted.

DigestMismatchException

A damaged implementation is encountered while optimizing.

Purge()

Removes all implementations and temporary directories from a store.

public void Purge()

Exceptions

OperationCanceledException

The user canceled the task.

IOException

An implementation could not be deleted.

UnauthorizedAccessException

Write access to the store is not permitted.

Remove(ManifestDigest)

Removes a specific implementation from the store.

public bool Remove(ManifestDigest manifestDigest)

Parameters

manifestDigest ManifestDigest

The digest of the implementation to be removed.

Returns

bool

true if the implementation was successfully removed; false if it could not be removed, e.g., because it does not exist or is locked.

Exceptions

OperationCanceledException

The user canceled the task.

NotAdminException

Needs admin rights to delete from this store.

RemoveTemp(string)

Removes a specific temporary directory from the store.

public bool RemoveTemp(string path)

Parameters

path string

The fully qualified path of the directory.

Returns

bool

true if the directory was successfully removed; false if it could not be removed, e.g. because it does not exist inside the store.

Exceptions

OperationCanceledException

The user canceled the task.

IOException

The directory could not be deleted.

UnauthorizedAccessException

Write access to the store is not permitted.

ToString()

Creates string representation suitable for console output.

public override string ToString()

Returns

string

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.

Verify(ManifestDigest)

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.

public void Verify(ManifestDigest manifestDigest)

Parameters

manifestDigest ManifestDigest

The digest of the implementation to be verified.

Exceptions

OperationCanceledException

The user canceled the task.

NotSupportedException

manifestDigest does not list any supported digests.

IOException

The implementation's directory could not be processed.

UnauthorizedAccessException

Read access to the implementation's directory is not permitted.

ImplementationNotFoundException

No implementation matching manifestDigest could be found in the store.