Share via

VolatileActorStateProvider Class


Provides an implementation of IActorStateProvider where actor state is kept in-memory and is volatile.

public class VolatileActorStateProvider : Microsoft.ServiceFabric.Actors.Runtime.IActorStateProvider, Microsoft.ServiceFabric.Data.IStateProviderReplica2, System.Fabric.IStateProvider
type VolatileActorStateProvider = class
    interface IActorStateProvider
    interface IStateProviderReplica2
    interface IStateProviderReplica
    interface IStateProvider
    interface VolatileLogicalTimeManager.ISnapshotHandler
Public Class VolatileActorStateProvider
Implements IActorStateProvider, IStateProvider, IStateProviderReplica2



Initializes a new instance of the VolatileActorStateProvider class.


Initializes a new instance of the VolatileActorStateProvider class with specified replicator settings.



Sets the function called during suspected data-loss.


Sets the function called post restore has been performed on the replica.

Explicit Interface Implementations

IActorStateProvider.ActorActivatedAsync(ActorId, CancellationToken)

This method is invoked as part of the activation process of the actor with the specified Id.

IActorStateProvider.ContainsStateAsync(ActorId, String, CancellationToken)

Checks whether actor state provider contains an actor state with specified state name.

IActorStateProvider.DeleteReminderAsync(ActorId, String, CancellationToken)

Deletes the specified actor reminder if it exists.

IActorStateProvider.DeleteRemindersAsync(IReadOnlyDictionary<ActorId,IReadOnlyCollection<String>>, CancellationToken)

Deletes the specified set of reminders.

IActorStateProvider.EnumerateStateNamesAsync(ActorId, CancellationToken)

Creates an enumerable of all the state names associated with specified actor.

IActorStateProvider.GetActorsAsync(Int32, ContinuationToken, CancellationToken)

Gets ActorIds from the State Provider.

IActorStateProvider.GetRemindersAsync(Int32, ActorId, ContinuationToken, CancellationToken)

Gets the list of reminders from the state provider


Initializes the actor state provider with type information of the actor type associated with it.


Loads all the reminders contained in the actor state provider.

IActorStateProvider.LoadStateAsync<T>(ActorId, String, CancellationToken)

Loads the actor state associated with the specified state name.

IActorStateProvider.ReminderCallbackCompletedAsync(ActorId, IActorReminder, CancellationToken)

This method is invoked when a reminder fires and finishes executing its callback ReceiveReminderAsync(String, Byte[], TimeSpan, TimeSpan) successfully.

IActorStateProvider.RemoveActorAsync(ActorId, CancellationToken)

Removes all the existing states and reminders associated with specified actor atomically.

IActorStateProvider.SaveReminderAsync(ActorId, IActorReminder, CancellationToken)

Saves the specified actor reminder. If an actor reminder with given name does not exist, it adds the actor reminder otherwise existing actor reminder with same name is updated.

IActorStateProvider.SaveStateAsync(ActorId, IReadOnlyCollection<ActorStateChange>, CancellationToken)

Saves the specified set of actor state changes atomically.


Obtains context on a Secondary replica after it is created and opened to send context to the Primary replica.

IStateProvider.GetCopyState(Int64, IOperationDataStream)

Obtains the state on a Primary replica that is required to build a Secondary replica.


Obtains the last sequence number that the service has committed.


Indicates that a write quorum of replicas in this replica set has been lost, and that therefore data loss might have occurred. The replica set consists of a majority of replicas, which includes the Primary replica.

IStateProvider.UpdateEpochAsync(Epoch, Int64, CancellationToken)

Indicates to a replica that the configuration of a replica set has changed due to a change or attempted change to the Primary replica. The change occurs due to failure or load balancing of the previous Primary replica. Epoch changes act as a barrier by segmenting operations into the exact configuration periods in which they were sent by a specific Primary replica.


Forcefully abort the state provider replica.

IStateProviderReplica.BackupAsync(BackupOption, TimeSpan, CancellationToken, Func<BackupInfo,CancellationToken,Task<Boolean>>)

Performs backup of state managed by this actor sate provider.


Performs a full backup of state managed by this actor state provider

IStateProviderReplica.ChangeRoleAsync(ReplicaRole, CancellationToken)

Notify the state provider replica that its role is changing, for example to Primary or Secondary.


Gracefully close the state provider replica.


Initialize the state provider replica using the service initialization information.

IStateProviderReplica.OpenAsync(ReplicaOpenMode, IStatefulServicePartition, CancellationToken)

Open the state provider replica for use.


Restore a backup taken by BackupAsync(Func<BackupInfo,CancellationToken,Task<Boolean>>) or BackupAsync(BackupOption, TimeSpan, CancellationToken, Func<BackupInfo,CancellationToken,Task<Boolean>>).

IStateProviderReplica.RestoreAsync(String, RestorePolicy, CancellationToken)

Restore a backup taken by BackupAsync(Func<BackupInfo,CancellationToken,Task<Boolean>>) or BackupAsync(BackupOption, TimeSpan, CancellationToken, Func<BackupInfo,CancellationToken,Task<Boolean>>).

Applies to