public Task ResetAsync(CancellationToken cancellationToken = default(CancellationToken)) { _skipHandler = new SkipTokenHandler(); _currentIndex = -1; _currentBatch = null; return(Async.CompletedTask); }
private void ProcessPage(IPage <Models.CloudJob> currentPage, SkipTokenHandler skipHandler) { // remember any skiptoken returned. This also sets the bool skipHandler.SkipToken = currentPage.NextPageLink; // remember the protocol tasks returned base._currentBatch = null; if (null != currentPage.GetEnumerator()) { base._currentBatch = currentPage.ToArray(); } }
/// <summary> /// fetch another batch of objects from the server /// </summary> protected async override Task GetNextBatchFromServerAsync(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { do { // start the protocol layer call var asyncTask = GetTaskResult(skipHandler, cancellationToken); var response = await asyncTask.ConfigureAwait(continueOnCapturedContext : false); // remember any skiptoken returned. This also sets the bool skipHandler.SkipToken = response.Body.NextPageLink; // remember the protocol tasks returned _currentBatch = null; if (null != response.Body.GetEnumerator()) { _currentBatch = response.Body.ToArray(); } } // it is possible for there to be no results so we keep trying while (skipHandler.ThereIsMoreData && ((null == _currentBatch) || _currentBatch.Length <= 0)); }
internal override Task <AzureOperationResponse <IPage <Models.NodeFile>, Models.FileListFromTaskHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_jobOperations.ParentBatchClient.ProtocolLayer.ListNodeFilesByTask( _jobId, _taskId, _recursive, skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }
/// <summary> /// fetch another batch of objects from the server /// </summary> protected async override System.Threading.Tasks.Task GetNextBatchFromServerAsync(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { do { // start the protocol layer call if (string.IsNullOrEmpty(_jobScheduleIdForcesListByJobSchedule)) { Task <AzureOperationResponse <IPage <Models.CloudJob>, Models.JobListHeaders> > asyncTask = this._parentBatchClient.ProtocolLayer.ListJobsAll( skipHandler.SkipToken, _behaviorMgr, _detailLevel, cancellationToken); var response = await asyncTask.ConfigureAwait(continueOnCapturedContext : false); this.ProcessPage(response.Body, skipHandler); } else { Task <AzureOperationResponse <IPage <Models.CloudJob>, Models.JobListFromJobScheduleHeaders> > asyncTask = this._parentBatchClient.ProtocolLayer.ListJobsBySchedule( _jobScheduleIdForcesListByJobSchedule, skipHandler.SkipToken, _behaviorMgr, _detailLevel, cancellationToken); var response = await asyncTask.ConfigureAwait(continueOnCapturedContext : false); this.ProcessPage(response.Body, skipHandler); } } // it is possible for there to be no results so we keep trying while (skipHandler.ThereIsMoreData && ((null == _currentBatch) || _currentBatch.Length <= 0)); }
/// <summary> /// fetch another batch of objects from the server /// </summary> protected override async System.Threading.Tasks.Task GetNextBatchFromServerAsync(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { do { // start the protocol layer call var asyncTask = _parentPoolOperations.ParentBatchClient.ProtocolLayer.ListPoolNodeCounts( skipHandler.SkipToken, _behaviorMgr, _detailLevel, cancellationToken); var response = await asyncTask.ConfigureAwait(continueOnCapturedContext : false); // remember any skiptoken returned. This also sets the bool skipHandler.SkipToken = response.Body.NextPageLink; // remember the protocol tasks returned base._currentBatch = null; if (null != response.Body.GetEnumerator()) { base._currentBatch = response.Body.ToArray(); } } // it is possible for there to be no results so we keep trying while (skipHandler.ThereIsMoreData && ((null == _currentBatch) || _currentBatch.Length <= 0)); }
internal override Task <AzureOperationResponse <IPage <Models.ImageInformation>, Models.AccountListSupportedImagesHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_parentPoolOps.ParentBatchClient.ProtocolLayer.ListSupportedImages( skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }
/// <summary> /// fetch another batch of objects from the server /// </summary> protected async override System.Threading.Tasks.Task GetNextBatchFromServerAsync(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { do { // start the protocol layer call var asyncTask = _parentJobOperations.ParentBatchClient.ProtocolLayer.ListSubtasks( _jobId, _taskId, skipHandler.SkipToken, _behaviorMgr, _detailLevel, cancellationToken); var response = await asyncTask.ConfigureAwait(continueOnCapturedContext : false); //TODO: For now this is always null because the service doesn't ever return a skiptoken for this operation //TODO: Do not follow this code pattern elsewhere as it will not correctly traverse the skiptoken. //TODO: Note that setting this to null sets the "_hasBeenCalled" boolean which is important for the functioning of the //TODO: list functionality (see the code). skipHandler.SkipToken = null; // remember the protocol tasks returned base._currentBatch = null; if (null != response.Body.Value.GetEnumerator()) { base._currentBatch = response.Body.Value.ToArray(); } } // it is possible for there to be no results so we keep trying while (skipHandler.ThereIsMoreData && ((null == base._currentBatch) || base._currentBatch.Length <= 0)); }
internal override Task <AzureOperationResponse <IPage <Models.CloudJobSchedule>, Models.JobScheduleListHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_parentJobScheduleOperations.ParentBatchClient.ProtocolLayer.ListJobSchedules( skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }
internal override Task <AzureOperationResponse <IPage <Models.CloudTask>, Models.TaskListHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_jobOperations.ParentBatchClient.ProtocolLayer.ListTasks( _jobId, skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }
internal override Task <AzureOperationResponse <IPage <Models.JobPreparationAndReleaseTaskExecutionInformation>, Models.JobListPreparationAndReleaseTaskStatusHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_parentJobOperations.ParentBatchClient.ProtocolLayer.ListJobPreparationAndReleaseTaskStatus( _jobId, skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }
internal override Task <AzureOperationResponse <IPage <Models.NodeVMExtension>, Models.ComputeNodeExtensionListHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_parentPoolOperations.ParentBatchClient.ProtocolLayer.ListComputeNodeExtensions( _poolId, _nodeId, skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }
protected abstract System.Threading.Tasks.Task GetNextBatchFromServerAsync(SkipTokenHandler skipHandler, CancellationToken cancellationToken); // fetch another batch of objects from the server
internal abstract Task <AzureOperationResponse <IPage <ProtocolType>, ProtocolHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken);
internal override Task <AzureOperationResponse <IPage <Models.PoolUsageMetrics>, Models.PoolListUsageMetricsHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_parentPoolOperations.ParentBatchClient.ProtocolLayer.ListPoolUsageMetrics( _startTime, _endTime, skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }
internal override System.Threading.Tasks.Task <Rest.Azure.AzureOperationResponse <Rest.Azure.IPage <Models.PoolNodeCounts>, Models.AccountListPoolNodeCountsHeaders> > GetTaskResult(SkipTokenHandler skipHandler, CancellationToken cancellationToken) { return(_parentPoolOperations.ParentBatchClient.ProtocolLayer.ListPoolNodeCounts( skipHandler.SkipToken, behaviorMgr, detailLevel, cancellationToken)); }