/// <summary> /// Encapsulates the given <paramref name="request"/> within a <see cref="GeolocationBatchUpdateJob"/> /// along with the <see cref="IPGeolocationProcessor"/> delegate to eventually invoke when /// processing begins /// </summary> /// <param name="request">The <see cref="List{T}"/> of <see cref="IPGeolocationUpdateRequest"/></param> /// <param name="processor">The <see cref="IPGeolocationProcessor"/> delegate to invoke at processing time</param> /// <returns> /// The assigned <see cref="Guid"/> associated with the newly created /// <see cref="GeolocationBatchUpdateJob"/> /// </returns> public Guid AddJob(List <IPGeolocationUpdateRequest> request, IPGeolocationProcessor processor) { var backgroundJob = new GeolocationBatchUpdateJob(request, processor); PendingJobs.Add(backgroundJob); return(backgroundJob.Id); }
/// <summary> /// Moves the provided <see cref="GeolocationBatchUpdateJob"/> from executing to completed /// </summary> /// <param name="job">The <see cref="GeolocationBatchUpdateJob"/> to move</param> private void MoveExecutingToCompleted(GeolocationBatchUpdateJob job) { ExecutingJobs.Remove(job); CompletedJobs.Add(job); Buffer.Remove(job.Id); }
/// <summary> /// Moves the provided <see cref="GeolocationBatchUpdateJob"/> from pending to executing /// </summary> /// <param name="job">The <see cref="GeolocationBatchUpdateJob"/> to move</param> private void MovePendingToExecuting(GeolocationBatchUpdateJob job) { PendingJobs.Remove(job); ExecutingJobs.Add(job); Buffer.Add(job.Id, job.Request as List <IPGeolocationUpdateRequest>); }