Class AbstractConsistentHash

java.lang.Object
org.infinispan.distribution.ch.impl.AbstractConsistentHash
All Implemented Interfaces:
ConsistentHash
Direct Known Subclasses:
DefaultConsistentHash

public abstract class AbstractConsistentHash extends Object implements ConsistentHash
Author:
Radim Vansa <rvansa@redhat.com>
  • Field Details

    • STATE_CAPACITY_FACTOR

      protected static final String STATE_CAPACITY_FACTOR
      See Also:
    • STATE_CAPACITY_FACTORS

      protected static final String STATE_CAPACITY_FACTORS
      See Also:
    • STATE_NUM_SEGMENTS

      protected static final String STATE_NUM_SEGMENTS
      See Also:
    • members

      protected final List<Address> members
      The membership of the cache topology that uses this CH.
    • capacityFactors

      protected final float[] capacityFactors
  • Constructor Details

    • AbstractConsistentHash

      protected AbstractConsistentHash(int numSegments, List<Address> members, Map<Address,Float> capacityFactors)
    • AbstractConsistentHash

      protected AbstractConsistentHash(int numSegments, List<Address> members, float[] capacityFactors)
    • AbstractConsistentHash

      protected AbstractConsistentHash(ScopedPersistentState state)
  • Method Details

    • parseNumSegments

      protected static int parseNumSegments(ScopedPersistentState state)
    • parseMembers

      protected static List<Address> parseMembers(ScopedPersistentState state)
    • parseHashFunction

      protected static org.infinispan.commons.hash.Hash parseHashFunction(ScopedPersistentState state)
    • parseCapacityFactors

      protected static float[] parseCapacityFactors(ScopedPersistentState state)
    • toScopedState

      public void toScopedState(ScopedPersistentState state)
      Description copied from interface: ConsistentHash
      Writes this ConsistentHash to the specified scoped state. Before invoking this method, the ConsistentHash addresses will have to be replaced with their corresponding PersistentUUIDs
      Specified by:
      toScopedState in interface ConsistentHash
      Parameters:
      state - the state to which this ConsistentHash will be written
    • getMembers

      public List<Address> getMembers()
      Description copied from interface: ConsistentHash
      Should return the addresses of the nodes used to create this consistent hash.
      Specified by:
      getMembers in interface ConsistentHash
      Returns:
      set of node addresses.
    • mergeLists

      protected static void mergeLists(List<Address> dest, List<Address> src)
      Adds all elements from src list that do not already exist in dest list to the latter.
      Parameters:
      dest - List where elements are added
      src - List of elements to add - this is never modified
    • getCapacityFactors

      public Map<Address,Float> getCapacityFactors()
      Description copied from interface: ConsistentHash
      The capacity factor of each member. Determines the relative capacity of each node compared to the others. If null, all the members are assumed to have a capacity factor of 1.
      Specified by:
      getCapacityFactors in interface ConsistentHash
    • unionCapacityFactors

      protected Map<Address,Float> unionCapacityFactors(AbstractConsistentHash ch2)
    • checkSameHashAndSegments

      protected void checkSameHashAndSegments(AbstractConsistentHash dch2)
    • remapCapacityFactors

      protected Map<Address,Float> remapCapacityFactors(UnaryOperator<Address> remapper, boolean allowMissing)
    • remapMembers

      protected List<Address> remapMembers(UnaryOperator<Address> remapper, boolean allowMissing)