org.apache.hadoop.hbase.ipc
Interface HRegionInterface

All Superinterfaces:
HBaseRPCProtocolVersion, org.apache.hadoop.ipc.VersionedProtocol
All Known Implementing Classes:
HRegionServer

public interface HRegionInterface
extends HBaseRPCProtocolVersion

Clients interact with HRegionServers using a handle to the HRegionInterface.

NOTE: if you change the interface, you must change the RPC version number in HBaseRPCProtocolVersion


Field Summary
 
Fields inherited from interface org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion
versionID
 
Method Summary
 void bulkLoadHFile(String hfilePath, byte[] regionName, byte[] familyName)
          Bulk load an HFile into an open region
 boolean checkAndDelete(byte[] regionName, byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete)
          Atomically checks if a row/family/qualifier value match the expectedValue.
 boolean checkAndPut(byte[] regionName, byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put)
          Atomically checks if a row/family/qualifier value match the expectedValue.
 void close(long scannerId)
          Close a scanner
 void delete(byte[] regionName, Delete delete)
          Deletes all the KeyValues that match those found in the Delete object, if their ts <= to the Delete.
 int delete(byte[] regionName, List<Delete> deletes)
          Put an array of deletes into the specified region
 boolean exists(byte[] regionName, Get get)
          Perform exists operation.
 Result get(byte[] regionName, Get get)
          Perform Get operation.
 Result getClosestRowBefore(byte[] regionName, byte[] row, byte[] family)
          Return all the data for the row that matches row exactly, or the one that immediately preceeds it.
 HServerInfo getHServerInfo()
          Method used when a master is taking the place of another failed one.
 HRegion[] getOnlineRegionsAsArray()
           
 HRegionInfo getRegionInfo(byte[] regionName)
          Get metainfo about an HRegion
 HRegionInfo[] getRegionsAssignment()
          Method used when a master is taking the place of another failed one.
 long incrementColumnValue(byte[] regionName, byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL)
          Atomically increments a column value.
 long lockRow(byte[] regionName, byte[] row)
          Opens a remote row lock.
 MultiPutResponse multiPut(MultiPut puts)
          Multi put for putting multiple regions worth of puts at once.
 Result next(long scannerId)
          Get the next set of values
 Result[] next(long scannerId, int numberOfRows)
          Get the next set of values
 long openScanner(byte[] regionName, Scan scan)
          Opens a remote scanner with a RowFilter.
 int put(byte[] regionName, List<Put> puts)
          Put an array of puts into the specified region
 void put(byte[] regionName, Put put)
          Put data into the specified region
 void replicateLogEntries(HLog.Entry[] entries)
          Replicates the given entries.
 void unlockRow(byte[] regionName, long lockId)
          Releases a remote row lock.
 
Methods inherited from interface org.apache.hadoop.ipc.VersionedProtocol
getProtocolVersion
 

Method Detail

getRegionInfo

HRegionInfo getRegionInfo(byte[] regionName)
                          throws NotServingRegionException
Get metainfo about an HRegion

Parameters:
regionName - name of the region
Returns:
HRegionInfo object for region
Throws:
NotServingRegionException - e

getClosestRowBefore

Result getClosestRowBefore(byte[] regionName,
                           byte[] row,
                           byte[] family)
                           throws IOException
Return all the data for the row that matches row exactly, or the one that immediately preceeds it.

Parameters:
regionName - region name
row - row key
family - Column family to look for row in.
Returns:
map of values
Throws:
IOException - e

getOnlineRegionsAsArray

HRegion[] getOnlineRegionsAsArray()
Returns:
the regions served by this regionserver

get

Result get(byte[] regionName,
           Get get)
           throws IOException
Perform Get operation.

Parameters:
regionName - name of region to get from
get - Get operation
Returns:
Result
Throws:
IOException - e

exists

boolean exists(byte[] regionName,
               Get get)
               throws IOException
Perform exists operation.

Parameters:
regionName - name of region to get from
get - Get operation describing cell to test
Returns:
true if exists
Throws:
IOException - e

put

void put(byte[] regionName,
         Put put)
         throws IOException
Put data into the specified region

Parameters:
regionName - region name
put - the data to be put
Throws:
IOException - e

put

int put(byte[] regionName,
        List<Put> puts)
        throws IOException
Put an array of puts into the specified region

Parameters:
regionName - region name
puts - List of puts to execute
Returns:
The number of processed put's. Returns -1 if all Puts processed successfully.
Throws:
IOException - e

delete

void delete(byte[] regionName,
            Delete delete)
            throws IOException
Deletes all the KeyValues that match those found in the Delete object, if their ts <= to the Delete. In case of a delete with a specific ts it only deletes that specific KeyValue.

Parameters:
regionName - region name
delete - delete object
Throws:
IOException - e

delete

int delete(byte[] regionName,
           List<Delete> deletes)
           throws IOException
Put an array of deletes into the specified region

Parameters:
regionName - region name
deletes - delete List to execute
Returns:
The number of processed deletes. Returns -1 if all Deletes processed successfully.
Throws:
IOException - e

checkAndPut

boolean checkAndPut(byte[] regionName,
                    byte[] row,
                    byte[] family,
                    byte[] qualifier,
                    byte[] value,
                    Put put)
                    throws IOException
Atomically checks if a row/family/qualifier value match the expectedValue. If it does, it adds the put. If passed expected value is null, then the check is for non-existance of the row/column.

Parameters:
regionName - region name
row - row to check
family - column family
qualifier - column qualifier
value - the expected value
put - data to put if check succeeds
Returns:
true if the new put was execute, false otherwise
Throws:
IOException - e

checkAndDelete

boolean checkAndDelete(byte[] regionName,
                       byte[] row,
                       byte[] family,
                       byte[] qualifier,
                       byte[] value,
                       Delete delete)
                       throws IOException
Atomically checks if a row/family/qualifier value match the expectedValue. If it does, it adds the delete. If passed expected value is null, then the check is for non-existance of the row/column.

Parameters:
regionName - region name
row - row to check
family - column family
qualifier - column qualifier
value - the expected value
delete - data to delete if check succeeds
Returns:
true if the new delete was execute, false otherwise
Throws:
IOException - e

incrementColumnValue

long incrementColumnValue(byte[] regionName,
                          byte[] row,
                          byte[] family,
                          byte[] qualifier,
                          long amount,
                          boolean writeToWAL)
                          throws IOException
Atomically increments a column value. If the column value isn't long-like, this could throw an exception. If passed expected value is null, then the check is for non-existance of the row/column.

Parameters:
regionName - region name
row - row to check
family - column family
qualifier - column qualifier
amount - long amount to increment
writeToWAL - whether to write the increment to the WAL
Returns:
new incremented column value
Throws:
IOException - e

openScanner

long openScanner(byte[] regionName,
                 Scan scan)
                 throws IOException
Opens a remote scanner with a RowFilter.

Parameters:
regionName - name of region to scan
scan - configured scan object
Returns:
scannerId scanner identifier used in other calls
Throws:
IOException - e

next

Result next(long scannerId)
            throws IOException
Get the next set of values

Parameters:
scannerId - clientId passed to openScanner
Returns:
map of values; returns null if no results.
Throws:
IOException - e

next

Result[] next(long scannerId,
              int numberOfRows)
              throws IOException
Get the next set of values

Parameters:
scannerId - clientId passed to openScanner
numberOfRows - the number of rows to fetch
Returns:
Array of Results (map of values); array is empty if done with this region and null if we are NOT to go to the next region (happens when a filter rules that the scan is done).
Throws:
IOException - e

close

void close(long scannerId)
           throws IOException
Close a scanner

Parameters:
scannerId - the scanner id returned by openScanner
Throws:
IOException - e

lockRow

long lockRow(byte[] regionName,
             byte[] row)
             throws IOException
Opens a remote row lock.

Parameters:
regionName - name of region
row - row to lock
Returns:
lockId lock identifier
Throws:
IOException - e

unlockRow

void unlockRow(byte[] regionName,
               long lockId)
               throws IOException
Releases a remote row lock.

Parameters:
regionName - region name
lockId - the lock id returned by lockRow
Throws:
IOException - e

getRegionsAssignment

HRegionInfo[] getRegionsAssignment()
                                   throws IOException
Method used when a master is taking the place of another failed one.

Returns:
All regions assigned on this region server
Throws:
IOException - e

getHServerInfo

HServerInfo getHServerInfo()
                           throws IOException
Method used when a master is taking the place of another failed one.

Returns:
The HSI
Throws:
IOException - e

multiPut

MultiPutResponse multiPut(MultiPut puts)
                          throws IOException
Multi put for putting multiple regions worth of puts at once.

Parameters:
puts - the request
Returns:
the reply
Throws:
IOException - e

bulkLoadHFile

void bulkLoadHFile(String hfilePath,
                   byte[] regionName,
                   byte[] familyName)
                   throws IOException
Bulk load an HFile into an open region

Throws:
IOException

replicateLogEntries

void replicateLogEntries(HLog.Entry[] entries)
                         throws IOException
Replicates the given entries. The guarantee is that the given entries will be durable on the slave cluster if this method returns without any exception. hbase.replication has to be set to true for this to work.

Parameters:
entries - entries to replicate
Throws:
IOException


Copyright © 2010 Apache Software Foundation. All Rights Reserved.