com.netflix.astyanax.partitioner.Partitioner Maven / Gradle / Ivy
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);
}