org.apache.cassandra.dht
Class LeaveJoinProtocolImpl

java.lang.Object
  extended by org.apache.cassandra.dht.LeaveJoinProtocolImpl
All Implemented Interfaces:
java.lang.Runnable

public class LeaveJoinProtocolImpl
extends java.lang.Object
implements java.lang.Runnable

This class performs the exact opposite of the operations of the BootStrapper class. Given a bunch of nodes that need to move it determines who they need to hand off data in terms of ranges.


Field Summary
protected  EndPoint[] targets_
           
protected  TokenMetadata tokenMetadata_
           
protected  Token[] tokens_
           
 
Constructor Summary
LeaveJoinProtocolImpl(EndPoint[] targets, Token[] tokens)
           
 
Method Summary
protected static java.util.Map<Range,java.util.List<Range>> getExpandedRangeToOldRangeMapping(Range[] oldRanges, Range[] newRanges)
          Here we are removing the nodes that need to leave the ring and trying to calculate what the ranges would look like w/o them.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targets_

protected EndPoint[] targets_

tokens_

protected final Token[] tokens_

tokenMetadata_

protected TokenMetadata tokenMetadata_
Constructor Detail

LeaveJoinProtocolImpl

public LeaveJoinProtocolImpl(EndPoint[] targets,
                             Token[] tokens)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

getExpandedRangeToOldRangeMapping

protected static java.util.Map<Range,java.util.List<Range>> getExpandedRangeToOldRangeMapping(Range[] oldRanges,
                                                                                              Range[] newRanges)
Here we are removing the nodes that need to leave the ring and trying to calculate what the ranges would look like w/o them. e.g. if we remove two nodes A and D from the ring and the order of nodes on the ring is A, B, C and D. When B is removed the range of C is the old range of C and the old range of B. We want a mapping from old range of B to new range of B. We have A----B----C----D----E----F----G and we remove b and e then we want a mapping from (a, c] --> (a,b], (b, c] and (d, f] --> (d, e], (d,f].

Parameters:
oldRanges - ranges with the previous configuration
newRanges - ranges with the target endpoints removed.
Returns:
map of expanded range to the list whose aggregate is the expanded range.


Copyright © 2009 The Apache Software Foundation