private Segment[] GetMatchingSegments(IEnumerable <int> segments, NodeEndpoint endpoint) { var matchingSegments = segments.Select(i => Segments[i]).ToArray(); var segmentsNotBeloningToThespecifiedEndpoint = matchingSegments .Where(x => x.InProcessOfMovingToEndpoint != null) .Where(x => endpoint.Equals(x.InProcessOfMovingToEndpoint) == false && x.PendingBackups.Contains(endpoint) == false); if (segmentsNotBeloningToThespecifiedEndpoint.Count() != 0) { throw new InvalidOperationException("Could not catch up or give up on segments that belong to another endpoint"); } return(matchingSegments); }
public bool BelongsTo(NodeEndpoint endpoint) { return endpoint.Equals(AssignedEndpoint) || endpoint.Equals(InProcessOfMovingToEndpoint); }
public bool BelongsTo(NodeEndpoint endpoint) { return(endpoint.Equals(AssignedEndpoint) || endpoint.Equals(InProcessOfMovingToEndpoint)); }