## org.apache.cassandra.locator
Class TokenMetadata

    java.lang.Object
      org.apache.cassandra.locator.TokenMetadata

    public class TokenMetadata

extends java.lang.Object

Constructor Summary
`TokenMetadata()`
`TokenMetadata(com.google.common.collect.BiMap<Token,java.net.InetAddress> tokenToEndPointMap)`

Method Summary
`void` `addBootstrapToken(Token token, java.net.InetAddress endpoint)`
`void` `addLeavingEndPoint(java.net.InetAddress endpoint)`
`void` `clearUnsafe()` used by tests
`TokenMetadata` `cloneAfterAllLeft()` Create a copy of TokenMetadata with tokenToEndPointMap reflecting situation after all current leave operations have finished.
`TokenMetadata` `cloneOnlyTokenMap()` Create a copy of TokenMetadata with only tokenToEndPointMap.
`java.util.Map<Token,java.net.InetAddress>` `getBootstrapTokens()` caller should not modify bootstrapTokens
`java.net.InetAddress` `getEndPoint(Token token)`
`java.net.InetAddress` `getFirstEndpoint()`
`java.util.Set<java.net.InetAddress>` `getLeavingEndPoints()` caller should not modify leavigEndPoints
`java.util.Map<Range,java.util.Collection<java.net.InetAddress>>` `getPendingRanges(java.lang.String table)` a mutable map may be returned but caller should not modify it
`java.util.List<Range>` `getPendingRanges(java.lang.String table, java.net.InetAddress endpoint)`
`Token` `getPredecessor(Token token)`
`Range` `getPrimaryRangeFor(Token right)`
`java.net.InetAddress` `getSuccessor(java.net.InetAddress endPoint)`
`Token` `getSuccessor(Token token)`
`Token` `getToken(java.net.InetAddress endpoint)`
`boolean` `isLeaving(java.net.InetAddress endpoint)`
`boolean` `isMember(java.net.InetAddress endpoint)`
`int` `pendingRangeChanges(java.net.InetAddress source)`
`java.lang.String` `printPendingRanges()`
`void` `removeBootstrapToken(Token token)`
`void` `removeEndpoint(java.net.InetAddress endpoint)`
`void` `removeLeavingEndPoint(java.net.InetAddress endpoint)`
`static java.util.Iterator<Token>` `ringIterator(java.util.List ring, Token start)` iterator over the Tokens in the given ring, starting with the token for the node owning start (which does not have to be a Token in the ring)
`void` `setPendingRanges(java.lang.String table, com.google.common.collect.Multimap<Range,java.net.InetAddress> rangeMap)`
`java.util.List<Token>` `sortedTokens()`
`java.lang.String` `toString()`
`void` `updateNormalToken(Token token, java.net.InetAddress endpoint)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TokenMetadata

    public TokenMetadata()

### TokenMetadata

    public TokenMetadata(com.google.common.collect.BiMap<Token,java.net.InetAddress> tokenToEndPointMap)

Method Detail

### pendingRangeChanges

    public int pendingRangeChanges(java.net.InetAddress source)

  Returns:
    the number of nodes bootstrapping into source's primary range

### updateNormalToken

    public void updateNormalToken(Token token,
                                  java.net.InetAddress endpoint)

### addBootstrapToken

    public void addBootstrapToken(Token token,
                                  java.net.InetAddress endpoint)

### removeBootstrapToken

    public void removeBootstrapToken(Token token)

### addLeavingEndPoint

    public void addLeavingEndPoint(java.net.InetAddress endpoint)

### removeLeavingEndPoint

    public void removeLeavingEndPoint(java.net.InetAddress endpoint)

### removeEndpoint

    public void removeEndpoint(java.net.InetAddress endpoint)

### getToken

    public Token getToken(java.net.InetAddress endpoint)

### isMember

    public boolean isMember(java.net.InetAddress endpoint)

### isLeaving

    public boolean isLeaving(java.net.InetAddress endpoint)

### getFirstEndpoint

    public java.net.InetAddress getFirstEndpoint()

### cloneOnlyTokenMap

    public TokenMetadata cloneOnlyTokenMap()

  Create a copy of TokenMetadata with only tokenToEndPointMap. That is, pending ranges, bootstrap tokens and leaving endpoints are not included in the copy.

### cloneAfterAllLeft

    public TokenMetadata cloneAfterAllLeft()

  Create a copy of TokenMetadata with tokenToEndPointMap reflecting situation after all current leave operations have finished.

### getEndPoint

    public java.net.InetAddress getEndPoint(Token token)

### getPrimaryRangeFor

    public Range getPrimaryRangeFor(Token right)

### sortedTokens

    public java.util.List<Token> sortedTokens()

### getPendingRanges

    public java.util.Map<Range,java.util.Collection<java.net.InetAddress>> getPendingRanges(java.lang.String table)

  a mutable map may be returned but caller should not modify it

### getPendingRanges

    public java.util.List<Range> getPendingRanges(java.lang.String table,
                                                  java.net.InetAddress endpoint)

### setPendingRanges

    public void setPendingRanges(java.lang.String table,
                                 com.google.common.collect.Multimap<Range,java.net.InetAddress> rangeMap)

### getPredecessor

    public Token getPredecessor(Token token)

### getSuccessor

    public Token getSuccessor(Token token)

### getSuccessor

    public java.net.InetAddress getSuccessor(java.net.InetAddress endPoint)

### getBootstrapTokens

    public java.util.Map<Token,java.net.InetAddress> getBootstrapTokens()

  caller should not modify bootstrapTokens

### getLeavingEndPoints

    public java.util.Set<java.net.InetAddress> getLeavingEndPoints()

  caller should not modify leavigEndPoints

### ringIterator

    public static java.util.Iterator<Token> ringIterator(java.util.List ring,
                                                         Token start)

  iterator over the Tokens in the given ring, starting with the token for the node owning start (which does not have to be a Token in the ring)

### clearUnsafe

    public void clearUnsafe()

  used by tests

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### printPendingRanges

    public java.lang.String printPendingRanges()

Copyright © 2010 The Apache Software Foundation