All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yestech.lib.util.IConsistentHash Maven / Gradle / Ivy

Go to download

A collection of classes that can be used across yestech artifacts/components, but must not be dependant on any yestech component. Most of the code is utility type code. When more than a few classes are found to be in a package or the package start to handle more that a few reposibilities then a new independant component is created and the existing code in yeslib is ported to the new component.

The newest version!
/*
 * Copyright LGPL3
 * YES Technology Association
 * http://yestech.org
 *
 * http://www.opensource.org/licenses/lgpl-3.0.html
 */

package org.yestech.lib.util;

/**
 * Interface to provide a consistent hash algorithm following this
 * Algorithm
 *
 * @param  Type of the Node on the circle
 */
public interface IConsistentHash {

    /**
     * Add a node to the Ring and replicate it.
     *
     * @param node Node to add
     */
    void add(T node);

    /**
     * Remove a node from the Ring.
     *
     * @param node Node to remove
     */
    void remove(T node);

    /**
     * Return the number of nodes on the Ring.
     *
     * @return the total node count.
     */
    int getTotalNodes();

    /**
     * Return the node associated with a Key.
     *
     * @param key The check to has to find the nearest node
     * @return The nearest Node
     */
    T get(Object key);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy