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
 void batchUpdate(byte[] regionName, BatchUpdate b, long lockId)
          Applies a batch of updates via one RPC
 int batchUpdates(byte[] regionName, BatchUpdate[] b)
          Applies a batch of updates via one RPC for many rows
 boolean checkAndSave(byte[] regionName, BatchUpdate b, HbaseMapWritable<byte[],byte[]> expectedValues)
          Applies a batch of updates to one row atomically via one RPC if the columns specified in expectedValues match the given values in expectedValues
 void close(long scannerId)
          Close a scanner
 void deleteAll(byte[] regionName, byte[] row, byte[] column, long timestamp, long lockId)
          Delete all cells that match the passed row and column and whose timestamp is equal-to or older than the passed timestamp.
 void deleteAll(byte[] regionName, byte[] row, long timestamp, long lockId)
          Delete all cells that match the passed row and whose timestamp is equal-to or older than the passed timestamp.
 void deleteAllByRegex(byte[] regionName, byte[] row, String colRegex, long timestamp, long lockId)
          Delete all cells that match the passed row & the column regex and whose timestamp is equal-to or older than the passed timestamp.
 void deleteFamily(byte[] regionName, byte[] row, byte[] family, long timestamp, long lockId)
          Delete all cells for a row with matching column family with timestamps less than or equal to timestamp.
 void deleteFamilyByRegex(byte[] regionName, byte[] row, String familyRegex, long timestamp, long lockId)
          Delete all cells for a row with matching column family regex with timestamps less than or equal to timestamp.
 boolean exists(byte[] regionName, byte[] row, byte[] column, long timestamp, long lockID)
          Returns true if any cells exist for the given coordinate.
 Cell[] get(byte[] regionName, byte[] row, byte[] column, long timestamp, int numVersions)
          Get the specified number of versions of the specified row and column with the specified timestamp.
 RowResult getClosestRowBefore(byte[] regionName, byte[] row, byte[] columnFamily)
          Return all the data for the row that matches row exactly, or the one that immediately preceeds it.
 HRegionInfo getRegionInfo(byte[] regionName)
          Get metainfo about an HRegion
 RowResult getRow(byte[] regionName, byte[] row, byte[][] columns, long ts, int numVersions, long lockId)
          Get selected columns for the specified row at a given timestamp.
 long lockRow(byte[] regionName, byte[] row)
          Opens a remote row lock.
 RowResult next(long scannerId)
          Get the next set of values
 RowResult[] next(long scannerId, int numberOfRows)
          Get the next set of values
 long openScanner(byte[] regionName, byte[][] columns, byte[] startRow, long timestamp, RowFilterInterface filter)
          Opens a remote scanner with a RowFilter.
 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

get

Cell[] get(byte[] regionName,
           byte[] row,
           byte[] column,
           long timestamp,
           int numVersions)
           throws IOException
Get the specified number of versions of the specified row and column with the specified timestamp.

Parameters:
regionName - region name
row - row key
column - column key
timestamp - timestamp
numVersions - number of versions to return
Returns:
array of values
Throws:
IOException

getClosestRowBefore

RowResult getClosestRowBefore(byte[] regionName,
                              byte[] row,
                              byte[] columnFamily)
                              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
columnFamily - Column family to look for row in.
Returns:
map of values
Throws:
IOException

getRow

RowResult getRow(byte[] regionName,
                 byte[] row,
                 byte[][] columns,
                 long ts,
                 int numVersions,
                 long lockId)
                 throws IOException
Get selected columns for the specified row at a given timestamp.

Parameters:
regionName - region name
row - row key
columns - columns to get
ts - time stamp
numVersions - number of versions
lockId - lock id
Returns:
map of values
Throws:
IOException

batchUpdate

void batchUpdate(byte[] regionName,
                 BatchUpdate b,
                 long lockId)
                 throws IOException
Applies a batch of updates via one RPC

Parameters:
regionName - name of the region to update
b - BatchUpdate
lockId - lock id
Throws:
IOException

batchUpdates

