Show / Hide Table of Contents

Class BlobStorageFileTransferService

Implements the contract, supporting transfer of files to/from Azure BLOB storage.

Inheritance
System.Object
BlobStorageFileTransferService
Namespace: DNVGL.One.Compute.StorageLibrary.Azure.FileTransfer
Assembly: DNVGL.One.Compute.StorageLibrary.Azure.dll
Syntax
public class BlobStorageFileTransferService : IFileTransferService

Constructors

View Source

BlobStorageFileTransferService()

Initializes a new instance of the BlobStorageFileTransferService class.

Declaration
public BlobStorageFileTransferService()
View Source

BlobStorageFileTransferService(Boolean)

Initializes a new instance of the BlobStorageFileTransferService class.

Declaration
public BlobStorageFileTransferService(bool logToConsole)
Parameters
Type Name Description
System.Boolean logToConsole

Set false to turn off default console logging.

Remarks

The reason that the logToConsole parameter is not specified as an optional parameter on the main constructor is that this would yield a runtime error when trying to use that constructor in a MEF (worker host) context ("System.Composition.Hosting.CompositionFailedException : No importing constructor was found on type").

Properties

View Source

InitialRequestRetryIntervalSeconds

Gets or sets the initial retry interval in seconds.

Declaration
public int InitialRequestRetryIntervalSeconds { get; set; }
Property Value
Type Description
System.Int32

The initial retry interval in seconds.

View Source

MaxNumberOfRequestRetries

Gets or sets the maximum number of request retries.

Declaration
public int MaxNumberOfRequestRetries { get; set; }
Property Value
Type Description
System.Int32

The maximum number of retries.

View Source

MaxNumberOfUploadRetries

Gets or sets the maximum number of upload retries.

Declaration
public int MaxNumberOfUploadRetries { get; set; }
Property Value
Type Description
System.Int32

The maximum number of upload retries.

Remarks

This is used for both upload and download.

View Source

NumberOfUploadTasksPerCore

Gets or sets the number of upload tasks per core.

Declaration
public int NumberOfUploadTasksPerCore { get; set; }
Property Value
Type Description
System.Int32

The number of upload tasks per core.

View Source

ShouldOverwrite

Gets or sets a callback to control when a destination file should be overwritten. Default is to always overwrite.

Declaration
public Func<object, object, bool> ShouldOverwrite { get; set; }
Property Value
Type Description
Func<System.Object, System.Object, System.Boolean>

The callback to determine whether a file should be overwritten.

View Source

ShouldTransfer

Gets or sets a callback to control when a file should be transferred. The default is to always transfer.

Declaration
public Func<object, object, bool> ShouldTransfer { get; set; }
Property Value
Type Description
Func<System.Object, System.Object, System.Boolean>

The callback to determine whether a file should be transferred.

Remarks

This method could be used if the file selection is more complex than could be done by setting the selection and inclusion filters. The transfer logic is the following: selected and !excluded and ShouldTransfer.

Methods

View Source

DownloadFilesAsync(IEnumerable<FileTransferSpecification>)

Downloads the specified files asynchronously. The must be of type , while must be of type .

Declaration
public async Task<IEnumerable<FileTransferResult>> DownloadFilesAsync(IEnumerable<FileTransferSpecification> fileTransferSpecifications)
Parameters
Type Name Description
IEnumerable<FileTransferSpecification> fileTransferSpecifications

The file transfer specifications.

Returns
Type Description
Task<IEnumerable<FileTransferResult>>

Results from each download.

Remarks

If the is null, the files will be downloaded to the current (working) directory. If the is null, the files will be downloaded from the root of the BLOB container, otherwise they will be downloaded from the virtual directory specified by .

View Source

UploadFilesAsync(IEnumerable<FileTransferSpecification>)

Uploads the files from the local file system to BLOB storage asynchronously. The must be of type , while must be of type .

Declaration
public async Task<IEnumerable<FileTransferResult>> UploadFilesAsync(IEnumerable<FileTransferSpecification> fileTransferSpecifications)
Parameters
Type Name Description
IEnumerable<FileTransferSpecification> fileTransferSpecifications

The file transfer specifications defining the files to be uploaded.

Returns
Type Description
Task<IEnumerable<FileTransferResult>>

A object that represents the file upload operation.

Remarks

If the is null, the files will be uploaded from the current (working) directory. If the is null, the files will be uploaded to the root of the BLOB container, otherwise they will be uploaded to the virtual directory specified by .

Events

View Source

FileFailed

Occurs when the transfer of a file fails.

Declaration
public event EventHandler<DataTransferEventArgs> FileFailed
Event Type
Type Description
EventHandler<DataTransferEventArgs>
View Source

FileSkipped

Occurs when the transfer of a file is skipped.

Declaration
public event EventHandler<DataTransferEventArgs> FileSkipped
Event Type
Type Description
EventHandler<DataTransferEventArgs>
View Source

FileTransferred

Occurs when a file has been successfully transferred.

Declaration
public event EventHandler<DataTransferEventArgs> FileTransferred
Event Type
Type Description
EventHandler<DataTransferEventArgs>
  • View Source
In This Article
Back to top Copyright © DNV AS. All rights reserved.