org.apache.hadoop.hbase.client.RegionLocator Maven / Gradle / Ivy
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.hadoop.hbase.client;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.util.Pair;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
/**
* Used to view region location information for a single HBase table.
* Obtain an instance from an {@link Connection}.
*
* @see ConnectionFactory
* @see Connection
* @see Table
* @since 0.99.0
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface RegionLocator extends Closeable {
/**
* Finds the region on which the given row is being served. Does not reload the cache.
* @param row Row to find.
* @return Location of the row.
* @throws IOException if a remote or network exception occurs
*/
public HRegionLocation getRegionLocation(final byte [] row) throws IOException;
/**
* Finds the region on which the given row is being served.
* @param row Row to find.
* @param reload true to reload information or false to use cached information
* @return Location of the row.
* @throws IOException if a remote or network exception occurs
*/
public HRegionLocation getRegionLocation(final byte [] row, boolean reload)
throws IOException;
/**
* Retrieves all of the regions associated with this table.
* @return a {@link List} of all regions associated with this table.
* @throws IOException if a remote or network exception occurs
*/
public List getAllRegionLocations()
throws IOException;
/**
* Gets the starting row key for every region in the currently open table.
*
* This is mainly useful for the MapReduce integration.
* @return Array of region starting row keys
* @throws IOException if a remote or network exception occurs
*/
public byte [][] getStartKeys() throws IOException;
/**
* Gets the ending row key for every region in the currently open table.
*
* This is mainly useful for the MapReduce integration.
* @return Array of region ending row keys
* @throws IOException if a remote or network exception occurs
*/
public byte[][] getEndKeys() throws IOException;
/**
* Gets the starting and ending row keys for every region in the currently
* open table.
*
* This is mainly useful for the MapReduce integration.
* @return Pair of arrays of region starting and ending row keys
* @throws IOException if a remote or network exception occurs
*/
public Pair getStartEndKeys() throws IOException;
/**
* Gets the fully qualified table name instance of this table.
*/
TableName getName();
}