Esempio n. 1
0
        public IEnumerable <Task> ToCorrectionTasks(IPersistentTasks tasks)
        {
            if (_removals.Any())
            {
                yield return(RemoveUnavailableOwnership());
            }

            foreach (var taskStatus in _status)
            {
                foreach (var task in taskStatus.ToTasks(tasks, _availablePeers))
                {
                    yield return(task);
                }
            }
        }
        public IEnumerable<Task> ToCorrectionTasks(IPersistentTasks tasks)
        {
            if (_removals.Any())
            {
                yield return RemoveUnavailableOwnership();
            }

            foreach (var taskStatus in _status)
            {
                foreach (var task in taskStatus.ToTasks(tasks, _availablePeers))
                {
                    yield return task;
                }
            }
        }
Esempio n. 3
0
        public IEnumerable<Task> ToTasks(IPersistentTasks tasks, IList<ITransportPeer> availablePeers)
        {
            switch (ValidOwners.Count)
            {
                case 0:
                    yield return tasks.Reassign(Subject, availablePeers, InvalidOwners);
                    break;

                case 1:
                    foreach (var transportPeer in InvalidOwners)
                    {
                        yield return transportPeer.Deactivate(Subject);
                    }
                    break;

                default:
                    yield return tasks.Reassign(Subject, availablePeers, InvalidOwners.Union(ValidOwners).ToList());
                    break;
            }
        }
Esempio n. 4
0
        public IEnumerable <Task> ToTasks(IPersistentTasks tasks, IList <ITransportPeer> availablePeers)
        {
            switch (ValidOwners.Count)
            {
            case 0:
                yield return(tasks.Reassign(Subject, availablePeers, InvalidOwners));

                break;

            case 1:
                foreach (var transportPeer in InvalidOwners)
                {
                    yield return(transportPeer.Deactivate(Subject));
                }
                break;

            default:
                yield return(tasks.Reassign(Subject, availablePeers, InvalidOwners.Union(ValidOwners).ToList()));

                break;
            }
        }