protected async Task DoFetchSourceAttributesAsync()
        {
            if (this.TransferJob.Source.Type == TransferLocationType.AzureBlob)
            {
                AzureBlobLocation sourceLocation  = this.TransferJob.Source as AzureBlobLocation;
                AccessCondition   accessCondition = Utils.GenerateConditionWithCustomerCondition(
                    sourceLocation.AccessCondition,
                    sourceLocation.CheckedAccessCondition);
                OperationContext operationContext = Utils.GenerateOperationContext(this.TransferContext);

                await sourceLocation.Blob.FetchAttributesAsync(
                    accessCondition,
                    Utils.GenerateBlobRequestOptions(sourceLocation.BlobRequestOptions),
                    operationContext,
                    this.CancellationToken);
            }
            else if (this.TransferJob.Source.Type == TransferLocationType.AzureFile)
            {
                AzureFileLocation sourceLocation  = this.TransferJob.Source as AzureFileLocation;
                AccessCondition   accessCondition = Utils.GenerateConditionWithCustomerCondition(
                    sourceLocation.AccessCondition,
                    sourceLocation.CheckedAccessCondition);
                OperationContext operationContext = Utils.GenerateOperationContext(this.TransferContext);
                await sourceLocation.AzureFile.FetchAttributesAsync(
                    accessCondition,
                    Utils.GenerateFileRequestOptions(sourceLocation.FileRequestOptions),
                    operationContext,
                    this.CancellationToken);
            }
        }
        public FileAsyncCopyController(
            TransferScheduler transferScheduler,
            TransferJob transferJob,
            CancellationToken cancellationToken)
            : base(transferScheduler, transferJob, cancellationToken)
        {
            if (transferJob.Destination.Type != TransferLocationType.AzureFile)
            {
                throw new ArgumentException(
                          string.Format(
                              CultureInfo.CurrentCulture,
                              Resources.ParameterCannotBeNullException,
                              "Dest.AzureFile"),
                          "transferJob");
            }

            if (transferJob.Source.Type != TransferLocationType.SourceUri &&
                transferJob.Source.Type != TransferLocationType.AzureBlob &&
                transferJob.Source.Type != TransferLocationType.AzureFile)
            {
                throw new ArgumentException(
                          string.Format(
                              CultureInfo.CurrentCulture,
                              Resources.ProvideExactlyOneOfThreeParameters,
                              "Source.SourceUri",
                              "Source.Blob",
                              "Source.AzureFile"),
                          "transferJob");
            }

            this.destLocation = this.TransferJob.Destination as AzureFileLocation;
            this.destFile     = this.destLocation.AzureFile;
        }
コード例 #3
0
 public FileDestHandler(AzureFileLocation destLocation, TransferJob transferJob)
 {
     this.destLocation    = destLocation;
     this.transferJob     = transferJob;
     this.transferContext = this.transferJob.Transfer.Context;
     this.destFile        = this.destLocation.AzureFile;
 }
コード例 #4
0
 public FileSourceHandler(AzureFileLocation sourceLocation, TransferJob transferJob)
 {
     this.sourceLocation  = sourceLocation;
     this.transferJob     = transferJob;
     this.sourceFile      = this.sourceLocation.AzureFile;
     this.transferContext = this.transferJob.Transfer.Context;
 }
コード例 #5
0
 internal CloudFileWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.destLocation = this.TransferJob.Destination as AzureFileLocation;
     this.cloudFile    = this.destLocation.AzureFile;
 }
コード例 #6
0
 internal CloudFileWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.destLocation = this.TransferJob.Destination as AzureFileLocation;
     this.cloudFile = this.destLocation.AzureFile;
 }
コード例 #7
0
 public CloudFileReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     :base(scheduler, controller, cancellationToken)
 {
     this.sourceLocation = this.SharedTransferData.TransferJob.Source as AzureFileLocation;
     this.cloudFile = this.sourceLocation.AzureFile;
     Debug.Assert(null != this.cloudFile, "Initializing a CloudFileReader, the source location should be a CloudFile instance.");
 }
コード例 #8
0
 public CloudFileReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.sourceLocation = this.SharedTransferData.TransferJob.Source as AzureFileLocation;
     this.cloudFile      = this.sourceLocation.AzureFile;
     Debug.Assert(null != this.cloudFile, "Initializing a CloudFileReader, the source location should be a CloudFile instance.");
 }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PageBlobServiceSideSyncCopyController"/> class.
        /// </summary>
        /// <param name="scheduler">Scheduler object which creates this object.</param>
        /// <param name="transferJob">Instance of job to start async copy.</param>
        /// <param name="userCancellationToken">Token user input to notify about cancellation.</param>
        internal FileServiceSideSyncCopyController(
            TransferScheduler scheduler,
            TransferJob transferJob,
            CancellationToken userCancellationToken)
            : base(scheduler, transferJob, userCancellationToken)
        {
            TransferLocation sourceLocation = transferJob.Source;

            if (sourceLocation.Type == TransferLocationType.AzureBlob)
            {
                var blobLocation = sourceLocation as AzureBlobLocation;

                if (blobLocation.Blob is CloudPageBlob)
                {
                    this.SourceHandler = new ServiceSideSyncCopySource.PageBlobSourceHandler(blobLocation, transferJob);
                }
                else
                {
                    this.SourceHandler = new ServiceSideSyncCopySource.BlobSourceHandler(blobLocation, transferJob);
                }
            }
            else if (sourceLocation.Type == TransferLocationType.AzureFile)
            {
                this.SourceHandler = new ServiceSideSyncCopySource.FileSourceHandler(sourceLocation as AzureFileLocation, transferJob);
            }
            else
            {
                throw new ArgumentException(
                          Resources.OnlySupportBlobAzureFileSource,
                          "transferJob");
            }

            this.destLocation = transferJob.Destination as AzureFileLocation;
            this.destFile     = this.destLocation.AzureFile as CloudFile;
            this.DestHandler  = new ServiceSideSyncCopyDest.FileDestHandler(this.destLocation, transferJob);
            this.hasWork      = true;
        }