KeyValueStoreReplica Class

Definition

Provides a transactional, replicated, associative data storage component to service writers - ready for integration into any Service Fabric service.

This is used by legacy Service Fabric services. All new services should use the Reliable Collections.
public class KeyValueStoreReplica : System.Fabric.IStatefulServiceReplica
type KeyValueStoreReplica = class
    interface IStatefulServiceReplica
Public Class KeyValueStoreReplica
Implements IStatefulServiceReplica
Inheritance
KeyValueStoreReplica
Implements

Constructors

KeyValueStoreReplica(String)

Initializes a new instance of the KeyValueStoreReplica class with the specified key/value store name.

KeyValueStoreReplica(String, LocalStoreSettings)

Initializes a new instance of the KeyValueStoreReplica class with the specified key/value store name and local store settings.

KeyValueStoreReplica(String, LocalStoreSettings, ReplicatorSettings)

Initializes a new instance of the KeyValueStoreReplica class with the specified key/value store name, local store settings, and replicator settings.

KeyValueStoreReplica(String, LocalStoreSettings, ReplicatorSettings, KeyValueStoreReplica+SecondaryNotificationMode)

Initializes a new instance of the KeyValueStoreReplica class with the specified key/value store name, local store settings, and replicator settings. Secondary replica notifications are enabled via the notification mode.

KeyValueStoreReplica(String, LocalStoreSettings, ReplicatorSettings, KeyValueStoreReplicaSettings)

Initializes a new instance of the KeyValueStoreReplica class with the specified key/value store name, local store settings, replicator settings, and replica settings.

KeyValueStoreReplica(String, ReplicatorSettings)

Initializes a new instance of the KeyValueStoreReplica class with the specified key/value store name and store replicator settings.

Fields

IgnoreSequenceNumberCheck

Indicates that sequence number checking should not occur.

Properties

KeyValueStoreReplicaSettings

Gets or sets the option settings for the KeyValueStoreReplica.

LocalStoreSettings

Gets or sets the option settings for the local key/value store.

NotificationMode

Gets the secondary notification mode specified during construction of this replica.

ReplicatorSettings

Gets or sets the option settings for the key/value store replicator.

StoreName

Gets or sets the name of the key/value store.

Methods

Abort()

Aborts this instance of the KeyValueStoreReplica class.

Add(TransactionBase, String, Byte[])

Adds a value indexed by the specified key to the key/value store.

Backup(String)
Obsolete.

DEPRECATED. Performs a full backup of the replica's local store to the specified destination directory.

BackupAsync(String, StoreBackupOption, Func<StoreBackupInfo,Task<Boolean>>)

Asynchronously creates a backup of the key/value store.

BackupAsync(String, StoreBackupOption, Func<StoreBackupInfo,Task<Boolean>>, CancellationToken)

Asynchronously creates a backup of the key/value store.

ChangeRoleAsync(ReplicaRole, CancellationToken)

Changes the replica role of the replica and its replicator.

CloseAsync(CancellationToken)

Closes the replica and its replicator in preparation for going offline from a replica set.

Contains(TransactionBase, String)

Determines whether a value is contained in the key/value store.

CreateTransaction()

Creates a unique Transaction instance, which is used to commit or rollback groups of key/value store operations.

CreateTransaction(KeyValueStoreTransactionSettings)

Creates a unique Transaction instance, which is used to commit or rollback groups of key/value store operations.

Enumerate(TransactionBase)

Returns an enumerator that iterates through the KeyValueStoreItem values in the key/value store.

Enumerate(TransactionBase, String)

Returns an enumerator that iterates through the KeyValueStoreItem values in the key/value store, where the value keys match the specified key prefix.

Enumerate(TransactionBase, String, Boolean)

Returns an enumerator that iterates through the KeyValueStoreItem values in the key/value store.

EnumerateBySequenceNumber(TransactionBase, Int64)

Returns an enumerator that iterates through the KeyValueStoreItem values in the key/value store in order of sequence number.

EnumerateKeysAndTombstonesBySequenceNumber(TransactionBase, Int64)

Returns an enumerator that iterates through the KeyValueStoreItem values and tombstones in the key/value store in order of sequence number.

EnumerateMetadata(TransactionBase)

Returns an enumerator that iterates through the KeyValueStoreItemMetadata values in the key/value store.

EnumerateMetadata(TransactionBase, String)

Returns an enumerator that iterates through the KeyValueStoreItemMetadata values in the key/value store, where the value keys match the specified key prefix.

EnumerateMetadata(TransactionBase, String, Boolean)

Returns an enumerator that iterates through the KeyValueStoreItemMetadata values in the key/value store.

