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; }
public void CreateTransferJobRequestObject() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CreateTransferJobRequest request = new CreateTransferJobRequest { TransferJob = new TransferJob(), }; TransferJob expectedResponse = new TransferJob { Name = "name1c9368b0", Description = "description2cf9da67", ProjectId = "project_id43ad98b0", TransferSpec = new TransferSpec(), Schedule = new Schedule(), Status = TransferJob.Types.Status.Disabled, CreationTime = new wkt::Timestamp(), LastModificationTime = new wkt::Timestamp(), DeletionTime = new wkt::Timestamp(), NotificationConfig = new NotificationConfig(), LatestOperationName = "latest_operation_namef5a455e9", }; mockGrpcClient.Setup(x => x.CreateTransferJob(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); TransferJob response = client.CreateTransferJob(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Initializes a new instance of the <see cref="BlockBlobServiceSideSyncCopyController"/> 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 BlockBlobServiceSideSyncCopyController( TransferScheduler scheduler, TransferJob transferJob, CancellationToken userCancellationToken) : base(scheduler, transferJob, userCancellationToken) { TransferLocation sourceLocation = transferJob.Source; if (sourceLocation.Type == TransferLocationType.AzureBlob) { var blobLocation = sourceLocation as AzureBlobLocation; 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.destBlockBlob = this.destLocation.Blob as CloudBlockBlob; this.DestHandler = new ServiceSideSyncCopyDest.BlockBlobDestHandler(this.destLocation, transferJob); this.hasWork = true; }
public FileDestHandler(AzureFileLocation destLocation, TransferJob transferJob) { this.destLocation = destLocation; this.transferJob = transferJob; this.transferContext = this.transferJob.Transfer.Context; this.destFile = this.destLocation.AzureFile; }
protected RangeBasedServiceSideSyncCopy( TransferScheduler transferScheduler, TransferJob transferJob, CancellationToken userCancellationToken) : base(transferScheduler, transferJob, userCancellationToken) { }
/// <summary> /// Start copy using transfer mangager by source uri /// </summary> /// <param name="uri">source uri</param> /// <param name="destContainer">Destination CloudBlobContainer object</param> /// <param name="destBlobName">Destination blob name</param> /// <returns>Destination CloudBlob object</returns> private async Task StartCopyInTransferManager(long taskId, IStorageBlobManagement destChannel, Uri uri, CloudBlobContainer destContainer, string destBlobName) { NameUtil.ValidateContainerName(destContainer.Name); NameUtil.ValidateBlobName(destBlobName); Dictionary <string, string> BlobPath = new Dictionary <string, string>() { { "Container", destContainer.Name }, { "Blob", destBlobName } }; DataMovementUserData data = new DataMovementUserData() { Data = BlobPath, TaskId = taskId, Channel = destChannel, Record = null }; TransferJob startCopyJob = new TransferJob( new TransferLocation(uri), new TransferLocation(destContainer.GetBlockBlobReference(destBlobName)), TransferMethod.AsyncCopyInAzureStorageWithoutMonitor); await this.EnqueueStartCopyJob(startCopyJob, data); }
protected async Task RunTransferJob(TransferJob job, ProgressRecord record) { this.SetRequestOptionsInTransferJob(job); job.OverwritePromptCallback = this.ConfirmOverwrite; try { await this.transferJobRunner.RunTransferJob(job, (percent, speed) => { record.PercentComplete = (int)percent; record.StatusDescription = string.Format(CultureInfo.CurrentCulture, Resources.FileTransmitStatus, (int)percent, Util.BytesToHumanReadableSize(speed)); this.OutputStream.WriteProgress(record); }, this.CmdletCancellationToken); record.PercentComplete = 100; record.StatusDescription = Resources.TransmitSuccessfully; this.OutputStream.WriteProgress(record); } catch (OperationCanceledException) { record.StatusDescription = Resources.TransmitCancelled; this.OutputStream.WriteProgress(record); } catch (Exception e) { record.StatusDescription = string.Format(CultureInfo.CurrentCulture, Resources.TransmitFailed, e.Message); this.OutputStream.WriteProgress(record); throw; } }
public string GetTransferJob() { List <TransferJob> lstTransferJob = new List <TransferJob>(); DataSet _dsTransferJob = _dbHelper.GetAllTransferJobDS(); _dsTransferJob.Tables[0].Columns.Add("StatusLocal"); foreach (DataRow row in _dsTransferJob.Tables[0].Rows) { TransferJob transferJob = new TransferJob(); transferJob.JobUid = row["JobUID"].ToString().Trim(); transferJob.DeliveryStatus = row["Status"].ToString().Trim(); transferJob.PatientName = row["PatientName"].ToString().Trim(); transferJob.PatientId = row["PatientId"].ToString().Trim(); transferJob.CreatedDate = row["CreateDateTime"].ToString().Trim(); transferJob.Type = row["Type"].ToString().Trim(); transferJob.ImageCount = row["ItemTotalNumber"].ToString().Trim(); transferJob.DeliveryName = row["JobName"].ToString().Trim(); transferJob.Destination = row["Destination"].ToString().Trim(); transferJob.FinishedNumber = row["ExecutedNumber"].ToString().Trim(); transferJob.SuccessNumber = row["SuccessNumber"].ToString().Trim(); transferJob.CompressionRatio = row["CompressionRatio"].ToString().Trim(); lstTransferJob.Add(transferJob); } return(_commonTool.GetJsonStringFromObject(lstTransferJob)); }
/// <summary> /// Download blob to local file /// </summary> /// <param name="blob">Source blob object</param> /// <param name="filePath">Destination file path</param> internal virtual async Task DownloadBlob(long taskId, IStorageBlobManagement localChannel, CloudBlob blob, string filePath) { string activity = String.Format(Resources.ReceiveAzureBlobActivity, blob.Name, filePath); string status = Resources.PrepareDownloadingBlob; ProgressRecord pr = new ProgressRecord(OutputStream.GetProgressId(taskId), activity, status); DataMovementUserData data = new DataMovementUserData() { Data = blob, TaskId = taskId, Channel = localChannel, Record = pr }; TransferJob downloadJob = new TransferJob( new TransferLocation(blob), new TransferLocation(filePath), TransferMethod.SyncCopy); BlobRequestOptions requestOptions = downloadJob.Source.RequestOptions as BlobRequestOptions; if (null == requestOptions) { requestOptions = new BlobRequestOptions(); } requestOptions.DisableContentMD5Validation = !checkMd5; downloadJob.Source.RequestOptions = requestOptions; await this.RunTransferJob(downloadJob, data); this.WriteCloudBlobObject(data.TaskId, data.Channel, blob); }
public SyncTransferController( TransferScheduler transferScheduler, TransferJob transferJob, CancellationToken userCancellationToken) : base(transferScheduler, transferJob, userCancellationToken) { if (null == transferScheduler) { throw new ArgumentNullException("transferScheduler"); } if (null == transferJob) { throw new ArgumentNullException("transferJob"); } this.SharedTransferData = new SharedTransferData() { TransferJob = this.TransferJob, AvailableData = new ConcurrentDictionary <long, TransferData>(), }; if (null == transferJob.CheckPoint) { transferJob.CheckPoint = new SingleObjectCheckpoint(); } reader = this.GetReader(transferJob.Source); writer = this.GetWriter(transferJob.Destination); }
private void RunSP(object jobName) { try { DataRow rowOfJob = this.FindRow(jobName.ToString()); rowOfJob["RunStatus"] = "运行中"; ProcedureParameter pp1 = new ProcedureParameter("v_jobList", typeof(string), 40, DirectionType.Input, jobName.ToString()); ProcedureParameter pp2 = new ProcedureParameter("v_date", typeof(int), 8, DirectionType.Input, m_InputDate); ProcedureCondition pc = new ProcedureCondition("PKG_DBTRANSFER.Transfer", new ProcedureParameter[] { pp1, pp2 }); // 多线程Run每一个任务,每一个任务自己创建自己的数据库链接 IDomainDataProvider newProvider = DomainDataProviderManager.DomainDataProvider(); newProvider.CustomProcedure(ref pc); Thread.Sleep(10000); rowOfJob["RunStatus"] = "完成"; TransferJob job = TransferFacade.GetTransferJob(Convert.ToInt32(rowOfJob["Serial"])) as TransferJob; rowOfJob["LastRunDate"] = job.LastRunDate == 0 ? "0" : FormatHelper.TODateTimeString(job.LastRunDate, job.LastRunTime); rowOfJob["LastSuccessDate"] = job.LastSuccessDate == 0 ? "0" : FormatHelper.TODateTimeString(job.LastSuccessDate, job.LastSuccessTime); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { this.Invoke(new Action <int>(this.SetFlag), 1); } }
public BlobSourceHandler(AzureBlobLocation sourceBlobLocation, TransferJob transferJob) { this.sourceLocation = sourceBlobLocation; this.transferJob = transferJob; this.sourceBlob = this.sourceLocation.Blob; this.transferContext = this.transferJob.Transfer.Context; }
public SyncTransferController( TransferScheduler transferScheduler, TransferJob transferJob, CancellationToken userCancellationToken) : base(transferScheduler, transferJob, userCancellationToken) { if (null == transferScheduler) { throw new ArgumentNullException("transferScheduler"); } if (null == transferJob) { throw new ArgumentNullException("transferJob"); } this.SharedTransferData = new SharedTransferData() { TransferJob = this.TransferJob, AvailableData = new ConcurrentDictionary<long, TransferData>(), }; if (null == transferJob.CheckPoint) { transferJob.CheckPoint = new SingleObjectCheckpoint(); } reader = this.GetReader(transferJob.Source); writer = this.GetWriter(transferJob.Destination); }
public async stt::Task GetTransferJobRequestObjectAsync() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetTransferJobRequest request = new GetTransferJobRequest { JobName = "job_namedc176648", ProjectId = "project_id43ad98b0", }; TransferJob expectedResponse = new TransferJob { Name = "name1c9368b0", Description = "description2cf9da67", ProjectId = "project_id43ad98b0", TransferSpec = new TransferSpec(), Schedule = new Schedule(), Status = TransferJob.Types.Status.Disabled, CreationTime = new wkt::Timestamp(), LastModificationTime = new wkt::Timestamp(), DeletionTime = new wkt::Timestamp(), NotificationConfig = new NotificationConfig(), LatestOperationName = "latest_operation_namef5a455e9", }; mockGrpcClient.Setup(x => x.GetTransferJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TransferJob>(stt::Task.FromResult(expectedResponse), null, null, null, null)); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); TransferJob responseCallSettings = await client.GetTransferJobAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); TransferJob responseCancellationToken = await client.GetTransferJobAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public FileSourceHandler(AzureFileLocation sourceLocation, TransferJob transferJob) { this.sourceLocation = sourceLocation; this.transferJob = transferJob; this.sourceFile = this.sourceLocation.AzureFile; this.transferContext = this.transferJob.Transfer.Context; }
public StreamedReader( TransferScheduler scheduler, SyncTransferController controller, CancellationToken cancellationToken) : base(scheduler, controller, cancellationToken) { this.transferJob = this.SharedTransferData.TransferJob; this.hasWork = true; }
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; }
/// <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) { this.destPageBlob = destLocation.Blob as CloudPageBlob; this.hasWork = true; }
// Build a job chain with a given scanner. JobHandle BuildJobChain(float3 origin, Scanner scanner, JobHandle deps) { // Transform output destination var transforms = _voxelGroup.GetComponentDataArray <LocalToWorld>(); if (transforms.Length == 0) { return(deps); } if (_pTransformCount == null) { // Initialize the transform counter. _pTransformCount = (int *)UnsafeUtility.Malloc( sizeof(int), sizeof(int), Allocator.Persistent); *_pTransformCount = 0; } else { // Wrap around the transform counter to avoid overlfow. *_pTransformCount %= transforms.Length; } // Total count of rays var total = scanner.Resolution.x * scanner.Resolution.y; // Ray cast command/result array var commands = new NativeArray <RaycastCommand>(total, Allocator.TempJob); var hits = new NativeArray <RaycastHit>(total, Allocator.TempJob); // 1: Set-up jobs var setupJob = new SetupJob { Commands = commands, Origin = origin, Extent = scanner.Extent, Resolution = scanner.Resolution }; deps = setupJob.Schedule(total, 64, deps); // 2: Raycast jobs deps = RaycastCommand.ScheduleBatch(commands, hits, 16, deps); // 3: Transfer jobs var transferJob = new TransferJob { RaycastCommands = commands, RaycastHits = hits, Scale = scanner.Extent.x * 2 / scanner.Resolution.x, Transforms = transforms, pCounter = _pTransformCount }; deps = transferJob.Schedule(total, 64, deps); return(deps); }
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 StreamedReader( TransferScheduler scheduler, SyncTransferController controller, CancellationToken cancellationToken) : base(scheduler, controller, cancellationToken) { this.transferJob = this.SharedTransferData.TransferJob; this.workToken = 1; this.readLength = 0; }
public RangeBasedReader( TransferScheduler scheduler, SyncTransferController controller, CancellationToken cancellationToken) : base(scheduler, controller, cancellationToken) { this.transferJob = this.SharedTransferData.TransferJob; this.Location = this.transferJob.Source; this.workToken = 1; }
public Task RunTransferJob(TransferJob job, Action <double, double> progressReport, CancellationToken cancellationToken) { try { return(runnerValidation(job)); } catch (AssertFailedException e) { this.assertException = e; throw new MockupException("AssertFailed"); } }
protected override void OnUpdate() { var transferJob = new TransferJob() { transferRate = GenericInformation.TransferRate, potentialGroup = GetComponentDataFromEntity <PotentialValue>() }; Dependency = transferJob.Schedule(stepPhysicsWorld.Simulation, ref buildPhysicsWorld.PhysicsWorld, Dependency); // Finishes all accumulated events before going for the next task Dependency.Complete(); }
/// <summary> /// Initializes a new instance of the <see cref="AsyncCopyController"/> 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 AsyncCopyController( TransferScheduler scheduler, TransferJob transferJob, CancellationToken userCancellationToken) : base(scheduler, transferJob, userCancellationToken) { if (null == transferJob.Destination) { throw new ArgumentException( string.Format( CultureInfo.CurrentCulture, Resources.ParameterCannotBeNullException, "Dest"), "transferJob"); } switch (this.TransferJob.Source.Type) { case TransferLocationType.AzureBlob: this.SourceBlob = (this.TransferJob.Source as AzureBlobLocation).Blob; break; case TransferLocationType.AzureFile: this.SourceFile = (this.TransferJob.Source as AzureFileLocation).AzureFile; break; case TransferLocationType.SourceUri: this.SourceUri = (this.TransferJob.Source as UriLocation).Uri; break; default: throw new ArgumentException( string.Format( CultureInfo.CurrentCulture, Resources.ProvideExactlyOneOfThreeParameters, "Source.SourceUri", "Source.Blob", "Source.AzureFile"), "transferJob"); } // initialize the status refresh timer this.statusRefreshTimer = new Timer( new TimerCallback( delegate(object timerState) { this.hasWork = true; #if DOTNET5_4 }), null, -1, Timeout.Infinite); #else }));
/// <summary> /// Initializes a new instance of the <see cref="AsyncCopyController"/> 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 AsyncCopyController( TransferScheduler scheduler, TransferJob transferJob, CancellationToken userCancellationToken) : base(scheduler, transferJob, userCancellationToken) { if (null == transferJob.Destination) { throw new ArgumentException( string.Format( CultureInfo.CurrentCulture, Resources.ParameterCannotBeNullException, "Dest"), "transferJob"); } switch(this.TransferJob.Source.Type) { case TransferLocationType.AzureBlob: this.SourceBlob = (this.TransferJob.Source as AzureBlobLocation).Blob; break; case TransferLocationType.AzureFile: this.SourceFile = (this.TransferJob.Source as AzureFileLocation).AzureFile; break; case TransferLocationType.SourceUri: this.SourceUri = (this.TransferJob.Source as UriLocation).Uri; break; default: throw new ArgumentException( string.Format( CultureInfo.CurrentCulture, Resources.ProvideExactlyOneOfThreeParameters, "Source.SourceUri", "Source.Blob", "Source.AzureFile"), "transferJob"); } // initialize the status refresh timer this.statusRefreshTimer = new Timer( new TimerCallback( delegate(object timerState) { this.hasWork = true; })); this.SetInitialStatus(); }
/// <summary>Snippet for CreateTransferJob</summary> public void CreateTransferJobRequestObject() { // Snippet: CreateTransferJob(CreateTransferJobRequest, CallSettings) // Create client StorageTransferServiceClient storageTransferServiceClient = StorageTransferServiceClient.Create(); // Initialize request argument(s) CreateTransferJobRequest request = new CreateTransferJobRequest { TransferJob = new TransferJob(), }; // Make the request TransferJob response = storageTransferServiceClient.CreateTransferJob(request); // End snippet }
/// <summary> /// upload file to azure blob /// </summary> /// <param name="taskId">Task id</param> /// <param name="filePath">local file path</param> /// <param name="blob">destination azure blob object</param> internal virtual async Task Upload2Blob(long taskId, IStorageBlobManagement localChannel, string filePath, StorageBlob.CloudBlob blob) { string activity = String.Format(Resources.SendAzureBlobActivity, filePath, blob.Name, blob.Container.Name); string status = Resources.PrepareUploadingBlob; ProgressRecord pr = new ProgressRecord(OutputStream.GetProgressId(taskId), activity, status); DataMovementUserData data = new DataMovementUserData() { Data = blob, TaskId = taskId, Channel = localChannel, Record = pr }; TransferJob uploadJob = new TransferJob( new TransferLocation(filePath), new TransferLocation(blob), TransferMethod.SyncCopy); await this.RunTransferJob(uploadJob, data); if (this.BlobProperties != null || this.BlobMetadata != null) { await TaskEx.WhenAll( this.SetBlobProperties(localChannel, blob, this.BlobProperties), this.SetBlobMeta(localChannel, blob, this.BlobMetadata)); } try { await localChannel.FetchBlobAttributesAsync( blob, AccessCondition.GenerateEmptyCondition(), this.RequestOptions, this.OperationContext, this.CmdletCancellationToken); } catch (StorageException e) { //Handle the limited read permission. if (!e.IsNotFoundException()) { throw; } } WriteCloudBlobObject(data.TaskId, localChannel, blob); }
/// <summary>Snippet for GetTransferJob</summary> public void GetTransferJobRequestObject() { // Snippet: GetTransferJob(GetTransferJobRequest, CallSettings) // Create client StorageTransferServiceClient storageTransferServiceClient = StorageTransferServiceClient.Create(); // Initialize request argument(s) GetTransferJobRequest request = new GetTransferJobRequest { JobName = "", ProjectId = "", }; // Make the request TransferJob response = storageTransferServiceClient.GetTransferJob(request); // End snippet }
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; }
public Guid CreateJob(RequestHeaders headers) { var job = new TransferJob { JobGuid = Guid.NewGuid(), ChunkSizeBytes = headers.ChunkSizeBytes, TotalChunks = headers.TotalChunks, Status = JobStatus.Received }; using (var dbContext = GetContext()) { dbContext.TransferJobs.Add(job); dbContext.SaveChanges(); } return(job.JobGuid); }
/// <summary>Snippet for UpdateTransferJob</summary> public void UpdateTransferJobRequestObject() { // Snippet: UpdateTransferJob(UpdateTransferJobRequest, CallSettings) // Create client StorageTransferServiceClient storageTransferServiceClient = StorageTransferServiceClient.Create(); // Initialize request argument(s) UpdateTransferJobRequest request = new UpdateTransferJobRequest { JobName = "", ProjectId = "", TransferJob = new TransferJob(), UpdateTransferJobFieldMask = new FieldMask(), }; // Make the request TransferJob response = storageTransferServiceClient.UpdateTransferJob(request); // End snippet }
/// <summary>Snippet for CreateTransferJobAsync</summary> public async Task CreateTransferJobRequestObjectAsync() { // Snippet: CreateTransferJobAsync(CreateTransferJobRequest, CallSettings) // Additional: CreateTransferJobAsync(CreateTransferJobRequest, CancellationToken) // Create client StorageTransferServiceClient storageTransferServiceClient = await StorageTransferServiceClient.CreateAsync(); // Initialize request argument(s) CreateTransferJobRequest request = new CreateTransferJobRequest { TransferJob = new TransferJob(), }; // Make the request TransferJob response = await storageTransferServiceClient.CreateTransferJobAsync(request); // End snippet }
public static AsyncCopyController CreateAsyncCopyController(TransferScheduler transferScheduler, TransferJob transferJob, CancellationToken cancellationToken) { if (transferJob.Destination.Type == TransferLocationType.AzureFile) { return new FileAsyncCopyController(transferScheduler, transferJob, cancellationToken); } if (transferJob.Destination.Type == TransferLocationType.AzureBlob) { return new BlobAsyncCopyController(transferScheduler, transferJob, cancellationToken); } throw new InvalidOperationException(Resources.CanOnlyCopyToFileOrBlobException); }
private void JobComplete(TransferJob job) { jobList.Remove(job.File.Path); }
private bool CheckPieceData(TransferJob job, PieceInfo piece) { string path = fileModule._context.MainPath.ToFull(piece.RelFilePath); // TODO: to jest zle na razie (stala wielkosc) byte[] data = _dataManager.ReadPiece(path, ExchUtils.GetInFilePosition(piece), ExchUtils.StandardPieceSize); return job.CheckData(piece, data, ExchUtils.StandardPieceSize); }