|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.HClient
public class HClient
HClient manages a connection to a single HRegionServer.
Nested Class Summary | |
---|---|
protected class |
HClient.BatchHandler
|
protected static class |
HClient.RegionLocation
|
Field Summary |
---|
Constructor Summary | |
---|---|
HClient(Configuration conf)
Creates a new HClient |
Method Summary | |
---|---|
void |
abort(long lockid)
Abort a row mutation |
void |
abortBatch()
Abort a batch mutation |
void |
addColumn(Text tableName,
HColumnDescriptor column)
Add a column to an existing table |
protected void |
checkMaster()
|
protected void |
checkReservedTableName(Text tableName)
|
void |
commit(long lockid)
Finalize a row mutation |
void |
commit(long lockid,
long timestamp)
Finalize a row mutation |
void |
commitBatch()
Finalize a batch mutation |
void |
commitBatch(long timestamp)
Finalize a batch mutation |
void |
createTable(HTableDescriptor desc)
Creates a new table |
void |
createTableAsync(HTableDescriptor desc)
Creates a new table but does not block and wait for it to come online. |
void |
delete(long lockid,
Text column)
Delete the value for a column |
void |
deleteColumn(Text tableName,
Text columnName)
Delete a column from a table |
void |
deleteTable(Text tableName)
Deletes a table |
void |
disableTable(Text tableName)
Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it. |
int |
doCommandLine(String[] args)
Process command-line args. |
void |
enableTable(Text tableName)
Brings a table on-line (enables it) |
byte[] |
get(Text row,
Text column)
Get a single value for the specified row and column |
byte[][] |
get(Text row,
Text column,
int numVersions)
Get the specified number of versions of the specified row and column |
byte[][] |
get(Text row,
Text column,
long timestamp,
int numVersions)
Get the specified number of versions of the specified row and column with the specified timestamp. |
protected Configuration |
getConf()
|
protected HRegionInterface |
getHRegionConnection(HServerAddress regionServer)
Establishes a connection to the region server at the specified address. |
protected HClient.RegionLocation |
getRegionLocation(Text row)
|
SortedMap<Text,byte[]> |
getRow(Text row)
Get all the data for the specified row |
Text[] |
getStartKeys()
Gets the starting row key for every region in the currently open table |
protected SortedMap<Text,HClient.RegionLocation> |
getTableServers(Text tableName)
Gets the servers of the given table. |
boolean |
isMasterRunning()
|
HTableDescriptor[] |
listTables()
List all the userspace tables. |
static void |
main(String[] args)
Main program |
HScannerInterface |
obtainScanner(Text[] columns,
Text startRow)
Get a scanner on the current table starting at the specified row. |
HScannerInterface |
obtainScanner(Text[] columns,
Text startRow,
long timestamp)
Get a scanner on the current table starting at the specified row. |
HScannerInterface |
obtainScanner(Text[] columns,
Text startRow,
long timestamp,
RowFilterInterface filter)
Get a scanner on the current table starting at the specified row. |
HScannerInterface |
obtainScanner(Text[] columns,
Text startRow,
RowFilterInterface filter)
Get a scanner on the current table starting at the specified row. |
void |
openTable(Text tableName)
Loads information so that a table can be manipulated. |
void |
put(long lockid,
Text column,
byte[] val)
Change a value for the specified column. |
void |
renewLease(long lockid)
Renew lease on update |
void |
shutdown()
Shuts down the HBase instance |
void |
startBatchUpdate()
Start a batch of row insertions/updates. |
long |
startUpdate(Text row)
Start an atomic row insertion/update. |
boolean |
tableExists(Text tableName)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HClient(Configuration conf)
conf
- - Configuration objectMethod Detail |
---|
public boolean tableExists(Text tableName) throws IOException
tableName
- Table to check.
IOException
protected void checkMaster() throws MasterNotRunningException
MasterNotRunningException
public boolean isMasterRunning()
public void createTable(HTableDescriptor desc) throws IOException
desc
- table descriptor for table
IllegalArgumentException
- if the table name is reserved
MasterNotRunningException
- if master is not running
NoServerForRegionException
- if root region is not being served
TableExistsException
- if table already exists (If concurrent
threads, the table may have been created between test-for-existence
and attempt-at-creation).
IOException
public void createTableAsync(HTableDescriptor desc) throws IOException
desc
- table descriptor for table
IllegalArgumentException
- if the table name is reserved
MasterNotRunningException
- if master is not running
NoServerForRegionException
- if root region is not being served
TableExistsException
- if table already exists (If concurrent
threads, the table may have been created between test-for-existence
and attempt-at-creation).
IOException
public void deleteTable(Text tableName) throws IOException
tableName
- name of table to delete
IOException
public void addColumn(Text tableName, HColumnDescriptor column) throws IOException
tableName
- name of the table to add column tocolumn
- column descriptor of column to be added
IOException
public void deleteColumn(Text tableName, Text columnName) throws IOException
tableName
- name of tablecolumnName
- name of column to be deleted
IOException
public void enableTable(Text tableName) throws IOException
tableName
- name of the table
IOException
public void disableTable(Text tableName) throws IOException
tableName
- name of table
IOException
public void shutdown() throws IOException
IOException
protected void checkReservedTableName(Text tableName)
public void openTable(Text tableName) throws IOException
tableName
- the table to be located
IOException
- if the table can not be located after retryingpublic Text[] getStartKeys()
protected SortedMap<Text,HClient.RegionLocation> getTableServers(Text tableName) throws IOException
tableName
- - the table to be located
IOException
- - if the table can not be located after retryingprotected HRegionInterface getHRegionConnection(HServerAddress regionServer) throws IOException
regionServer
- - the server to connect to
IOException
public HTableDescriptor[] listTables() throws IOException
IOException
protected HClient.RegionLocation getRegionLocation(Text row)
public byte[] get(Text row, Text column) throws IOException
row
- row keycolumn
- column name
IOException
public byte[][] get(Text row, Text column, int numVersions) throws IOException
row
- - row keycolumn
- - column namenumVersions
- - number of versions to retrieve
IOException
public byte[][] get(Text row, Text column, long timestamp, int numVersions) throws IOException
row
- - row keycolumn
- - column nametimestamp
- - timestampnumVersions
- - number of versions to retrieve
IOException
public SortedMap<Text,byte[]> getRow(Text row) throws IOException
row
- - row key
IOException
public HScannerInterface obtainScanner(Text[] columns, Text startRow) throws IOException
columns
- array of columns to returnstartRow
- starting row in table to scan
IOException
public HScannerInterface obtainScanner(Text[] columns, Text startRow, long timestamp) throws IOException
columns
- array of columns to returnstartRow
- starting row in table to scantimestamp
- only return results whose timestamp <= this value
IOException
public HScannerInterface obtainScanner(Text[] columns, Text startRow, RowFilterInterface filter) throws IOException
columns
- array of columns to returnstartRow
- starting row in table to scanfilter
- a row filter using row-key regexp and/or column data filter.
IOException
public HScannerInterface obtainScanner(Text[] columns, Text startRow, long timestamp, RowFilterInterface filter) throws IOException
columns
- array of columns to returnstartRow
- starting row in table to scantimestamp
- only return results whose timestamp <= this valuefilter
- a row filter using row-key regexp and/or column data filter.
IOException
public void startBatchUpdate()
public void abortBatch()
public void commitBatch() throws IOException
IOException
public void commitBatch(long timestamp) throws IOException
timestamp
- time to associate with all the changes
IOException
public long startUpdate(Text row) throws IOException
row
- Name of row to start update against.
IOException
public void put(long lockid, Text column, byte[] val) throws IOException
abort(long)
if exception thrown.
lockid
- lock id returned from startUpdatecolumn
- column whose value is being setval
- new value for column
IOException
public void delete(long lockid, Text column) throws IOException
lockid
- - lock id returned from startUpdatecolumn
- - name of column whose value is to be deleted
IOException
public void abort(long lockid) throws IOException
lockid
- - lock id returned from startUpdate
IOException
public void commit(long lockid) throws IOException
lockid
- - lock id returned from startUpdate
IOException
public void commit(long lockid, long timestamp) throws IOException
lockid
- - lock id returned from startUpdatetimestamp
- - time to associate with the change
IOException
public void renewLease(long lockid) throws IOException
lockid
- - lock id returned from startUpdate
IOException
public int doCommandLine(String[] args)
args
- - command arguments
protected Configuration getConf()
public static void main(String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |