| 3019 | |
| 3020 | |
| 3021 | bool HierarchicalAllocatorProcess::updateSlaveTotal( |
| 3022 | const SlaveID& slaveId, |
| 3023 | const Resources& total) |
| 3024 | { |
| 3025 | Slave& slave = *CHECK_NOTNONE(getSlave(slaveId)); |
| 3026 | |
| 3027 | const Resources oldTotal = slave.getTotal(); |
| 3028 | |
| 3029 | if (oldTotal == total) { |
| 3030 | return false; |
| 3031 | } |
| 3032 | |
| 3033 | slave.updateTotal(total); |
| 3034 | |
| 3035 | roleTree.untrackReservations(oldTotal.reserved()); |
| 3036 | roleTree.trackReservations(total.reserved()); |
| 3037 | |
| 3038 | // Update the total in the allocator and totals in the sorters. |
| 3039 | const ResourceQuantities oldAgentScalarQuantities = |
| 3040 | ResourceQuantities::fromScalarResources(oldTotal.scalars()); |
| 3041 | |
| 3042 | const ResourceQuantities agentScalarQuantities = |
| 3043 | ResourceQuantities::fromScalarResources(total.scalars()); |
| 3044 | |
| 3045 | CHECK_CONTAINS(totalScalarQuantities, oldAgentScalarQuantities); |
| 3046 | totalScalarQuantities -= oldAgentScalarQuantities; |
| 3047 | totalScalarQuantities += agentScalarQuantities; |
| 3048 | |
| 3049 | roleSorter->removeSlave(slaveId); |
| 3050 | roleSorter->addSlave(slaveId, agentScalarQuantities); |
| 3051 | |
| 3052 | foreachvalue (const Owned<Sorter>& sorter, frameworkSorters) { |
| 3053 | sorter->removeSlave(slaveId); |
| 3054 | sorter->addSlave(slaveId, agentScalarQuantities); |
| 3055 | } |
| 3056 | |
| 3057 | return true; |
| 3058 | } |
| 3059 | |
| 3060 | |
| 3061 | bool HierarchicalAllocatorProcess::isRemoteSlave(const Slave& slave) const |
nothing calls this directly
no test coverage detected