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);
        }
Exemplo n.º 2
0
 public bool BelongsTo(NodeEndpoint endpoint)
 {
     return endpoint.Equals(AssignedEndpoint) ||
            endpoint.Equals(InProcessOfMovingToEndpoint);
 }
Exemplo n.º 3
0
 public bool BelongsTo(NodeEndpoint endpoint)
 {
     return(endpoint.Equals(AssignedEndpoint) ||
            endpoint.Equals(InProcessOfMovingToEndpoint));
 }