Condividi tramite


IReliableDictionary<TKey,TValue> Interface

Definition

Represents a Reliable Collection of key/value pairs that are persisted and replicated.

public interface IReliableDictionary<TKey,TValue> : Microsoft.ServiceFabric.Data.Collections.IReliableCollection<System.Collections.Generic.KeyValuePair<TKey,TValue>> where TKey : IComparable<TKey>, IEquatable<TKey>
type IReliableDictionary<'Key, 'Value (requires 'Key :> IComparable<'Key> and 'Key :> IEquatable<'Key>)> = interface
    interface IReliableCollection<KeyValuePair<'Key, 'Value>>
    interface IReliableState
Public Interface IReliableDictionary(Of TKey, TValue)
Implements IReliableCollection(Of KeyValuePair(Of TKey, TValue))

Type Parameters

TKey

The type of the keys in the Reliable Dictionary.

TValue

The type of the values in the Reliable Dictionary.

Derived
Implements

Remarks

Keys or values stored in this dictionary MUST NOT be mutated outside the context of an operation on the dictionary. It is highly recommended to make both TKey and TValue immutable in order to avoid accidental data corruption. See here for common pitfalls.

The transaction is the unit of concurrency. Users can have multiple transactions in-flight at any given point of time, but for a given transaction each API must be called one at a time. When calling any asynchronous Reliable Collection method that takes an ITransaction, you must wait for completion of the returned Task before calling another method using the same transaction. See examples of transactions here.

Properties

Name

Gets a value indicating the unique name for the IReliableState instance.

(Inherited from IReliableState)
RebuildNotificationAsyncCallback

A function that is called when the Reliable Dictionary is being rebuilt during copy, restore or recovery.

Methods

AddAsync(ITransaction, TKey, TValue, TimeSpan, CancellationToken)

Adds the specified key/value pair to the Reliable Dictionary.

AddAsync(ITransaction, TKey, TValue)

Adds the specified key/value pair to the Reliable Dictionary.

AddOrUpdateAsync(ITransaction, TKey, Func<TKey,TValue>, Func<TKey,TValue,TValue>, TimeSpan, CancellationToken)

Uses the specified functions to add a key/value pair to the Reliable Dictionary if the key does not already exist, or to update a key/value pair in the Reliable Dictionary if the key already exists.

AddOrUpdateAsync(ITransaction, TKey, Func<TKey,TValue>, Func<TKey,TValue,TValue>)

Uses the specified functions to add a key/value pair to the Reliable Dictionary if the key does not already exist, or to update a key/value pair in the Reliable Dictionary if the key already exists.

AddOrUpdateAsync(ITransaction, TKey, TValue, Func<TKey,TValue,TValue>, TimeSpan, CancellationToken)

Adds a key/value pair to the Reliable Dictionary if the key does not already exist, or updates a key/value pair in the Reliable Dictionary by using the specified function if the key already exists.

AddOrUpdateAsync(ITransaction, TKey, TValue, Func<TKey,TValue,TValue>)

Adds a key/value pair to the Reliable Dictionary if the key does not already exist, or updates a key/value pair in the Reliable Dictionary by using the specified function if the key already exists.

ClearAsync()

Removes all state from the IReliableCollection<T>, including replicated and persisted state.

(Inherited from IReliableCollection<T>)
ClearAsync(TimeSpan, CancellationToken)

Removes all keys and values from the Reliable Dictionary.

ContainsKeyAsync(ITransaction, TKey, LockMode, TimeSpan, CancellationToken)

Determines whether the Reliable Dictionary contains the specified key.

ContainsKeyAsync(ITransaction, TKey, LockMode)

Determines whether the Reliable Dictionary contains the specified key.

ContainsKeyAsync(ITransaction, TKey, TimeSpan, CancellationToken)

Determines whether the Reliable Dictionary contains the specified key.

ContainsKeyAsync(ITransaction, TKey)

Determines whether the Reliable Dictionary contains the specified key.

CreateEnumerableAsync(ITransaction, EnumerationMode)

Creates an asynchronous enumerator over the IReliableDictionary<TKey,TValue>.

CreateEnumerableAsync(ITransaction, Func<TKey,Boolean>, EnumerationMode)

Creates an asynchronous enumerator over the IReliableDictionary<TKey,TValue>.

CreateEnumerableAsync(ITransaction)

Creates an asynchronous enumerator over the IReliableDictionary<TKey,TValue>.

GetCountAsync(ITransaction)

Gets the number of elements contained in the IReliableCollection<T>.

(Inherited from IReliableCollection<T>)
GetOrAddAsync(ITransaction, TKey, Func<TKey,TValue>, TimeSpan, CancellationToken)

Adds a key/value pair to the Reliable Dictionary by using the specified function, if the key does not already exist.

GetOrAddAsync(ITransaction, TKey, Func<TKey,TValue>)

Adds a key/value pair to the Reliable Dictionary by using the specified function, if the key does not already exist.

GetOrAddAsync(ITransaction, TKey, TValue, TimeSpan, CancellationToken)

Adds a key/value pair to the Reliable Dictionary if the key does not already exist.

GetOrAddAsync(ITransaction, TKey, TValue)

Adds a key/value pair to the Reliable Dictionary if the key does not already exist. If the key exists no updates will be made to the value.

SetAsync(ITransaction, TKey, TValue, TimeSpan, CancellationToken)

Adds a key/value pair to the Reliable Dictionary if the key does not already exist, or updates a key/value pair in the Reliable Dictionary if the key already exists.

SetAsync(ITransaction, TKey, TValue)

Adds a key/value pair to the Reliable Dictionary if the key does not already exist, or updates a key/value pair in the Reliable Dictionary if the key already exists.

TryAddAsync(ITransaction, TKey, TValue, TimeSpan, CancellationToken)

Attempts to add the specified key and value to the Reliable Dictionary.

TryAddAsync(ITransaction, TKey, TValue)

Attempts to add the specified key and value to the Reliable Dictionary.

TryGetValueAsync(ITransaction, TKey, LockMode, TimeSpan, CancellationToken)

Attempts to get the value associated with the specified key from the Reliable Dictionary.

TryGetValueAsync(ITransaction, TKey, LockMode)

Attempts to get the value associated with the specified key from the Reliable Dictionary.

TryGetValueAsync(ITransaction, TKey, TimeSpan, CancellationToken)

Attempts to get the value associated with the specified key from the Reliable Dictionary.

TryGetValueAsync(ITransaction, TKey)

Attempts to get the value associated with the specified key from the Reliable Dictionary.

TryRemoveAsync(ITransaction, TKey, TimeSpan, CancellationToken)

Attempts to remove the value with the specified key from the Reliable Dictionary.

TryRemoveAsync(ITransaction, TKey)

Attempts to remove the value with the specified key from the Reliable Dictionary.

TryUpdateAsync(ITransaction, TKey, TValue, TValue, TimeSpan, CancellationToken)

Compares the existing value for the specified key with a specified value, and if they are equal, updates the key with a third value.

TryUpdateAsync(ITransaction, TKey, TValue, TValue)

Compares the existing value for the specified key with a specified value, and if they are equal, updates the key with a third value.

Events

DictionaryChanged

Occurs when the Reliable Dictionary changes. For example, addition, update or removal of an item.

Applies to