Class ResilientManagedBrowsingDatabase
Resilient Managed Database.
Inherited Members
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 |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
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 |
System.Int32 | retryAttempts | The number of attempts a failed operation should be retried. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
System.ArgumentOutOfRangeException | Thrown if |
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
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
System.ArgumentOutOfRangeException | Thrown if |
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 |
Returns
Type | Description |
---|---|
ResilientManagedBrowsingDatabase | A resilient managed database. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
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 |
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 |
System.ArgumentOutOfRangeException | Thrown if |
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
|
Returns
Type | Description |
---|---|
ResilientManagedBrowsingDatabase | A resilient managed database. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
System.ArgumentOutOfRangeException | Thrown if |
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
|
Exceptions
Type | Condition |
---|---|
BrowsingDatabaseException | Thrown if a database error occurs. |
System.ArgumentNullException | Thrown if |
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 |
Exceptions
Type | Condition |
---|---|
BrowsingDatabaseException | Thrown if a database error occurs. |
System.ArgumentNullException | Thrown if |
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
|
Exceptions
Type | Condition |
---|---|
BrowsingDatabaseException | Thrown if a database error occurs. |
System.ArgumentNullException | Thrown if |
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 |
System.Collections.Generic.IEnumerable<System.Int32> | threatIndices | A collection of zero-based indices identifying the threats associated with the lexicographically sorted
|
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 |
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 |
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 |
System.ObjectDisposedException | Thrown if the object is disposed. |
System.OperationCanceledException | Thrown if the asynchronous operation is cancelled. |