org.apache.hadoop.hbase.ipc
Interface HRegionInterface

All Superinterfaces:
HBaseRPCProtocolVersion, org.apache.hadoop.ipc.VersionedProtocol
All Known Subinterfaces:
IndexedRegionInterface, TransactionalRegionInterface
All Known Implementing Classes:
HRegionServer, IndexedRegionServer, TransactionalRegionServer

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
 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, 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.
 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.
 void put(byte[] regionName, Put put)
          Put data into the specified region
 int put(byte[] regionName, Put[] puts)
          Put an array of puts into the specified region
 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

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

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

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

put

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

Parameters:
regionName -
put - the data to be put
Throws:
IOException

put

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

Parameters:
regionName -
puts -
Returns:
The number of processed put's. Returns -1 if all Puts processed successfully.
Throws:
IOException

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 -
delete -
Throws:
IOException

delete

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

Parameters:
regionName -
deletes -
Returns:
The number of processed deletes. Returns -1 if all Deletes processed successfully.
Throws:
IOException

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.

Parameters:
regionName -
row -
family -
qualifier -
value - the expected value
put -
Returns:
true if the new put was execute, false otherwise
Throws:
IOException

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.

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

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

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

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

close

void close(long scannerId)
           throws IOException
Close a scanner

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

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

unlockRow

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

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

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

getHServerInfo

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

Returns:
The HSI
Throws:
IOException


Copyright © 2010 The Apache Software Foundation