Get(TransactionBase, String)

Gets the stored value, as a KeyValueStoreItem object, associated with the specified key.

GetCurrentEpoch()

Gets the current epoch for the key/value store.

GetLastCommittedSequenceNumber()

Gets the last committed sequence number

GetLSNSplitPercentile(Int32)

Gets an LSN approximately percentile% of the way through the KVS store.

GetMetadata(TransactionBase, String)

Gets the metadata, as a KeyValueStoreItemMetadata object, for the value associated with the specified key.

GetValue(TransactionBase, String)

Gets the stored value as a byte array, associated with the specified key.

Initialize(StatefulServiceInitializationParameters)

Initializes the replica in preparation for opening.

OnAbort()

Called to shut down this instance.

OnChangeRoleAsync(ReplicaRole, CancellationToken)

Indicates that this replica is changing roles.

OnCloseAsync(CancellationToken)

Called when this service replica is being shut down and needs to close.

OnCopyComplete(KeyValueStoreEnumerator)

Called by the system on secondary replicas when they have finished building from the primary and are ready to start applying replication operations.

This method will only be called on secondary replicas if the KeyValueStoreReplica object was constructed with a valid KeyValueStoreReplica.SecondaryNotificationMode parameter.

OnDataLossAsync(CancellationToken)

Signals that the replica set may have experienced data loss. The application can either override this method to process the event asynchronously or use the DataLossReported event to process synchronously. Both represent the same event.

OnDatalossReported(EventArgs)

Signals that the replica set may have experienced data loss. The application can either override this method or listen for the DataLossReported Event. Both represent the same event

OnInitialize(StatefulServiceInitializationParameters)

Initializes a newly created service replica.

OnOpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken)

Called on an initialized service replica to open it so that additional actions can be taken.

OnReplicationOperation(IEnumerator<KeyValueStoreNotification>)

Called by the system on secondary replicas for incoming replication operations. Each KeyValueStoreNotification object contains all the data for a single atomic replication operation.

OnRestoreCompletedAsync(CancellationToken)

Signals that the replica's state was successfully restored by the system. This is invoked only when system internally triggers a restore via the Backup Restore service.

OpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken)

Opens the replica and its replicator in preparation for coming online in a replica set.

Remove(TransactionBase, String)

Removes the value indexed by the specified key.

Remove(TransactionBase, String, Int64)

Removes the value indexed by the specified key.

Restore(String)
Obsolete.

Restores this replica's local store database from a backup that was previously created by calling BackupAsync(String, StoreBackupOption, Func<StoreBackupInfo,Task<Boolean>>).

RestoreAsync(String)

Restores this replica's local store database from a backup that was previously created by calling BackupAsync(String, StoreBackupOption, Func<StoreBackupInfo,Task<Boolean>>).

RestoreAsync(String, CancellationToken)

Restores this replica's local store database from a backup that was previously created by calling BackupAsync(String, StoreBackupOption, Func<StoreBackupInfo,Task<Boolean>>).

RestoreAsync(String, RestoreSettings, CancellationToken)

Asynchronously restores the key/value store replica.

TryAbortExistingTransactionsAndRejectWrites()

Intended for use for migrating data from KVS to another data store. After calling, writes will remain blocked until replica restart. Checks whether KVS is ready for the final migration to another store. If this is called but KVS has not begun migration preparation (which would happen in the case of a KVS failover) this will begin preparation again.

TryAdd(TransactionBase, String, Byte[])

Attempts to add a value indexed by the specified key to the key/value store.

TryGet(TransactionBase, String)

Attempts to get the stored value, as a KeyValueStoreItem object, associated with the specified key.

TryGetMetadata(TransactionBase, String)

Attempts to get the metadata as a KeyValueStoreItemMetadata object, for the value associated with the specified key.

TryGetValue(TransactionBase, String)

Attempts to get the stored value as a byte array, associated with the specified key.

TryRemove(TransactionBase, String)

Attempts to remove the value indexed by the specified key.

TryRemove(TransactionBase, String, Int64)

Attempts to remove the value indexed by the specified key.

TryUpdate(TransactionBase, String, Byte[])

Attempts to update the value indexed by the specified key.

TryUpdate(TransactionBase, String, Byte[], Int64)

Attempts to update the value indexed by the specified key.

Update(TransactionBase, String, Byte[])

Updates the stored value associated with the specified key.

Update(TransactionBase, String, Byte[], Int64)

Updates the value indexed by the specified key.

UpdateReplicatorSettings(ReplicatorSettings)

Updates the key/value store replicator with the settings in the specified ReplicatorSettings object.

Events

DataLossReported

Handler for data loss events.

Applies to