| 1913 | } |
| 1914 | |
| 1915 | void Scheduler::AddressableAssignmentHeap::InsertOrUpdate( |
| 1916 | const IpAddr& ip, int64_t assigned_bytes, int rank) { |
| 1917 | auto handle_it = executor_handles_.find(ip); |
| 1918 | if (handle_it == executor_handles_.end()) { |
| 1919 | AssignmentHeap::handle_type handle = executor_heap_.push({assigned_bytes, rank, ip}); |
| 1920 | executor_handles_.emplace(ip, handle); |
| 1921 | } else { |
| 1922 | // We need to rebuild the heap after every update operation. Calling decrease once is |
| 1923 | // sufficient as both assignments decrease the key. |
| 1924 | AssignmentHeap::handle_type handle = handle_it->second; |
| 1925 | (*handle).assigned_bytes += assigned_bytes; |
| 1926 | executor_heap_.decrease(handle); |
| 1927 | } |
| 1928 | } |
| 1929 | } |
no test coverage detected