|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.HTable
public class HTable
Used to communicate with a single HBase table
Nested Class Summary | |
---|---|
protected class |
HTable.ClientScanner
Implements the scanner interface for the HBase client. |
Field Summary | |
---|---|
protected AtomicReference<BatchUpdate> |
batch
|
protected boolean |
closed
|
protected HConnection |
connection
|
protected org.apache.commons.logging.Log |
LOG
|
protected int |
numRetries
|
protected long |
pause
|
protected Random |
rand
|
protected Text |
tableName
|
protected SortedMap<Text,HRegionLocation> |
tableServers
|
Constructor Summary | |
---|---|
HTable(Configuration conf,
Text tableName)
Creates an object to access a HBase table |
Method Summary | |
---|---|
void |
abort(long lockid)
Abort a row mutation |
void |
abortBatch(long lockid)
Deprecated. Batch operations are now the default. abortBatch is now implemented by @see abort(long) |
protected void |
checkClosed()
|
void |
checkUpdateInProgress()
Verifies that no update is in progress |
void |
close()
Releases resources associated with this table. |
void |
commit(long lockid)
Finalize a row mutation When this method is specified, we pass the server a value that says use the 'latest' timestamp. |
void |
commit(long lockid,
long timestamp)
Finalize a row mutation |
void |
commitBatch(long lockid)
Deprecated. Batch operations are now the default. commitBatch(long) is now implemented by @see commit(long) |
void |
commitBatch(long lockid,
long timestamp)
Deprecated. Batch operations are now the default. commitBatch(long, long) is now implemented by @see commit(long, long) |
void |
delete(long lockid,
Text column)
Delete the value for a column. |
void |
deleteAll(Text row,
Text column)
Delete all values for a column |
void |
deleteAll(Text row,
Text column,
long ts)
Delete all values for a column |
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. |
HConnection |
getConnection()
|
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 |
Text |
getTableName()
|
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 |
put(long lockid,
Text column,
byte[] val)
Change a value for the specified column. |
void |
renewLease(long lockid)
Deprecated. Batch updates are now the default. Consequently this method does nothing. |
long |
startBatchUpdate(Text row)
Deprecated. Batch operations are now the default. startBatchUpdate is now implemented by @see startUpdate(Text) |
long |
startUpdate(Text row)
Start an atomic row insertion/update. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log LOG
protected final HConnection connection
protected final Text tableName
protected final long pause
protected final int numRetries
protected Random rand
protected volatile SortedMap<Text,HRegionLocation> tableServers
protected AtomicReference<BatchUpdate> batch
protected volatile boolean closed
Constructor Detail |
---|
public HTable(Configuration conf, Text tableName) throws IOException
conf
- configuration objecttableName
- name of the table
IOException
Method Detail |
---|
protected void checkClosed()
public HConnection getConnection()
public void close()
public void checkUpdateInProgress()
public Text getTableName()
public Text[] getStartKeys()
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
- 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. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scan
IOException
public HScannerInterface obtainScanner(Text[] columns, Text startRow, long timestamp) throws IOException
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. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- 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
- 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. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- 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
- 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. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- 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
@Deprecated public long startBatchUpdate(Text row)
startUpdate(Text)
row
- name of row to be updated
@Deprecated public void abortBatch(long lockid)
abort(long)
lockid
- lock id returned by startBatchUpdate@Deprecated public void commitBatch(long lockid) throws IOException
commit(long)
lockid
- lock id returned by startBatchUpdate
IOException
@Deprecated public void commitBatch(long lockid, long timestamp) throws IOException
commit(long, long)
lockid
- lock id returned by startBatchUpdatetimestamp
- time to associate with all the changes
IOException
public long startUpdate(Text row)
row
- Name of row to start update against.
public void put(long lockid, Text column, byte[] val)
abort(long)
if exception thrown.
lockid
- lock id returned from startUpdatecolumn
- column whose value is being setval
- new value for columnpublic void delete(long lockid, Text column)
lockid
- lock id returned from startUpdatecolumn
- name of column whose value is to be deletedpublic void deleteAll(Text row, Text column) throws IOException
row
- Row to updatecolumn
- name of column whose value is to be deleted
IOException
public void deleteAll(Text row, Text column, long ts) throws IOException
row
- Row to updatecolumn
- name of column whose value is to be deletedts
- Delete all cells of the same timestamp or older.
IOException
public void abort(long lockid)
lockid
- lock id returned from startUpdatepublic 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
@Deprecated public void renewLease(long lockid)
lockid
- - lock id returned from startUpdate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |