|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.thrift.ThriftServer.HBaseHandler
public static class ThriftServer.HBaseHandler
The HBaseHandler is a glue object that connects Thrift RPC calls to the HBase client API primarily defined in the HBaseAdmin and HTable objects.
Field Summary | |
---|---|
protected HBaseAdmin |
admin
|
protected HBaseConfiguration |
conf
|
protected org.apache.commons.logging.Log |
LOG
|
protected int |
nextScannerId
|
protected HashMap<Integer,Scanner> |
scannerMap
|
Method Summary | |
---|---|
protected int |
addScanner(Scanner scanner)
Assigns a unique ID to the scanner and adds the mapping to an internal hash-map. |
void |
createTable(byte[] tableName,
List<ColumnDescriptor> columnFamilies)
Create a table with the specified column families. |
void |
deleteAll(byte[] tableName,
byte[] row,
byte[] column)
Delete all cells that match the passed row and column. |
void |
deleteAllRow(byte[] tableName,
byte[] row)
Completely delete the row's cells. |
void |
deleteAllRowTs(byte[] tableName,
byte[] row,
long timestamp)
Completely delete the row's cells marked with a timestamp equal-to or older than the passed timestamp. |
void |
deleteAllTs(byte[] tableName,
byte[] row,
byte[] column,
long timestamp)
Delete all cells that match the passed row and column and whose timestamp is equal-to or older than the passed timestamp. |
void |
deleteTable(byte[] tableName)
Deletes a table |
void |
disableTable(byte[] tableName)
Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it. |
void |
enableTable(byte[] tableName)
Brings a table on-line (enables it) |
TCell |
get(byte[] tableName,
byte[] row,
byte[] column)
Get a single TCell for the specified table, row, and column at the latest timestamp. |
Map<byte[],ColumnDescriptor> |
getColumnDescriptors(byte[] tableName)
List all the column families assoicated with a table. |
TRowResult |
getRow(byte[] tableName,
byte[] row)
Get all the data for the specified table and row at the latest timestamp. |
TRowResult |
getRowTs(byte[] tableName,
byte[] row,
long timestamp)
Get all the data for the specified table and row at the specified timestamp. |
TRowResult |
getRowWithColumns(byte[] tableName,
byte[] row,
List<byte[]> columns)
Get the specified columns for the specified table and row at the latest timestamp. |
TRowResult |
getRowWithColumnsTs(byte[] tableName,
byte[] row,
List<byte[]> columns,
long timestamp)
Get the specified columns for the specified table and row at the specified timestamp. |
protected Scanner |
getScanner(int id)
Returns the scanner associated with the specified ID. |
protected HTable |
getTable(byte[] tableName)
Creates and returns an HTable instance from a given table name. |
List<byte[]> |
getTableNames()
List all the userspace tables. |
List<TRegionInfo> |
getTableRegions(byte[] tableName)
List the regions associated with a table. |
List<TCell> |
getVer(byte[] tableName,
byte[] row,
byte[] column,
int numVersions)
Get the specified number of versions for the specified table, row, and column. |
List<TCell> |
getVerTs(byte[] tableName,
byte[] row,
byte[] column,
long timestamp,
int numVersions)
Get the specified number of versions for the specified table, row, and column. |
boolean |
isTableEnabled(byte[] tableName)
|
void |
mutateRow(byte[] tableName,
byte[] row,
List<Mutation> mutations)
Apply a series of mutations (updates/deletes) to a row in a single transaction. |
void |
mutateRows(byte[] tableName,
List<BatchMutation> rowBatches)
Apply a series of batches (each a series of mutations on a single row) in a single transaction. |
void |
mutateRowsTs(byte[] tableName,
List<BatchMutation> rowBatches,
long timestamp)
Apply a series of batches (each a series of mutations on a single row) in a single transaction. |
void |
mutateRowTs(byte[] tableName,
byte[] row,
List<Mutation> mutations,
long timestamp)
Apply a series of mutations (updates/deletes) to a row in a single transaction. |
protected Scanner |
removeScanner(int id)
Removes the scanner associated with the specified ID from the internal id->scanner hash-map. |
void |
scannerClose(int id)
Closes the server-state associated with an open scanner. |
TRowResult |
scannerGet(int id)
Returns the scanner's current row value and advances to the next row in the table. |
int |
scannerOpen(byte[] tableName,
byte[] startRow,
List<byte[]> columns)
Get a scanner on the current table starting at the specified row and ending at the last row in the table. |
int |
scannerOpenTs(byte[] tableName,
byte[] startRow,
List<byte[]> columns,
long timestamp)
Get a scanner on the current table starting at the specified row and ending at the last row in the table. |
int |
scannerOpenWithStop(byte[] tableName,
byte[] startRow,
byte[] stopRow,
List<byte[]> columns)
Get a scanner on the current table starting and stopping at the specified rows. |
int |
scannerOpenWithStopTs(byte[] tableName,
byte[] startRow,
byte[] stopRow,
List<byte[]> columns,
long timestamp)
Get a scanner on the current table starting and stopping at the specified rows. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HBaseConfiguration conf
protected HBaseAdmin admin
protected final org.apache.commons.logging.Log LOG
protected int nextScannerId
protected HashMap<Integer,Scanner> scannerMap
Method Detail |
---|
protected HTable getTable(byte[] tableName) throws IOError, IOException
tableName
- name of table
IOException
IOError
protected int addScanner(Scanner scanner)
scanner
-
protected Scanner getScanner(int id)
id
-
protected Scanner removeScanner(int id)
id
-
public void enableTable(byte[] tableName) throws IOError
Hbase.Iface
enableTable
in interface Hbase.Iface
tableName
- name of the table
IOError
public void disableTable(byte[] tableName) throws IOError
Hbase.Iface
disableTable
in interface Hbase.Iface
tableName
- name of the table
IOError
public boolean isTableEnabled(byte[] tableName) throws IOError
isTableEnabled
in interface Hbase.Iface
tableName
- name of table to check
IOError
public List<byte[]> getTableNames() throws IOError
Hbase.Iface
getTableNames
in interface Hbase.Iface
IOError
public List<TRegionInfo> getTableRegions(byte[] tableName) throws IOError
Hbase.Iface
getTableRegions
in interface Hbase.Iface
tableName
- table name
IOError
public TCell get(byte[] tableName, byte[] row, byte[] column) throws NotFound, IOError
Hbase.Iface
get
in interface Hbase.Iface
tableName
- name of tablerow
- row keycolumn
- column name
NotFound
IOError
public List<TCell> getVer(byte[] tableName, byte[] row, byte[] column, int numVersions) throws IOError, NotFound
Hbase.Iface
getVer
in interface Hbase.Iface
tableName
- name of tablerow
- row keycolumn
- column namenumVersions
- number of versions to retrieve
IOError
NotFound
public List<TCell> getVerTs(byte[] tableName, byte[] row, byte[] column, long timestamp, int numVersions) throws IOError, NotFound
Hbase.Iface
getVerTs
in interface Hbase.Iface
tableName
- name of tablerow
- row keycolumn
- column nametimestamp
- timestampnumVersions
- number of versions to retrieve
IOError
NotFound
public TRowResult getRow(byte[] tableName, byte[] row) throws IOError
Hbase.Iface
getRow
in interface Hbase.Iface
tableName
- name of tablerow
- row key
IOError
public TRowResult getRowWithColumns(byte[] tableName, byte[] row, List<byte[]> columns) throws IOError
Hbase.Iface
getRowWithColumns
in interface Hbase.Iface
tableName
- name of tablerow
- row keycolumns
- List of columns to return, null for all columns
IOError
public TRowResult getRowTs(byte[] tableName, byte[] row, long timestamp) throws IOError
Hbase.Iface
getRowTs
in interface Hbase.Iface
tableName
- of tablerow
- row keytimestamp
- timestamp
IOError
public TRowResult getRowWithColumnsTs(byte[] tableName, byte[] row, List<byte[]> columns, long timestamp) throws IOError
Hbase.Iface
getRowWithColumnsTs
in interface Hbase.Iface
tableName
- name of tablerow
- row keycolumns
- List of columns to return, null for all columns
IOError
public void deleteAll(byte[] tableName, byte[] row, byte[] column) throws IOError
Hbase.Iface
deleteAll
in interface Hbase.Iface
tableName
- name of tablerow
- Row to updatecolumn
- name of column whose value is to be deleted
IOError
public void deleteAllTs(byte[] tableName, byte[] row, byte[] column, long timestamp) throws IOError
Hbase.Iface
deleteAllTs
in interface Hbase.Iface
tableName
- name of tablerow
- Row to updatecolumn
- name of column whose value is to be deletedtimestamp
- timestamp
IOError
public void deleteAllRow(byte[] tableName, byte[] row) throws IOError
Hbase.Iface
deleteAllRow
in interface Hbase.Iface
tableName
- name of tablerow
- key of the row to be completely deleted.
IOError
public void deleteAllRowTs(byte[] tableName, byte[] row, long timestamp) throws IOError
Hbase.Iface
deleteAllRowTs
in interface Hbase.Iface
tableName
- name of tablerow
- key of the row to be completely deleted.timestamp
- timestamp
IOError
public void createTable(byte[] tableName, List<ColumnDescriptor> columnFamilies) throws IOError, IllegalArgument, AlreadyExists
Hbase.Iface
createTable
in interface Hbase.Iface
tableName
- name of table to createcolumnFamilies
- list of column family descriptors
IllegalArgument
- if an input parameter is invalid
AlreadyExists
- if the table name already exists
IOError
public void deleteTable(byte[] tableName) throws IOError, NotFound
Hbase.Iface
deleteTable
in interface Hbase.Iface
tableName
- name of table to delete
NotFound
- if table doesn't exist on server
IOError
public void mutateRow(byte[] tableName, byte[] row, List<Mutation> mutations) throws IOError, IllegalArgument
Hbase.Iface
mutateRow
in interface Hbase.Iface
tableName
- name of tablerow
- row keymutations
- list of mutation commands
IOError
IllegalArgument
public void mutateRowTs(byte[] tableName, byte[] row, List<Mutation> mutations, long timestamp) throws IOError, IllegalArgument
Hbase.Iface
mutateRowTs
in interface Hbase.Iface
tableName
- name of tablerow
- row keymutations
- list of mutation commandstimestamp
- timestamp
IOError
IllegalArgument
public void mutateRows(byte[] tableName, List<BatchMutation> rowBatches) throws IOError, IllegalArgument, com.facebook.thrift.TException
Hbase.Iface
mutateRows
in interface Hbase.Iface
tableName
- name of tablerowBatches
- list of row batches
IOError
IllegalArgument
com.facebook.thrift.TException
public void mutateRowsTs(byte[] tableName, List<BatchMutation> rowBatches, long timestamp) throws IOError, IllegalArgument, com.facebook.thrift.TException
Hbase.Iface
mutateRowsTs
in interface Hbase.Iface
tableName
- name of tablerowBatches
- list of row batchestimestamp
- timestamp
IOError
IllegalArgument
com.facebook.thrift.TException
public void scannerClose(int id) throws IOError, IllegalArgument
Hbase.Iface
scannerClose
in interface Hbase.Iface
id
- id of a scanner returned by scannerOpen
IllegalArgument
- if ScannerID is invalid
IOError
public TRowResult scannerGet(int id) throws IllegalArgument, NotFound, IOError
Hbase.Iface
scannerGet
in interface Hbase.Iface
id
- id of a scanner returned by scannerOpen
IllegalArgument
- if ScannerID is invalid
NotFound
- when the scanner reaches the end
IOError
public int scannerOpen(byte[] tableName, byte[] startRow, List<byte[]> columns) throws IOError
Hbase.Iface
scannerOpen
in interface Hbase.Iface
tableName
- name of tablestartRow
- starting row in table to scan. send "" (empty string) to
start at the first row.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 in the column qualifier.
IOError
public int scannerOpenWithStop(byte[] tableName, byte[] startRow, byte[] stopRow, List<byte[]> columns) throws IOError, com.facebook.thrift.TException
Hbase.Iface
scannerOpenWithStop
in interface Hbase.Iface
tableName
- name of tablestartRow
- starting row in table to scan. send "" (empty string) to
start at the first row.stopRow
- row to stop scanning on. This row is *not* included in the
scanner's resultscolumns
- 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 in the column qualifier.
IOError
com.facebook.thrift.TException
public int scannerOpenTs(byte[] tableName, byte[] startRow, List<byte[]> columns, long timestamp) throws IOError, com.facebook.thrift.TException
Hbase.Iface
scannerOpenTs
in interface Hbase.Iface
tableName
- name of tablestartRow
- starting row in table to scan. send "" (empty string) to
start at the first row.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 in the column qualifier.timestamp
- timestamp
IOError
com.facebook.thrift.TException
public int scannerOpenWithStopTs(byte[] tableName, byte[] startRow, byte[] stopRow, List<byte[]> columns, long timestamp) throws IOError, com.facebook.thrift.TException
Hbase.Iface
scannerOpenWithStopTs
in interface Hbase.Iface
tableName
- name of tablestartRow
- starting row in table to scan. send "" (empty string) to
start at the first row.stopRow
- row to stop scanning on. This row is *not* included
in the scanner's resultscolumns
- 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 in the column qualifier.timestamp
- timestamp
IOError
com.facebook.thrift.TException
public Map<byte[],ColumnDescriptor> getColumnDescriptors(byte[] tableName) throws IOError, com.facebook.thrift.TException
Hbase.Iface
getColumnDescriptors
in interface Hbase.Iface
tableName
- table name
IOError
com.facebook.thrift.TException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |