KeyValueStoreReplica.BackupAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
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. |
BackupAsync(String, StoreBackupOption, Func<StoreBackupInfo,Task<Boolean>>)
Asynchronously creates a backup of the key/value store.
public System.Threading.Tasks.Task BackupAsync (string backupDirectory, System.Fabric.StoreBackupOption backupOption, Func<System.Fabric.StoreBackupInfo,System.Threading.Tasks.Task<bool>> postBackupAsyncFunc);
member this.BackupAsync : string * System.Fabric.StoreBackupOption * Func<System.Fabric.StoreBackupInfo, System.Threading.Tasks.Task<bool>> -> System.Threading.Tasks.Task
Public Function BackupAsync (backupDirectory As String, backupOption As StoreBackupOption, postBackupAsyncFunc As Func(Of StoreBackupInfo, Task(Of Boolean))) As Task
Parameters
- backupDirectory
- String
The directory where the backup is to be stored. If backupOption is TruncateLogsOnly, then this parameter should be null. Otherwise, this parameter cannot be null, empty or contain just whitespace. UNC paths may also be provided. If the directory doesn't exist, it is created. If it exists and isn't empty, then incremental backup fails with FabricBackupDirectoryNotEmptyException.
- backupOption
- StoreBackupOption
The options for the backup.
- postBackupAsyncFunc
- Func<StoreBackupInfo,Task<Boolean>>
The post backup asynchronous method that is invoked by Service Fabric to allow the user to complete any post backup activity before returning control to the system. If null is passed in for this, incremental backups are disallowed. If the post-backup method returns false, then again, incremental backups are disallowed.
Returns
A task that represents the asynchronous backup operation.
Exceptions
backupDirectory is null when backupOption is not TruncateLogsOnly.
backupDirectory is empty or contains just whitespaces when backupOption is not TruncateLogsOnly or backupDirectory is not null when backupOption is TruncateLogsOnly.
When backupOption is Incremental and the backup directory already contains files or sub-directories.
When a previously initiated backup is currently in progress.
Examples
Below is an example of a simple implementation of postBackupAsyncFunc
private async Task<bool> SimplePostBackupHandler(StoreBackupInfo info)
{
return await CopyBackupToAzureBlobStorage(info);
}
Remarks
The postBackupAsyncFunc is not invoked if there is an error during backup. Also, it is not invoked when backupOption is TruncateLogsOnly since there is no further action needed from the user in this case to complete a single backup cycle.
Applies to
BackupAsync(String, StoreBackupOption, Func<StoreBackupInfo,Task<Boolean>>, CancellationToken)
Asynchronously creates a backup of the key/value store.
public System.Threading.Tasks.Task BackupAsync (string backupDirectory, System.Fabric.StoreBackupOption backupOption, Func<System.Fabric.StoreBackupInfo,System.Threading.Tasks.Task<bool>> postBackupAsyncFunc, System.Threading.CancellationToken cancellationToken);
member this.BackupAsync : string * System.Fabric.StoreBackupOption * Func<System.Fabric.StoreBackupInfo, System.Threading.Tasks.Task<bool>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function BackupAsync (backupDirectory As String, backupOption As StoreBackupOption, postBackupAsyncFunc As Func(Of StoreBackupInfo, Task(Of Boolean)), cancellationToken As CancellationToken) As Task
Parameters
- backupDirectory
- String
The directory where the backup is to be stored. If backupOption is TruncateLogsOnly, then this parameter should be null. Otherwise, this parameter cannot be null, empty or contain just whitespace. UNC paths may also be provided. If the directory doesn't exist, it is created. If it exists and isn't empty, then incremental backup fails with FabricBackupDirectoryNotEmptyException.
- backupOption
- StoreBackupOption
The options for the backup.
- postBackupAsyncFunc
- Func<StoreBackupInfo,Task<Boolean>>
The post backup asynchronous method that is invoked by Service Fabric to allow the user to complete any post backup activity before returning control to the system. If null is passed in for this, incremental backups are disallowed. If the post-backup method returns false, then again, incremental backups are disallowed.
- cancellationToken
- CancellationToken
The token to monitor for cancellation requests.
Returns
A task that represents the asynchronous backup operation.
Exceptions
backupDirectory is null when backupOption is not TruncateLogsOnly.
backupDirectory is empty or contains just whitespaces when backupOption is not TruncateLogsOnly or backupDirectory is not null when backupOption is TruncateLogsOnly.
When backupOption is Incremental and the backup directory already contains files or sub-directories.
When a previously initiated backup is currently in progress.
Examples
Below is an example of a simple implementation of postBackupAsyncFunc
private async Task<bool> SimplePostBackupHandler(StoreBackupInfo info)
{
return await CopyBackupToAzureBlobStorage(info);
}
Remarks
The postBackupAsyncFunc is not invoked if there is an error during backup. Also, it is not invoked when backupOption is TruncateLogsOnly since there is no further action needed from the user in this case to complete a single backup cycle.
Applies to
Azure SDK for .NET