Table of Contents

Interface IFeedCache

Namespace
ZeroInstall.Store.Feeds
Assembly
ZeroInstall.Store.dll

A disk-based cache of Feeds that were downloaded via HTTP(S). Once a feed has been added to this cache it is considered trusted (signatures are not checked again).

public interface IFeedCache

Remarks

Implementations of this interface are immutable and thread-safe.

Properties

Path

The path to the underlying directory in the file system.

string Path { get; }

Property Value

string

Methods

Add(FeedUri, byte[])

Adds a new Feed to the cache. Only do this after the feed source has been verified and trusted and replay attacks filtered!

void Add(FeedUri feedUri, byte[] data)

Parameters

feedUri FeedUri

The canonical ID used to identify the feed. Must not be a local path.

data byte[]

The content of the feed file as a byte array.

Exceptions

IOException

A problem occurred while writing the feed file.

UnauthorizedAccessException

Write access to the cache is not permitted.

InvalidDataException

The feed file could not be parsed.

InvalidOperationException

feedUri is a a local path.

Contains(FeedUri)

Determines whether this cache contains a local copy of a Feed identified by a specific URL.

bool Contains(FeedUri feedUri)

Parameters

feedUri FeedUri

The canonical ID used to identify the feed.

Returns

bool

true if the specified feed is available in this cache; false if the specified feed is not available in this cache.

GetFeed(FeedUri)

Tries to get a specific Feed from this cache.

Feed? GetFeed(FeedUri feedUri)

Parameters

feedUri FeedUri

The canonical ID used to identify the feed.

Returns

Feed

The un-normalized Feed; null if the feed was not found in the cache or could not be parsed.

Exceptions

IOException

A problem occurred while reading the feed file.

UnauthorizedAccessException

Read access to the cache is not permitted.

GetPath(FeedUri)

Tries to get the file path of the on-disk representation of a specific Feed.

string? GetPath(FeedUri feedUri)

Parameters

feedUri FeedUri

The canonical ID used to identify the feed.

Returns

string

The fully qualified path to the feed file; null if the feed was not found in the cache.

Exceptions

IOException

A problem occurred while reading the feed file.

UnauthorizedAccessException

Read access to the cache is not permitted.

GetSignatures(FeedUri)

Determines which signatures a Feed from this cache is signed with.

IEnumerable<OpenPgpSignature> GetSignatures(FeedUri feedUri)

Parameters

feedUri FeedUri

The canonical ID used to identify the feed.

Returns

IEnumerable<OpenPgpSignature>

A list of signatures found, both valid and invalid. Returns an empty list if the feed was not found in the cache.

Exceptions

IOException

A problem occurred while reading the feed file.

UnauthorizedAccessException

Read access to the cache is not permitted.

SignatureException

A signature block was found but it could not be parsed.

ListAll()

Returns a list of all Feeds stored in this cache.

IEnumerable<FeedUri> ListAll()

Returns

IEnumerable<FeedUri>

A list of feed URIs (e.g. "http://somedomain.net/interface.xml"). Usually these can also be considered interface URIs.

Exceptions

IOException

A problem occurred while reading from the cache.

UnauthorizedAccessException

Read access to the cache is not permitted.

Remove(FeedUri)

Removes a specific Feed from this cache. No exception is thrown if the specified Feed is not in the cache.

void Remove(FeedUri feedUri)

Parameters

feedUri FeedUri

The canonical ID used to identify the feed.

Exceptions

IOException

The feed could not be deleted.

UnauthorizedAccessException

Write access to the cache is not permitted.