internal CloudFileWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.cloudFile = this.TransferJob.Destination.AzureFile;
 }
 protected RangeBasedWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.hasWork = true;
 }
 internal PageBlobWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.pageBlob = this.TransferJob.Destination.Blob as CloudPageBlob;
 }
 protected RangeBasedWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.hasWork = true;
 }
 internal CloudFileWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.cloudFile = this.TransferJob.Destination.AzureFile;
 }
Ejemplo n.º 6
0
 internal PageBlobWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.pageBlob = this.TransferJob.Destination.Blob as CloudPageBlob;
 }
 public StreamedReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.transferJob = this.SharedTransferData.TransferJob;
     this.hasWork = true;
 }
 public CloudFileReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     :base(scheduler, controller, cancellationToken)
 {
     this.file = this.SharedTransferData.TransferJob.Source.AzureFile;
     Debug.Assert(null != this.file, "Initializing a CloudFileReader, the source location should be a CloudFile instance.");
 }
 protected TransferReaderWriterBase(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
 {
     this.Scheduler = scheduler;
     this.Controller = controller;
     this.CancellationToken = cancellationToken;
 }
Ejemplo n.º 10
0
 public PageBlobReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     pageBlob = this.SharedTransferData.TransferJob.Source.Blob as CloudPageBlob;
     Debug.Assert(null != this.pageBlob, "Initializing a PageBlobReader, the source location should be a CloudPageBlob instance.");
 }
Ejemplo n.º 11
0
 public StreamedWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.hasWork = true;
     this.state   = State.OpenOutputStream;
 }
 protected TransferReaderWriterBase(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
 {
     this.Scheduler         = scheduler;
     this.Controller        = controller;
     this.CancellationToken = cancellationToken;
 }
Ejemplo n.º 13
0
 public CloudFileReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.file = this.SharedTransferData.TransferJob.Source.AzureFile;
     Debug.Assert(null != this.file, "Initializing a CloudFileReader, the source location should be a CloudFile instance.");
 }
 public StreamedReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.transferJob = this.SharedTransferData.TransferJob;
     this.hasWork     = true;
 }
 public PageBlobReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     :base(scheduler, controller, cancellationToken)
 {
     pageBlob = this.SharedTransferData.TransferJob.Source.Blob as CloudPageBlob;
     Debug.Assert(null != this.pageBlob, "Initializing a PageBlobReader, the source location should be a CloudPageBlob instance.");
 }
 public StreamedWriter(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.hasWork = true;
     this.state = State.OpenOutputStream;
 }
 public StreamedReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.transferJob = this.SharedTransferData.TransferJob;
     this.workToken   = 1;
     this.readLength  = 0;
 }
Ejemplo n.º 18
0
 public RangeBasedReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.transferJob = this.SharedTransferData.TransferJob;
     this.Location    = this.transferJob.Source;
     this.hasWork     = true;
 }
 public RangeBasedReader(
     TransferScheduler scheduler,
     SyncTransferController controller,
     CancellationToken cancellationToken)
     : base(scheduler, controller, cancellationToken)
 {
     this.transferJob = this.SharedTransferData.TransferJob;
     this.Location = this.transferJob.Source;
     this.hasWork = true;
 }
        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;
        }
Ejemplo n.º 21
0
        public BlockBlobWriter(
            TransferScheduler scheduler,
            SyncTransferController controller,
            CancellationToken cancellationToken)
            : base(scheduler, controller, cancellationToken)
        {
            this.location  = this.SharedTransferData.TransferJob.Destination;
            this.blockBlob = this.location.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;
        }
        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.º 23
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;
        }
        public BlockBasedBlobReader(
            TransferScheduler scheduler,
            SyncTransferController controller,
            CancellationToken cancellationToken)
            : base(scheduler, controller, cancellationToken)
        {
            this.transferLocation = this.SharedTransferData.TransferJob.Source;
            this.transferJob = this.SharedTransferData.TransferJob;
            this.blob = this.transferLocation.Blob;

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

            this.hasWork = true;
        }
        private async Task ExecuteJobInternalAsync(
            TransferJob job,
            CancellationToken cancellationToken)
        {
            Debug.Assert(
                job.Status == TransferJobStatus.NotStarted ||
                job.Status == TransferJobStatus.Monitor ||
                job.Status == TransferJobStatus.Transfer);

            TransferControllerBase controller = null;
            switch (job.Transfer.TransferMethod)
            {
                case TransferMethod.SyncCopy:
                    controller = new SyncTransferController(this, job, cancellationToken);
                    break;

                case TransferMethod.AsyncCopy:
                    controller = AsyncCopyController.CreateAsyncCopyController(this, job, cancellationToken);
                    break;
            }

            Utils.CheckCancellation(this.cancellationTokenSource);
            this.controllerQueue.Add(controller, this.cancellationTokenSource.Token);

            try
            {
                await controller.TaskCompletionSource.Task;
            }
            catch(StorageException sex)
            {
                throw new TransferException(TransferErrorCode.Unknown, Resources.UncategorizedException, sex);
            }
            finally
            {
                controller.Dispose();
            }
        }