|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nhncorp.neptune.client.NTable
public class NTable
NTable represents a table in Neptune and each table contains data of applications with distributed and persistent manner. This class provides applications with convenient way to handle its data, allowing applications to get and put the data as if they are located in local. NTable class is not thread safe, but it is permitted for each thread to own NTable instance and concurrently operate with it.
| Field Summary | |
|---|---|
static int |
MAX_MULTI_ROW_RESULT
|
| Fields inherited from interface com.nhncorp.neptune.common.Constants |
|---|
BATCH_RECEIVER_SUCCESS, BATCH_UPLOAD, CHANGELOG_SERVER, COMPACTION, DELETEED, END_RECEIVE_ROW, GROUPS, INDEX_INTERVAL_LENGH, INSERTED, LOG_OP_ADD_COLUMN_VALUE, LOG_OP_CREATE_ROW, LOG_OP_DELETE_COLUMN_VALUE, LOG_OP_MODIFY_META, MAP_RECORD_COLUMN, MAP_RECORD_ROW, MASTER, MASTER_SERVER, MAX_KEY_LENGTH, MAX_VALUE, META_COLUMN_NAME_TABLETINFO, MIN_VALUE, NEPTUNE, OPEN_SCANNER, PATH_SCHEMA, PIPE_CL_FILE_NAME, PROCESS, ROOT_TABLET, SCANNER_END, SCANNER_OPEN_FAIL, SCANNER_OPEN_SUCCESS, SCHEMA_DESCRIPTION_FILE_NAME, SCHEMA_INFO_FILENAME, SERVER, SPLIT, SPLIT_INFO, SPLIT_STORE, SUPERGROUP, TABLE_DROP, TABLE_LOCK, TABLE_NAME_META, TABLE_NAME_ROOT, TABLET_ALIVE, TABLET_ASSIGN, TABLET_AVAIL, TABLET_CREATED, TABLET_DROP, TABLET_FAIL, TABLET_STOP_MARK, TABLETSERVER_SPLIT, TEST_MODE, UPLOAD_END, UPLOAD_FAIL, UPLOAD_START_ROW, UPLOADER, USERS |
| Method Summary | |
|---|---|
void |
addColumn(java.lang.String addedColumnName)
Append new column. |
TabletInfo |
addTablet(Row.Key endRowKey)
Add new tablet in this table with the specified row key |
static void |
createTable(NConfiguration conf,
TableSchema tableSchema)
Create a new table according to the table schema information |
static void |
createTable(NConfiguration conf,
TableSchema tableSchema,
Row.Key[] endRowKeys)
Create a new table according to the table schma information, then split the newly created table into multiple tablets by the number of row keys specified in the parameter. |
TableSchema |
descTable()
Retrieve table schema information of this NTable instance |
void |
dropTable()
Drop the table of this NTable instance. |
static void |
dropTable(NConfiguration conf,
java.lang.String tableName)
Drop the table specified by the tableName parameter |
static boolean |
existsTable(NConfiguration conf,
java.lang.String tableName)
Check if table exists. |
boolean |
get(java.util.Collection<Row.Key> rowKeys,
java.util.List<CellFilter> cellFilters,
AsyncDataReceiver dataReceiver,
int numOfThread,
int timeout)
This method allows applications to asynchronously receive data. |
boolean |
get(java.util.Collection<Row.Key> rowKeys,
java.lang.String[] columnNames,
AsyncDataReceiver dataReceiver,
int numOfThread,
int timeout)
This method allows applications to asynchronously receive data. |
Row |
get(Row.Key rowKey)
Retrieve all the columns and their values in Row matching with rowKey
If the Row contains too much data, it may cause serious problem. |
Row |
get(Row.Key rowKey,
java.lang.String columnName)
Retrieve data stored in Neptune |
Row |
get(Row.Key rowKey,
java.lang.String[] columnNames)
Retrieve data with row key and specific column names. |
byte[] |
get(Row.Key rowKey,
java.lang.String columnName,
Cell.Key cellKey)
Retrive data the application stored by put method |
Row |
get(RowFilter rowFilter)
Retrieve data stored in Neptune with a specific filter. |
java.lang.String[] |
getColumnsArray()
Return column array |
NConfiguration |
getConf()
Return Neptune configuration object. |
Row[] |
gets(RowFilter rowFilter)
This method is different with other get methods in applying the operation
to multiple rows. |
Row.Key[] |
getSplitedRowKeyRanges(TabletInfo tabletInfo,
int splitPerTablet)
Divides row keys contained in a certain tablet into splitPerTablet rows. |
java.lang.String |
getTableName()
Return current table name. |
TableSchema |
getTableSchema()
Return the table schema information describing this table. |
java.lang.String[] |
getTabletAllActions(TabletInfo tabletInfo)
(Only for management) Retrieve the list of all the actions internally performed in specified tablet |
TabletInfo |
getTabletInfo(java.lang.String tabletName)
Return the tablet information |
com.nhncorp.neptune.tablet.TabletReport |
getTabletReport(TabletInfo tabletInfo)
(Only for management) Get the report of tablet, describing current status of specified tablet. |
boolean |
hasValue(java.lang.String columnName,
Row.Key rowKey)
Check whether a Row with parameter rowkey exists or not
Instead, it is possible to use get() method, but it is not recommended due to performance reason |
static TableSchema[] |
listTables(NConfiguration conf)
Returns schema information of all the tables in Neptune |
TabletInfo[] |
listTabletInfos()
Get the list of all the tablet information of this table. |
static TabletInfo |
lookupTargetTablet(NConfiguration conf,
java.lang.String tableName,
Row.Key rowKey)
Find a tablet serving a specified row and return its information |
TabletInfo |
lookupTargetTablet(Row.Key rowKey)
Find a tablet serving a specified row and return its information |
static void |
main(java.lang.String[] args)
|
DirectUploader |
openDirectUploader(java.lang.String[] columnNames)
Open new BatchUploader and return its instance. |
static NTable |
openTable(NConfiguration conf,
java.lang.String tableName)
Returns NTable instance if exists, otherwise returns null. |
static NTable |
openTable(NConfiguration conf,
TableSchema tableSchema,
boolean create)
Returns NTable instance if exists, otherwise returns null. |
void |
put(Row row)
Put Row data in this table. |
void |
put(Row row,
boolean systemTimestamp)
Put Row data in this table. |
void |
remove(Row.Key rowKey,
java.lang.String columnName,
Cell.Key cellKey)
Remove a Cell in a Row |
void |
removeRow(Row.Key rowKey,
long timestamp)
Remove all cells in a row. |
void |
truncateColumn(java.lang.String columnName)
Delete all the data of a column specified by columnName in this table. |
void |
truncateTable()
Delete all the data contained in this table. |
void |
truncateTable(boolean clearPartitionInfo)
Delete all the data contained in this table. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_MULTI_ROW_RESULT
| Method Detail |
|---|
public static NTable openTable(NConfiguration conf,
java.lang.String tableName)
throws java.io.IOException
conf - Configuration variables of NeptunetableName - table name
java.io.IOException
public static NTable openTable(NConfiguration conf,
TableSchema tableSchema,
boolean create)
throws java.io.IOException
conf - Configuration variables of NeptunetableSchema - create - true, if you want to create a new table when it does not exist.
java.io.IOException
public static boolean existsTable(NConfiguration conf,
java.lang.String tableName)
throws java.io.IOException
conf - Configuration variables of NeptunetableName - table name
java.io.IOException
public static TableSchema[] listTables(NConfiguration conf)
throws java.io.IOException
conf - Configuration variables of Neptune
java.io.IOException
public void put(Row row)
throws java.io.IOException
row -
java.io.IOException
public void put(Row row,
boolean systemTimestamp)
throws java.io.IOException
systemTimestamp is set as true,
Neptune exploits system clock in TabletServer as an identifier of this Row object.
Otherwise, the application has to assign the timestamp value in Row object by itself.
In this case, the application must generate unique timestamp value to avoid data collisions.
row - systemTimestamp - If true, use system timestamp. If false, use user timestamp and you must set timestamp in Cell.Value
java.io.IOException
public void removeRow(Row.Key rowKey,
long timestamp)
throws java.io.IOException
timestamp - When storing change logs of this delete operation, use this timestamp value
java.io.IOException
public void remove(Row.Key rowKey,
java.lang.String columnName,
Cell.Key cellKey)
throws java.io.IOException
rowKey - columnName - cellKey -
java.io.IOException
public boolean hasValue(java.lang.String columnName,
Row.Key rowKey)
throws java.io.IOException
rowkey exists or not
Instead, it is possible to use get() method, but it is not recommended due to performance reason
columnName - rowKey -
rowkey, otherwise false
java.io.IOException
public byte[] get(Row.Key rowKey,
java.lang.String columnName,
Cell.Key cellKey)
throws java.io.IOException
put method
rowKey - columnName - cellKey -
java.io.IOException
public Row get(Row.Key rowKey)
throws java.io.IOException
rowKey
If the Row contains too much data, it may cause serious problem.
Therefore, Neptune restricts the limit in transformation and IOException will be thrown
if the limit exceeds.
rowKey -
java.io.IOException
public Row get(Row.Key rowKey,
java.lang.String[] columnNames)
throws java.io.IOException
rowKey - columnNames -
java.io.IOException
public boolean get(java.util.Collection<Row.Key> rowKeys,
java.util.List<CellFilter> cellFilters,
AsyncDataReceiver dataReceiver,
int numOfThread,
int timeout)
throws java.io.IOException
rowKeys - cellFilters - dataReceiver - numOfThread - timeout -
java.io.IOException
public boolean get(java.util.Collection<Row.Key> rowKeys,
java.lang.String[] columnNames,
AsyncDataReceiver dataReceiver,
int numOfThread,
int timeout)
throws java.io.IOException
rowKeys - columnNames - dataReceiver - timeout -
java.io.IOException
public Row get(Row.Key rowKey,
java.lang.String columnName)
throws java.io.IOException
rowKey - columnName -
java.io.IOException
public Row get(RowFilter rowFilter)
throws java.io.IOException
rowFilter -
java.io.IOException
public Row[] gets(RowFilter rowFilter)
throws java.io.IOException
get methods in applying the operation
to multiple rows. Also, convenient operations such as 'Like', 'Greater than' , 'Less than'
are also supported.
rowFilter -
java.io.IOException
public static void createTable(NConfiguration conf,
TableSchema tableSchema)
throws java.io.IOException
conf - Configuration variables of NeptunetableSchema -
java.io.IOException
public static void createTable(NConfiguration conf,
TableSchema tableSchema,
Row.Key[] endRowKeys)
throws java.io.IOException
endRowKeys -
java.io.IOException
public static void dropTable(NConfiguration conf,
java.lang.String tableName)
throws java.io.IOException
conf - Configuration variables of NeptunetableName - table name
java.io.IOException
public void dropTable()
throws java.io.IOException
java.io.IOException
public void truncateTable(boolean clearPartitionInfo)
throws java.io.IOException
clearPartitionInfo - clear partition information if true.
java.io.IOException
public void truncateTable()
throws java.io.IOException
java.io.IOException
public void truncateColumn(java.lang.String columnName)
throws java.io.IOException
columnName in this table.
columnName -
java.io.IOException
public TableSchema descTable()
throws java.io.IOException
java.io.IOException
public void addColumn(java.lang.String addedColumnName)
throws java.io.IOException
addedColumnName -
java.io.IOException
public TabletInfo addTablet(Row.Key endRowKey)
throws java.io.IOException
tableName - table nameendRowKey -
java.io.IOException
public TabletInfo[] listTabletInfos()
throws java.io.IOException
java.io.IOException
public DirectUploader openDirectUploader(java.lang.String[] columnNames)
throws java.io.IOException
columnNames -
java.io.IOException
public java.lang.String[] getTabletAllActions(TabletInfo tabletInfo)
throws java.io.IOException
tabletInfo -
java.io.IOException
public com.nhncorp.neptune.tablet.TabletReport getTabletReport(TabletInfo tabletInfo)
throws java.io.IOException
tabletInfo -
java.io.IOException
public TabletInfo lookupTargetTablet(Row.Key rowKey)
throws java.io.IOException
rowKey -
java.io.IOException
public static TabletInfo lookupTargetTablet(NConfiguration conf,
java.lang.String tableName,
Row.Key rowKey)
throws java.io.IOException
hashRow.Key -
java.io.IOExceptionpublic java.lang.String getTableName()
public NConfiguration getConf()
public java.lang.String[] getColumnsArray()
throws java.io.IOException
java.io.IOException
public TabletInfo getTabletInfo(java.lang.String tabletName)
throws java.io.IOException
tabletName -
java.io.IOExceptionpublic TableSchema getTableSchema()
public Row.Key[] getSplitedRowKeyRanges(TabletInfo tabletInfo,
int splitPerTablet)
throws java.io.IOException
splitPerTablet rows.
This method is useful in MapReduce application. When multiple Map tasks perform their job
from one tablet on MapReduce, the rows in the tablet should be distributed to the Map tasks.
This method helps divide the range of rows to assign multiple Map tasks.
tabletInfo - splitPerTablet -
java.io.IOException
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||