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

com.netflix.astyanax.partitioner.Partitioner Maven / Gradle / Ivy

There is a newer version: 3.10.2
Show newest version
package com.netflix.astyanax.partitioner;

import java.nio.ByteBuffer;
import java.util.List;

import com.netflix.astyanax.connectionpool.TokenRange;

/**
 * Base interface for token partitioning utilities
 * 
 * @author elandau
 *
 */
public interface Partitioner {
    /**
     * @return Return the smallest token in the token space
     */
    String getMinToken();
    
    /**
     * @return Return the largest token in the token space
     */
    String getMaxToken();
    
    /**
     * @return Return the token immediately before this one
     */
    String getTokenMinusOne(String token);
    
    /**
     * Split the token range into N equal size segments and return the start token
     * of each segment
     * 
     * @param first
     * @param last
     * @param count
     */
    List splitTokenRange(String first, String last, int count);
    
    /**
     * Split the entire token range into 'count' equal size segments
     * @param count
     */
    List splitTokenRange(int count);
    
    /**
     * Return the token for the specifie key
     * @param key
     */
    String getTokenForKey(ByteBuffer key);
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy