public BlobDestHandler(AzureBlobLocation destLocation, TransferJob transferJob)
 {
     Debug.Assert(null != destLocation && null != transferJob,
                  "destLocation or transferJob should not be null");
     this.destLocation    = destLocation;
     this.transferJob     = transferJob;
     this.destBlob        = this.destLocation.Blob;
     this.transferContext = this.transferJob.Transfer.Context;
 }
Ejemplo n.º 2
0
 internal PageBlobWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.destLocation = this.TransferJob.Destination as AzureBlobLocation;
     this.pageBlob     = this.destLocation.Blob as CloudPageBlob;
 }
 internal PageBlobWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.destLocation = this.TransferJob.Destination as AzureBlobLocation;
     this.pageBlob = this.destLocation.Blob as CloudPageBlob;
 }
 public PageBlobReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     :base(scheduler, controller, cancellationToken)
 {
     this.sourceLocation = this.SharedTransferData.TransferJob.Source as AzureBlobLocation;
     this.pageBlob = this.sourceLocation.Blob as CloudPageBlob;
     Debug.Assert(null != this.pageBlob, "Initializing a PageBlobReader, the source location should be a CloudPageBlob instance.");
 }
Ejemplo n.º 5
0
 public PageBlobReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.sourceLocation = this.SharedTransferData.TransferJob.Source as AzureBlobLocation;
     this.pageBlob       = this.sourceLocation?.Blob as CloudPageBlob;
     Debug.Assert(null != this.pageBlob, "Initializing a PageBlobReader, the source location should be a CloudPageBlob instance.");
 }
        public AppendBlobWriter(
            TransferScheduler scheduler,
            SyncTransferController controller,
            CancellationToken cancellationToken)
            : base(scheduler, controller, cancellationToken)
        {
            this.destLocation = this.SharedTransferData.TransferJob.Destination as AzureBlobLocation;
            this.appendBlob   = this.destLocation.Blob as CloudAppendBlob;

            Debug.Assert(null != this.appendBlob, "The destination is not an append blob while initializing a AppendBlobWriter instance.");

            this.state     = State.FetchAttributes;
            this.workToken = 1;
        }
        public BlockBlobWriter(
            TransferScheduler scheduler,
            SyncTransferController controller,
            CancellationToken cancellationToken)
            : base(scheduler, controller, cancellationToken)
        {
            this.destLocation = this.SharedTransferData.TransferJob.Destination as AzureBlobLocation;
            this.blockBlob = this.destLocation.Blob as CloudBlockBlob;

            Debug.Assert(null != this.blockBlob, "The destination is not a block blob while initializing a BlockBlobWriter instance.");

            this.state = State.FetchAttributes;
            this.hasWork = true;
        }
Ejemplo n.º 8
0
        public BlockBasedBlobReader(
            TransferScheduler scheduler,
            SyncTransferController controller,
            CancellationToken cancellationToken)
            : base(scheduler, controller, cancellationToken)
        {
            this.transferJob    = this.SharedTransferData.TransferJob;
            this.sourceLocation = this.transferJob.Source as AzureBlobLocation;
            this.sourceBlob     = this.sourceLocation.Blob;

            Debug.Assert(
                (this.sourceBlob is CloudBlockBlob) || (this.sourceBlob is CloudAppendBlob),
                "Initializing BlockBlobReader while source location is not a block blob or an append blob.");

            this.hasWork = true;
        }
Ejemplo n.º 9
0
        // Get Folder Path for table
        private static string GetFolderPath(Table table)
        {
            if (table == null || table.Properties == null)
            {
                return(null);
            }

            AzureBlobLocation blobLocation = table.Properties.Location as AzureBlobLocation;

            if (blobLocation == null)
            {
                return(null);
            }

            return(blobLocation.FolderPath + blobLocation.FileName);
        }
        public BlockBasedBlobReader(
            TransferScheduler scheduler,
            SyncTransferController controller,
            CancellationToken cancellationToken)
            : base(scheduler, controller, cancellationToken)
        {
            this.transferJob = this.SharedTransferData.TransferJob;
            this.sourceLocation = this.transferJob.Source as AzureBlobLocation;
            this.sourceBlob = this.sourceLocation.Blob;

            Debug.Assert(
                (this.sourceBlob is CloudBlockBlob) ||(this.sourceBlob is CloudAppendBlob), 
            "Initializing BlockBlobReader while source location is not a block blob or an append blob.");

            this.hasWork = true;
        }
        public BlobAsyncCopyController(
            TransferScheduler transferScheduler,
            TransferJob transferJob,
            CancellationToken cancellationToken)
            : base(transferScheduler, transferJob, cancellationToken)
        {
            this.destLocation = transferJob.Destination as AzureBlobLocation;
            CloudBlob transferDestBlob = this.destLocation.Blob;

            if (null == transferDestBlob)
            {
                throw new ArgumentException(
                          string.Format(
                              CultureInfo.CurrentCulture,
                              Resources.ParameterCannotBeNullException,
                              "Dest.Blob"),
                          "transferJob");
            }

            if (transferDestBlob.IsSnapshot)
            {
                throw new ArgumentException(Resources.DestinationMustBeBaseBlob, "transferJob");
            }

            AzureBlobLocation sourceBlobLocation = transferJob.Source as AzureBlobLocation;

            if (sourceBlobLocation != null)
            {
                if (sourceBlobLocation.Blob.BlobType != transferDestBlob.BlobType)
                {
                    throw new ArgumentException(Resources.SourceAndDestinationBlobTypeDifferent, "transferJob");
                }

                if (StorageExtensions.Equals(sourceBlobLocation.Blob, transferDestBlob))
                {
                    throw new InvalidOperationException(Resources.SourceAndDestinationLocationCannotBeEqualException);
                }
            }

            this.destBlob = transferDestBlob;
        }
Ejemplo n.º 12
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 PageBlobServiceSideSyncCopyController(
            TransferScheduler scheduler,
            TransferJob transferJob,
            CancellationToken userCancellationToken)
            : base(scheduler, transferJob, userCancellationToken)
        {
            TransferLocation sourceLocation = transferJob.Source;

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

                if (null != pageBlob)
                {
                    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 AzureBlobLocation;
            this.destPageBlob = this.destLocation.Blob as CloudPageBlob;
            this.DestHandler  = new ServiceSideSyncCopyDest.PageBlobDestHandler(this.destLocation, transferJob);
            this.hasWork      = true;
        }
        protected ServiceSideSyncCopyController(
            TransferScheduler transferScheduler,
            TransferJob transferJob,
            CancellationToken userCancellationToken)
            : base(transferScheduler, transferJob, userCancellationToken)
        {
            if (null == transferJob.Destination)
            {
                throw new ArgumentException(
                          string.Format(
                              CultureInfo.CurrentCulture,
                              Resources.ParameterCannotBeNullException,
                              "transferJob"),
                          "transferJob");
            }

            this.sourceLocation = this.TransferJob.Source as AzureBlobLocation;
            this.destLocation   = this.TransferJob.Destination as AzureBlobLocation;
            this.sourceBlob     = sourceLocation.Blob;
            this.destBlob       = this.destLocation.Blob;

            this.state = State.FetchSourceAttributes;
        }
Ejemplo n.º 14
0
 public BlockBlobDestHandler(AzureBlobLocation destLocation, TransferJob transferJob)
     : base(destLocation, transferJob)
 {
 }
Ejemplo n.º 15
0
 public PageBlobDestHandler(AzureBlobLocation destLocation, TransferJob transferJob)
     : base(destLocation, transferJob)
 {
     this.destPageBlob = destLocation.Blob as CloudPageBlob;
 }
Ejemplo n.º 16
0
 public PageBlobSourceHandler(AzureBlobLocation sourceBlobLocation, TransferJob transferJob)
     : base(sourceBlobLocation, transferJob)
 {
     this.pageBlob = sourceBlobLocation.Blob as CloudPageBlob;
 }