Example #1
0
        /// <nodoc />
        public BoolResult SetMachineStates(BitMachineIdSet inactiveMachines, BitMachineIdSet closedMachines = null)
        {
            bool updateBinManager = false;

            if (inactiveMachines != null)
            {
                _inactiveMachinesSet = inactiveMachines;
                InactiveMachines     = inactiveMachines.EnumerateMachineIds().ToArray();
                updateBinManager     = true;
            }

            if (closedMachines != null)
            {
                _closedMachinesSet = closedMachines;
                ClosedMachines     = closedMachines.EnumerateMachineIds().ToArray();
            }

            if (EnableBinManagerUpdates && BinManager != null && updateBinManager)
            {
                // Closed machines aren't included in the bin manager's update because they are expected to be back
                // soon, so it doesn't make much sense to reorganize the stamp because of them.
                var activeMachines = _idByLocationMap.Values.Except(InactiveMachines).ToArray();
                return(BinManager.UpdateAll(activeMachines, InactiveMachines));
            }

            return(BoolResult.Success);
        }
Example #2
0
        /// <nodoc />
        public void SetInactiveMachines(BitMachineIdSet inactiveMachines)
        {
            _inactiveMachinesSet = inactiveMachines;
            InactiveMachines     = inactiveMachines.EnumerateMachineIds().ToArray();

            if (EnableBinManagerUpdates && BinManager != null)
            {
                var activeMachines = _idByLocationMap.Values.Except(InactiveMachines).ToArray();
                BinManager.UpdateAll(activeMachines, InactiveMachines);
            }
        }