示例#1
0
        public BoolResult UpdateAll(IReadOnlyList <MachineId> activeMachines, IReadOnlySet <MachineId> inactiveMachines)
        {
            try
            {
                lock (_lockObject)
                {
                    // Remove active machines that became inactive or disappeared.
                    var machinesToRemove = _machinesToBinsMap.Keys.Except(activeMachines).ToList();

                    foreach (var machine in activeMachines)
                    {
                        AddLocation(machine);
                    }

                    foreach (var machine in inactiveMachines.Concat(machinesToRemove))
                    {
                        RemoveLocation(machine);
                    }
                }

                return(BoolResult.Success);
            }
            catch (Exception e)
            {
                return(new BoolResult(e, $"{nameof(BinManager)}.{nameof(UpdateAll)} failed."));
            }
        }
示例#2
0
        /// <nodoc />
        public SpecBindingSymbols([CanBeNull] IReadOnlySet <InteractionSymbol> declaredSymbols, [CanBeNull] IReadOnlySet <InteractionSymbol> referencedSymbols, [NotNull] string declaredSymbolsFingerpint, [NotNull] string referencedSymbolsFingerprint)
            : this(declaredSymbolsFingerpint, referencedSymbolsFingerprint)
        {
            if (declaredSymbols != null && referencedSymbols != null)
            {
                Symbols = new HashSet <InteractionSymbol>(declaredSymbols.Concat(referencedSymbols)).ToReadOnlySet();
            }

            DeclaredSymbols   = declaredSymbols;
            ReferencedSymbols = referencedSymbols;
        }