KeyValueStoreReplica KeyValueStoreReplica 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
    interface IBackupRestoreReplica
Public Class KeyValueStoreReplica
Implements IStatefulServiceReplica
Inheritance
KeyValueStoreReplicaKeyValueStoreReplicaKeyValueStoreReplica
Implements

Constructors

KeyValueStoreReplica(String) KeyValueStoreReplica(String) KeyValueStoreReplica(String)

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

KeyValueStoreReplica(String, LocalStoreSettings) KeyValueStoreReplica(String, LocalStoreSettings) KeyValueStoreReplica(String, LocalStoreSettings)

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

KeyValueStoreReplica(String, ReplicatorSettings) KeyValueStoreReplica(String, ReplicatorSettings) KeyValueStoreReplica(String, ReplicatorSettings)

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

KeyValueStoreReplica(String, LocalStoreSettings, ReplicatorSettings) KeyValueStoreReplica(String, LocalStoreSettings, ReplicatorSettings) 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) KeyValueStoreReplica(String, LocalStoreSettings, ReplicatorSettings, KeyValueStoreReplica+SecondaryNotificationMode) 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) KeyValueStoreReplica(String, LocalStoreSettings, ReplicatorSettings, KeyValueStoreReplicaSettings) 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.

Fields

IgnoreSequenceNumberCheck IgnoreSequenceNumberCheck IgnoreSequenceNumberCheck

Indicates that sequence number checking should not occur.

Properties

KeyValueStoreReplicaSettings KeyValueStoreReplicaSettings KeyValueStoreReplicaSettings

Gets or sets the option settings for the KeyValueStoreReplica.

LocalStoreSettings LocalStoreSettings LocalStoreSettings

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

NotificationMode NotificationMode NotificationMode

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

ReplicatorSettings ReplicatorSettings ReplicatorSettings

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

StoreName StoreName StoreName

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

Methods

Abort() Abort() Abort()

Aborts this instance of the KeyValueStoreReplica class.

Add(TransactionBase, String, Byte[]) Add(TransactionBase, String, Byte[]) Add(TransactionBase, String, Byte[])

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

Backup(String) Backup(String) Backup(String)

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

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

Asynchronously creates a backup of the key/value store.

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

Asynchronously creates a backup of the key/value store.

ChangeRoleAsync(ReplicaRole, CancellationToken) ChangeRoleAsync(ReplicaRole, CancellationToken) ChangeRoleAsync(ReplicaRole, CancellationToken)

Changes the replica role of the replica and its replicator.

CloseAsync(CancellationToken) CloseAsync(CancellationToken) CloseAsync(CancellationToken)

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

Contains(TransactionBase, String) Contains(TransactionBase, String) Contains(TransactionBase, String)

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

CreateTransaction(KeyValueStoreTransactionSettings) CreateTransaction(KeyValueStoreTransactionSettings) CreateTransaction(KeyValueStoreTransactionSettings)

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

CreateTransaction() CreateTransaction() CreateTransaction()

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

Enumerate(TransactionBase) Enumerate(TransactionBase) Enumerate(TransactionBase)

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

Enumerate(TransactionBase, String) Enumerate(TransactionBase, String) 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) Enumerate(TransactionBase, String, Boolean) Enumerate(TransactionBase, String, Boolean)

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

EnumerateMetadata(TransactionBase) EnumerateMetadata(TransactionBase) EnumerateMetadata(TransactionBase)

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

EnumerateMetadata(TransactionBase, String) EnumerateMetadata(TransactionBase, String) 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) EnumerateMetadata(TransactionBase, String, Boolean) EnumerateMetadata(TransactionBase, String, Boolean)

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

Get(TransactionBase, String) Get(TransactionBase, String) Get(TransactionBase, String)

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

GetCurrentEpoch() GetCurrentEpoch() GetCurrentEpoch()

Gets the current epoch for the key/value store.

GetMetadata(TransactionBase, String) GetMetadata(TransactionBase, String) GetMetadata(TransactionBase, String)

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

GetValue(TransactionBase, String) GetValue(TransactionBase, String) GetValue(TransactionBase, String)

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

Initialize(StatefulServiceInitializationParameters) Initialize(StatefulServiceInitializationParameters) Initialize(StatefulServiceInitializationParameters)

Initializes the replica in preparation for opening.

OnAbort() OnAbort() OnAbort()

Called to shut down this instance.

OnChangeRoleAsync(ReplicaRole, CancellationToken) OnChangeRoleAsync(ReplicaRole, CancellationToken) OnChangeRoleAsync(ReplicaRole, CancellationToken)

Indicates that this replica is changing roles.

OnCloseAsync(CancellationToken) OnCloseAsync(CancellationToken) OnCloseAsync(CancellationToken)

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

OnCopyComplete(KeyValueStoreEnumerator) OnCopyComplete(KeyValueStoreEnumerator) 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) OnDataLossAsync(CancellationToken) 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) OnDatalossReported(EventArgs) 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) OnInitialize(StatefulServiceInitializationParameters) OnInitialize(StatefulServiceInitializationParameters)

Initializes a newly created service replica.

OnOpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken) OnOpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken) OnOpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken)

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

OnReplicationOperation(IEnumerator<KeyValueStoreNotification>) OnReplicationOperation(IEnumerator<KeyValueStoreNotification>) 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) OnRestoreCompletedAsync(CancellationToken) 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) OpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken) OpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken)

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

Remove(TransactionBase, String) Remove(TransactionBase, String) Remove(TransactionBase, String)

Removes the value indexed by the specified key.

Remove(TransactionBase, String, Int64) Remove(TransactionBase, String, Int64) Remove(TransactionBase, String, Int64)

Removes the value indexed by the specified key.

Restore(String) Restore(String) Restore(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) RestoreAsync(String) 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) RestoreAsync(String, CancellationToken) 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) RestoreAsync(String, RestoreSettings, CancellationToken) RestoreAsync(String, RestoreSettings, CancellationToken)

Asynchronously restores the key/value store replica.

TryAdd(TransactionBase, String, Byte[]) TryAdd(TransactionBase, String, Byte[]) TryAdd(TransactionBase, String, Byte[])

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

TryGet(TransactionBase, String) TryGet(TransactionBase, String) TryGet(TransactionBase, String)

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

TryGetMetadata(TransactionBase, String) TryGetMetadata(TransactionBase, String) TryGetMetadata(TransactionBase, String)

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

TryGetValue(TransactionBase, String) TryGetValue(TransactionBase, String) TryGetValue(TransactionBase, String)

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

TryRemove(TransactionBase, String) TryRemove(TransactionBase, String) TryRemove(TransactionBase, String)

Attempts to remove the value indexed by the specified key.

TryRemove(TransactionBase, String, Int64) TryRemove(TransactionBase, String, Int64) TryRemove(TransactionBase, String, Int64)

Attempts to remove the value indexed by the specified key.

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

Attempts to update the value indexed by the specified key.

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

Attempts to update the value indexed by the specified key.

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

Updates the stored value associated with the specified key.

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

Updates the value indexed by the specified key.

UpdateReplicatorSettings(ReplicatorSettings) UpdateReplicatorSettings(ReplicatorSettings) UpdateReplicatorSettings(ReplicatorSettings)

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

Events

DataLossReported DataLossReported DataLossReported

Handler for data loss events.

Extension Methods

IsDefined(Object) IsDefined(Object) IsDefined(Object)

Determines if a certain property is defined or not.

IsNull(Object) IsNull(Object) IsNull(Object)

Determines if a certain property is null or not.

IsPrimitive(Object) IsPrimitive(Object) IsPrimitive(Object)

Determines if a certain property is of premitive JSON type.

Applies to