com.palantir.atlasdb.table.description.RowNamePartitioner Maven / Gradle / Ivy
Show all versions of atlasdb-client Show documentation
/*
* (c) Copyright 2018 Palantir Technologies Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.palantir.atlasdb.table.description;
import java.util.List;
public interface RowNamePartitioner {
/**
* These tokens should be as evenly distributed as
* possible to create numberRanges ranges.
*
* If this keyspace covers the whole region, this will take numRanges tokens. If this keyspace
* covers just a smaller section, this may require numberRanges+1 tokens.
*
* It is also possible to return less tokens is the case where this keyspace cannot be broken
* up easily or there are just very few keys for this keyspace. If this is the case then
* {@link #isHotSpot()} should return true so these ranges may be handled specially so many
* hotspots don't end up on the same node.
*
* @param numberRanges will usually be a power of 2 to get even partitions
*/
List getPartitions(int numberRanges);
boolean isHotSpot();
List compound(RowNamePartitioner next);
}