Show / Hide Table of Contents

Class ResilientManagedBrowsingDatabase

Resilient Managed Database.

Inheritance
System.Object
BaseResilientBrowsingDatabase
ResilientManagedBrowsingDatabase
Implements
IManagedBrowsingDatabase
IUnmanagedBrowsingDatabase
System.IDisposable
Inherited Members
BaseResilientBrowsingDatabase.Dispose()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Gee.External.Browsing.Databases
Assembly: Gee.External.Browsing.dll
Syntax
public sealed class ResilientManagedBrowsingDatabase : BaseResilientBrowsingDatabase, IManagedBrowsingDatabase, IUnmanagedBrowsingDatabase, IDisposable
Remarks

Represents a resilient managed database that automatically retries failed operations performed on a IManagedBrowsingDatabase. The number of retry attempts is either caller or implementation specific if you do not specify a value. Between each retry attempt, the resilient managed database will pause for an implementation specific interval. If all retry attempts are exhausted and the attempted operation never succeeds, the exception the failed operation threw will be propagated up to you.

If you specify a number of retry attempts when you create a resilient managed database, be practical with the value you specify. The resilient unmanaged database will pause for an implementation specific interval between each retry attempt, which effectively means if an attempted operation always fails, the exception it threw will not be propagated up to you until all the retry attempts are exhausted. If you specify a very high number of retry attempts, this could have self inflicted performance implications.

When you create a resilient managed database, you can specify whether or not it takes ownership of the managed database you want to proxy to and dispose it when the resilient managed database itself is disposed. The recommended behavior is that you allow the resilient managed database to take ownership of the managed database you want to proxy to but take note that if you reference or dispose the managed database you want to proxy to after you create the resilient managed database, the behavior of the resilient managed database and managed database you want to proxy to is undefined.

Since a resilient managed database itself implements IManagedBrowsingDatabase, it is technically possible to create a new resilient managed database for an existing resilient managed database, though the reasons for doing so, in most cases, are unjustified. To avoid doing do, consider creating a resilient managed database using Create(IManagedBrowsingDatabase), or one of its overloads, instead of one of the constructor overloads. Create(IManagedBrowsingDatabase) will conveniently create a resilient managed database if, and only if, the managed database you want to proxy to itself is not a resilient managed database.

Constructors

ResilientManagedBrowsingDatabase(IManagedBrowsingDatabase)

Create a Resilient Managed Database.

Declaration
public ResilientManagedBrowsingDatabase(IManagedBrowsingDatabase database)
Parameters
Type Name Description
IManagedBrowsingDatabase database

A IManagedBrowsingDatabase to proxy to. The resilient managed database takes ownership of database and will dispose it when the resilient managed database itself is disposed. If you reference or dispose database after you create the resilient managed database, the behavior of the resilient managed database and database is undefined.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if database is a null reference.

ResilientManagedBrowsingDatabase(IManagedBrowsingDatabase, Int32)

Create a Resilient Managed Database.

Declaration
public ResilientManagedBrowsingDatabase(IManagedBrowsingDatabase database, int retryAttempts)
Parameters
Type Name Description
IManagedBrowsingDatabase database

A IManagedBrowsingDatabase to proxy to. The resilient managed database takes ownership of database and will dispose it when the resilient managed database itself is disposed. If you reference or dispose database after you create the resilient managed database, the behavior of the resilient managed database and database is undefined.

System.Int32 retryAttempts

The number of attempts a failed operation should be retried.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if database is a null reference.

System.ArgumentOutOfRangeException

Thrown if retryAttempts is less than or equal to 0.

ResilientManagedBrowsingDatabase(IManagedBrowsingDatabase, Int32, Boolean)

Create a Resilient Managed Database.

Declaration
public ResilientManagedBrowsingDatabase(IManagedBrowsingDatabase database, int retryAttempts, bool ownDatabase)
Parameters
Type Name Description
IManagedBrowsingDatabase database

A IManagedBrowsingDatabase to proxy to.

System.Int32 retryAttempts

The number of attempts a failed operation should be retried.

System.Boolean ownDatabase

A boolean flag indicating whether or not the resilient managed database takes ownership of database and disposes it when the resilient managed database itself is disposed. If the resilient managed database takes ownership of database and you reference or dispose database after you create the resilient managed database, the behavior of the resilient managed database and database is undefined.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if database is a null reference.

System.ArgumentOutOfRangeException

Thrown if retryAttempts is less than or equal to 0.

Methods

Create(IManagedBrowsingDatabase)

Create a Resilient Managed Database.

Declaration
public static ResilientManagedBrowsingDatabase Create(IManagedBrowsingDatabase database)
Parameters
Type Name Description
IManagedBrowsingDatabase database

A IManagedBrowsingDatabase to proxy to. The resilient managed database takes ownership of database and will dispose it when the resilient managed database itself is disposed. If you reference or dispose database after you create the resilient managed database, the behavior of the resilient managed database and database is undefined.

Returns
Type Description
ResilientManagedBrowsingDatabase

A resilient managed database.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if database is a null reference.

Create(IManagedBrowsingDatabase, Int32)

Create a Resilient Managed Database.

Declaration
public static ResilientManagedBrowsingDatabase Create(IManagedBrowsingDatabase database, int retryAttempts)
Parameters
Type Name Description
IManagedBrowsingDatabase database

A IManagedBrowsingDatabase to proxy to. The resilient managed database takes ownership of database and will dispose it when the resilient managed database itself is disposed. If you reference or dispose database after you create the resilient managed database, the behavior of the resilient managed database and database is undefined.

System.Int32 retryAttempts

The number of attempts a failed operation should be retried.

Returns
Type Description
ResilientManagedBrowsingDatabase

A resilient managed database.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if database is a null reference.

System.ArgumentOutOfRangeException

Thrown if retryAttempts is less than or equal to 0.

Create(IManagedBrowsingDatabase, Int32, Boolean)

Create a Resilient Managed Database.

Declaration
public static ResilientManagedBrowsingDatabase Create(IManagedBrowsingDatabase database, int retryAttempts, bool ownDatabase)
Parameters
Type Name Description
IManagedBrowsingDatabase database

A IManagedBrowsingDatabase to proxy to.

System.Int32 retryAttempts

The number of attempts a failed operation should be retried.

System.Boolean ownDatabase

A boolean flag indicating whether or not the resilient managed database takes ownership of database and disposes it when the resilient managed database itself is disposed. If the resilient managed database takes ownership of database and you reference or dispose database after you create the resilient managed database, the behavior of the resilient managed database and database is undefined.

Returns
Type Description
ResilientManagedBrowsingDatabase

A resilient managed database.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if database is a null reference.

System.ArgumentOutOfRangeException

Thrown if retryAttempts is less than or equal to 0.

FindThreatListsAsync(String, CancellationToken)

Find Threat Lists Asynchronously.

Declaration
public Task<IReadOnlyCollection<ThreatList>> FindThreatListsAsync(string threatSha256HashPrefix, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String threatSha256HashPrefix

A SHA256 hash prefix, formatted as a hexadecimal encoded string, identifying a threat associated with the collection of ThreatList to retrieve.

System.Threading.CancellationToken cancellationToken

A cancellation token to cancel the asynchronous operation with.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<ThreatList>>

A collection of ThreatList the threat identified by threatSha256HashPrefix is associated with. An empty collection indicates no threat lists were found.

Exceptions
Type Condition
BrowsingDatabaseException

Thrown if a database error occurs.

System.ArgumentNullException

Thrown if threatSha256HashPrefix is a null reference.

System.ObjectDisposedException

Thrown if the object is disposed.

System.OperationCanceledException

Thrown if the asynchronous operation is cancelled.

GetThreatListAsync(ThreatListDescriptor, CancellationToken)

Get a Threat List Asynchronously.

Declaration
public Task<ThreatList> GetThreatListAsync(ThreatListDescriptor threatListDescriptor, CancellationToken cancellationToken)
Parameters
Type Name Description
ThreatListDescriptor threatListDescriptor

A ThreatListDescriptor identifying the ThreatList to retrieve.

System.Threading.CancellationToken cancellationToken

A cancellation token to cancel the asynchronous operation with.

Returns
Type Description
System.Threading.Tasks.Task<ThreatList>

The ThreatList identified by threatListDescriptor. A null reference indicates a threat list could not be found.

Exceptions
Type Condition
BrowsingDatabaseException

Thrown if a database error occurs.

System.ArgumentNullException

Thrown if threatListDescriptor is a null reference.

System.ObjectDisposedException

Thrown if the object is disposed.

System.OperationCanceledException

Thrown if the asynchronous operation is cancelled.

GetThreatListsAsync(CancellationToken)

Get Threat Lists Asynchronously.

Declaration
public Task<IReadOnlyCollection<ThreatList>> GetThreatListsAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

A cancellation token to cancel the asynchronous operation with.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<ThreatList>>

A collection of ThreatList. An empty collection indicates no threat lists were found.

Exceptions
Type Condition
BrowsingDatabaseException

Thrown if a database error occurs.

System.ObjectDisposedException

Thrown if the object is disposed.

System.OperationCanceledException

Thrown if the asynchronous operation is cancelled.

GetThreatsAsync(ThreatListDescriptor, CancellationToken)

Get Threats Asynchronously.

Declaration
public Task<IReadOnlyCollection<string>> GetThreatsAsync(ThreatListDescriptor threatListDescriptor, CancellationToken cancellationToken)
Parameters
Type Name Description
ThreatListDescriptor threatListDescriptor

A ThreatListDescriptor identifying the ThreatList the threats that should be retrieved are associated with.

System.Threading.CancellationToken cancellationToken

A cancellation token to cancel the asynchronous operation with.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<System.String>>

A collection of SHA256 hash prefixes, formatted as hexadecimal encoded strings, identifying the threats that are associated with the ThreatList identified by threatListDescriptor. An empty collection indicates no threats were found.

Exceptions
Type Condition
BrowsingDatabaseException

Thrown if a database error occurs.

System.ArgumentNullException

Thrown if threatListDescriptor is a null reference.

System.ObjectDisposedException

Thrown if the object is disposed.

System.OperationCanceledException

Thrown if the asynchronous operation is cancelled.

ModifyThreatListAsync(ThreatList, IEnumerable<String>, IEnumerable<Int32>, CancellationToken)

Modify a Threat List Asynchronously.

Declaration
public Task ModifyThreatListAsync(ThreatList threatList, IEnumerable<string> threatSha256HashPrefixes, IEnumerable<int> threatIndices, CancellationToken cancellationToken)
Parameters
Type Name Description
ThreatList threatList

A ThreatList to modify.

System.Collections.Generic.IEnumerable<System.String> threatSha256HashPrefixes

A collection of SHA256 hash prefixes, formatted as hexadecimal encoded strings, identifying the threats associated with threatList and should be stored.

System.Collections.Generic.IEnumerable<System.Int32> threatIndices

A collection of zero-based indices identifying the threats associated with the lexicographically sorted threatList and should be removed.

System.Threading.CancellationToken cancellationToken

A cancellation token to cancel the asynchronous operation with.

Returns
Type Description
System.Threading.Tasks.Task

A task representing the asynchronous operation.

Exceptions
Type Condition
BrowsingDatabaseException

Thrown if a database error occurs.

System.ArgumentNullException

Thrown if threatList is a null reference, or if threatSha256HashPrefixes is a null reference, or if threatIndices is a null reference.

System.ObjectDisposedException

Thrown if the object is disposed.

System.OperationCanceledException

Thrown if the asynchronous operation is cancelled.

StoreThreatListAsync(ThreatList, IEnumerable<String>, CancellationToken)

Store a Threat List Asynchronously.

Declaration
public Task StoreThreatListAsync(ThreatList threatList, IEnumerable<string> threatSha256HashPrefixes, CancellationToken cancellationToken)
Parameters
Type Name Description
ThreatList threatList

A ThreatList to store.

System.Collections.Generic.IEnumerable<System.String> threatSha256HashPrefixes

A collection of SHA256 hash prefixes, formatted as hexadecimal encoded strings, identifying the threats associated with threatList and should be stored.

System.Threading.CancellationToken cancellationToken

A cancellation token to cancel the asynchronous operation with.

Returns
Type Description
System.Threading.Tasks.Task

A task representing the asynchronous operation.

Exceptions
Type Condition
BrowsingDatabaseException

Thrown if a database error occurs.

System.ArgumentNullException

Thrown if threatList is a null reference, or if threatSha256HashPrefixes is a null reference.

System.ObjectDisposedException

Thrown if the object is disposed.

System.OperationCanceledException

Thrown if the asynchronous operation is cancelled.

Implements

IManagedBrowsingDatabase
IUnmanagedBrowsingDatabase
System.IDisposable

Extension Methods

ManagedBrowsingDatabaseExtension.ModifyThreatListAsync(IManagedBrowsingDatabase, ThreatList, IEnumerable<String>, IEnumerable<Int32>)
ManagedBrowsingDatabaseExtension.StoreThreatListAsync(IManagedBrowsingDatabase, ThreatList, IEnumerable<String>)
UnmanagedBrowsingDatabaseExtension.ComputeThreatListChecksumAsync(IUnmanagedBrowsingDatabase, ThreatListDescriptor)
UnmanagedBrowsingDatabaseExtension.ComputeThreatListChecksumAsync(IUnmanagedBrowsingDatabase, ThreatListDescriptor, CancellationToken)
UnmanagedBrowsingDatabaseExtension.FindThreatListsAsync(IUnmanagedBrowsingDatabase, String)
UnmanagedBrowsingDatabaseExtension.GetThreatListAsync(IUnmanagedBrowsingDatabase, ThreatListDescriptor)
UnmanagedBrowsingDatabaseExtension.GetThreatListsAsync(IUnmanagedBrowsingDatabase)
UnmanagedBrowsingDatabaseExtension.GetThreatListsAsync(IUnmanagedBrowsingDatabase, IEnumerable<ThreatListDescriptor>)
UnmanagedBrowsingDatabaseExtension.GetThreatsAsync(IUnmanagedBrowsingDatabase, ThreatListDescriptor)
UnmanagedBrowsingDatabaseExtension.LookupAsync(IUnmanagedBrowsingDatabase, Url)
Back to top Generated by DocFX