Class TokenMetadata

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

  • public class TokenMetadataextends java.lang.Object
    • Constructor Detail

      • TokenMetadata

        public TokenMetadata()
    • Method Detail

      • pendingRangeChanges

        public int pendingRangeChanges( source)
        the number of nodes bootstrapping into source's primary range
      • updateNormalToken

        public void updateNormalToken(Token token,            endpoint)
        Update token map with a single token/endpoint pair in normal state.
      • updateNormalTokens

        public void updateNormalTokens(java.util.Collection<Token> tokens,             endpoint)
      • updateNormalTokens

        public void updateNormalTokens(<,Token> endpointTokens)
        Update token map with a set of token/endpoint pairs in normal state. Prefer this whenever there are multiple pairs to update, as each update (whether a single or multiple) is expensive (CASSANDRA-3831).
        endpointTokens -
      • updateHostId

        public void updateHostId(java.util.UUID hostId,       endpoint)
        Store an end-point to host ID mapping. Each ID must be unique, and cannot be changed after the fact.
        hostId -
        endpoint -
      • getHostId

        public java.util.UUID getHostId( endpoint)
        Return the unique host ID for an end-point.
      • getEndpointForHostId

        public getEndpointForHostId(java.util.UUID hostId)
        Return the end-point for a unique host ID
      • getEndpointToHostIdMapForReading

        public java.util.Map<,java.util.UUID> getEndpointToHostIdMapForReading()
        a copy of the endpoint-to-id map for read-only operations
      • addBootstrapToken

        @Deprecatedpublic void addBootstrapToken(Token token,                       endpoint)
      • addBootstrapTokens

        public void addBootstrapTokens(java.util.Collection<Token> tokens,             endpoint)
      • removeBootstrapTokens

        public void removeBootstrapTokens(java.util.Collection<Token> tokens)
      • addLeavingEndpoint

        public void addLeavingEndpoint( endpoint)
      • addMovingEndpoint

        public void addMovingEndpoint(Token token,            endpoint)
        Add a new moving endpoint
        token - token which is node moving to
        endpoint - address of the moving node
      • addRelocatingTokens

        public void addRelocatingTokens(java.util.Collection<Token> tokens,              endpoint)
        Add new relocating ranges (tokens moving from their respective endpoints, to another).
        tokens - tokens being moved
        endpoint - destination of moves
      • removeEndpoint

        public void removeEndpoint( endpoint)
      • removeFromMoving

        public void removeFromMoving( endpoint)
        Remove pair of token/address from moving endpoints
        endpoint - address of the moving node
      • removeFromRelocating

        public void removeFromRelocating(Token token,               endpoint)
        Remove pair of token/address from relocating ranges.
        endpoint -
      • getTokens

        public java.util.Collection<Token> getTokens( endpoint)
      • getToken

        @Deprecatedpublic Token getToken( endpoint)
      • isMember

        public boolean isMember( endpoint)
      • isLeaving

        public boolean isLeaving( endpoint)
      • isMoving

        public boolean isMoving( endpoint)
      • isRelocating

        public boolean isRelocating(Token token)
      • 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.
      • cachedOnlyTokenMap

        public TokenMetadata cachedOnlyTokenMap()
        Return a cached TokenMetadata with only tokenToEndpointMap, i.e., the same as cloneOnlyTokenMap but uses a cached copy that is invalided when the ring changes, so in the common case no extra locking is required. Callers must *NOT* mutate the returned metadata object.
      • cloneAfterAllLeft

        public TokenMetadata cloneAfterAllLeft()
        Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all current leave operations have finished.
        new token metadata
      • cloneAfterAllSettled

        public TokenMetadata cloneAfterAllSettled()
        Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all current leave, move, and relocate operations have finished.
        new token metadata
      • getEndpoint

        public getEndpoint(Token token)
      • getPrimaryRangesFor

        public java.util.Collection<Range<Token>> getPrimaryRangesFor(java.util.Collection<Token> tokens)
      • getPrimaryRangeFor

        @Deprecatedpublic Range<Token> getPrimaryRangeFor(Token right)
      • sortedTokens

        public java.util.ArrayList<Token> sortedTokens()
      • getPendingRanges

        public java.util.Map<Range<Token>,java.util.Collection<>> getPendingRanges(java.lang.String keyspaceName)
        a mutable map may be returned but caller should not modify it
      • getPendingRanges

        public java.util.List<Range<Token>> getPendingRanges(java.lang.String keyspaceName,                                   endpoint)
      • setPendingRanges

        public void setPendingRanges(java.lang.String keyspaceName,          <Range<Token>,> rangeMap)
      • getPredecessor

        public Token getPredecessor(Token token)
      • getSuccessor

        public Token getSuccessor(Token token)
      • getBootstrapTokens

        public BiMultiValMap<Token,> getBootstrapTokens()
        a copy of the bootstrapping tokens map
      • getAllEndpoints

        public java.util.Set<> getAllEndpoints()
      • getLeavingEndpoints

        public java.util.Set<> getLeavingEndpoints()
        caller should not modify leavingEndpoints
      • getMovingEndpoints

        public java.util.Set<Pair<Token,>> getMovingEndpoints()
        Endpoints which are migrating to the new tokens
        set of addresses of moving endpoints
      • getRelocatingRanges

        public java.util.Map<Token,> getRelocatingRanges()
        Ranges which are migrating to new endpoints.
        set of token-address pairs of relocating ranges
      • firstTokenIndex

        public static int firstTokenIndex(java.util.ArrayList ring,                  Token start,                  boolean insertMin)
      • firstToken

        public static Token firstToken(java.util.ArrayList<Token> ring,               Token start)
      • ringIterator

        public static java.util.Iterator<Token> ringIterator(java.util.ArrayList<Token> ring,                                     Token start,                                     boolean includeMin)
        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)
        includeMin - True if the minimum token should be returned in the ring even if it has no owner.
      • clearUnsafe

        public void clearUnsafe()
        used by tests
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • printPendingRanges

        public java.lang.String printPendingRanges()
      • printRelocatingRanges

        public java.lang.String printRelocatingRanges()
      • pendingEndpointsFor

        public java.util.Collection<> pendingEndpointsFor(Token token,                                                             java.lang.String keyspaceName)
      • getWriteEndpoints

        public java.util.Collection<> getWriteEndpoints(Token token,                                                           java.lang.String keyspaceName,                                                           java.util.Collection<> naturalEndpoints)
        Deprecated. retained for benefit of old tests
      • getEndpointToTokenMapForReading

        public<,Token> getEndpointToTokenMapForReading()
        an endpoint to token multimap representation of tokenToEndpointMap (a copy)
      • getNormalAndBootstrappingTokenToEndpointMap

        public java.util.Map<Token,> getNormalAndBootstrappingTokenToEndpointMap()
        a (stable copy, won't be modified) Token to Endpoint map for all the normal and bootstrapping nodes in the cluster.
      • getTopology

        public TokenMetadata.Topology getTopology()
        the Topology map of nodes to DCs + Racks This is only allowed when a copy has been made of TokenMetadata, to avoid concurrent modifications when Topology methods are subsequently used by the caller.
      • getRingVersion

        public long getRingVersion()
      • invalidateCachedRings

        public void invalidateCachedRings()

Copyright © 2013 The Apache Software Foundation

Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14