int batchUpdates(byte[] regionName,
                 BatchUpdate[] b)
                 throws IOException
Applies a batch of updates via one RPC for many rows

Parameters:
regionName - name of the region to update
b - BatchUpdate[]
Returns:
number of updates applied
Throws:
IOException

checkAndSave

boolean checkAndSave(byte[] regionName,
                     BatchUpdate b,
                     HbaseMapWritable<byte[],byte[]> expectedValues)
                     throws IOException
Applies a batch of updates to one row atomically via one RPC if the columns specified in expectedValues match the given values in expectedValues

Parameters:
regionName - name of the region to update
b - BatchUpdate
expectedValues - map of column names to expected data values.
Returns:
true if update was applied
Throws:
IOException

deleteAll

void deleteAll(byte[] regionName,
               byte[] row,
               byte[] column,
               long timestamp,
               long lockId)
               throws IOException
Delete all cells that match the passed row and column and whose timestamp is equal-to or older than the passed timestamp.

Parameters:
regionName - region name
row - row key
column - column key
timestamp - Delete all entries that have this timestamp or older
lockId - lock id
Throws:
IOException

deleteAll

void deleteAll(byte[] regionName,
               byte[] row,
               long timestamp,
               long lockId)
               throws IOException
Delete all cells that match the passed row and whose timestamp is equal-to or older than the passed timestamp.

Parameters:
regionName - region name
row - row key
timestamp - Delete all entries that have this timestamp or older
lockId - lock id
Throws:
IOException

deleteAllByRegex

void deleteAllByRegex(byte[] regionName,
                      byte[] row,
                      String colRegex,
                      long timestamp,
                      long lockId)
                      throws IOException
Delete all cells that match the passed row & the column regex and whose timestamp is equal-to or older than the passed timestamp.

Parameters:
regionName -
row -
colRegex -
timestamp -
lockId -
Throws:
IOException

deleteFamily

void deleteFamily(byte[] regionName,
                  byte[] row,
                  byte[] family,
                  long timestamp,
                  long lockId)
                  throws IOException
Delete all cells for a row with matching column family with timestamps less than or equal to timestamp.

Parameters:
regionName - The name of the region to operate on
row - The row to operate on
family - The column family to match
timestamp - Timestamp to match
lockId - lock id
Throws:
IOException

deleteFamilyByRegex

void deleteFamilyByRegex(byte[] regionName,
                         byte[] row,
                         String familyRegex,
                         long timestamp,
                         long lockId)
                         throws IOException
Delete all cells for a row with matching column family regex with timestamps less than or equal to timestamp.

Parameters:
regionName - The name of the region to operate on
row - The row to operate on
familyRegex - column family regex
timestamp - Timestamp to match
lockId - lock id
Throws:
IOException

exists

boolean exists(byte[] regionName,
               byte[] row,
               byte[] column,
               long timestamp,
               long lockID)
               throws IOException
Returns true if any cells exist for the given coordinate.

Parameters:
regionName - The name of the region
row - The row
column - The column, or null for any
timestamp - The timestamp, or LATEST_TIMESTAMP for any
lockID - lock id
Returns:
true if the row exists, false otherwise
Throws:
IOException

openScanner

long openScanner(byte[] regionName,
                 byte[][] columns,
                 byte[] startRow,
                 long timestamp,
                 RowFilterInterface filter)
                 throws IOException
Opens a remote scanner with a RowFilter.

Parameters:
regionName - name of region to scan
columns - columns to scan. If column name is a column family, all columns of the specified column family are returned. Its also possible to pass a regex for column family name. A column name is judged to be regex if it contains at least one of the following characters: \+|^&*$[]]}{)(.
startRow - starting row to scan
timestamp - only return values whose timestamp is <= this value
filter - RowFilter for filtering results at the row-level.
Returns:
scannerId scanner identifier used in other calls
Throws:
IOException

next

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

Parameters:
scannerId - clientId passed to openScanner
Returns:
map of values
Throws:
IOException

next

RowResult[] 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:
map of values
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


Copyright © 2008 The Apache Software Foundation