Пример #1
0
 public void Cancel(Rid rid)
 {
     if (_jobs.Remove(rid, out IPriorityQueueHandle <Job> h))
     {
         var job = _jobQueue.Delete(h);
         _userJobs.Remove(job._ip);
         Console.WriteLine($"Cancelled {job}");
     }
 }
Пример #2
0
        public Rid Submit(Ip ip, int time)
        {
            var jobCount = _userJobs.ContainsCount(ip);
            var rid      = new Rid();
            var job      = new Job(rid, ip, time + 60 * jobCount);
            IPriorityQueueHandle <Job> h = default;

            _jobQueue.Add(ref h, job);
            _userJobs.Add(ip);
            _jobs.Add(rid, h);

            Console.WriteLine($"Submitted {job}");

            return(rid);
        }
Пример #3
0
 public override string ToString()
 {
     return(Rid.ToString());
 }
Пример #4
0
 public Job(Rid rid, Ip ip, int time)
 {
     _rid  = rid;
     _ip   = ip;
     _time = time;
 }
Пример #5
0
 public Job(Rid rid, Ip ip, int time)
 {
     Rid  = rid;
     Ip   = ip;
     Time = time;
 }