Class BaseTableRW<T extends org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTable<T>>
java.lang.Object
org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTableRW<T>
- Type Parameters:
T- reference to the table instance class itself for type safety.
- Direct Known Subclasses:
ApplicationTableRW,AppToFlowTableRW,DomainTableRW,EntityTableRW,FlowActivityTableRW,FlowRunTableRW,SubApplicationTableRW
public abstract class BaseTableRW<T extends org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTable<T>>
extends Object
Implements behavior common to tables used in the timeline service storage. It
is thread-safe, and can be used by multiple threads concurrently.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseTableRW(String tableNameConfName, String defaultTableName) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcreateTable(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.conf.Configuration hbaseConf) Used to create the table in HBase.org.apache.hadoop.hbase.client.ResultgetResult(org.apache.hadoop.conf.Configuration hbaseConf, org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.client.Get get) org.apache.hadoop.hbase.client.ResultScannergetResultScanner(org.apache.hadoop.conf.Configuration hbaseConf, org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.client.Scan scan) getTableMutator(org.apache.hadoop.conf.Configuration hbaseConf, org.apache.hadoop.hbase.client.Connection conn) Used to create a type-safe mutator for this table.org.apache.hadoop.hbase.TableNamegetTableName(org.apache.hadoop.conf.Configuration conf) Get the table name for this table.static org.apache.hadoop.hbase.TableNamegetTableName(org.apache.hadoop.conf.Configuration conf, String tableName) Get the table name for the input table.static org.apache.hadoop.hbase.TableNamegetTableName(org.apache.hadoop.conf.Configuration conf, String tableNameInConf, String defaultTableName) Get the table name based on the input config parameters.
-
Constructor Details
-
BaseTableRW
- Parameters:
tableNameConfName- name of config variable that is used to point to this table.defaultTableName- Default table name if table from config is not found.
-
-
Method Details
-
getTableMutator
public TypedBufferedMutator<T> getTableMutator(org.apache.hadoop.conf.Configuration hbaseConf, org.apache.hadoop.hbase.client.Connection conn) throws IOException Used to create a type-safe mutator for this table.- Parameters:
hbaseConf- used to read table name.conn- used to create a table from.- Returns:
- a type safe
BufferedMutatorfor the entity table. - Throws:
IOException- if any exception occurs while creating mutator for the table.
-
getResultScanner
public org.apache.hadoop.hbase.client.ResultScanner getResultScanner(org.apache.hadoop.conf.Configuration hbaseConf, org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.client.Scan scan) throws IOException - Parameters:
hbaseConf- used to read settings that override defaultsconn- used to create table fromscan- that specifies what you want to read from this table.- Returns:
- scanner for the table.
- Throws:
IOException- if any exception occurs while getting the scanner.
-
getResult
public org.apache.hadoop.hbase.client.Result getResult(org.apache.hadoop.conf.Configuration hbaseConf, org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.client.Get get) throws IOException - Parameters:
hbaseConf- used to read settings that override defaultsconn- used to create table fromget- that specifies what single row you want to get from this table- Returns:
- result of get operation
- Throws:
IOException- if any exception occurs while getting the result.
-
getTableName
public static org.apache.hadoop.hbase.TableName getTableName(org.apache.hadoop.conf.Configuration conf, String tableName) Get the table name for the input table.- Parameters:
conf- HBase configuration from which table name will be fetched.tableName- name of the table to be fetched- Returns:
- A
TableNameobject.
-
getTableName
public org.apache.hadoop.hbase.TableName getTableName(org.apache.hadoop.conf.Configuration conf) Get the table name for this table.- Parameters:
conf- HBase configuration from which table name will be fetched.- Returns:
- A
TableNameobject.
-
getTableName
public static org.apache.hadoop.hbase.TableName getTableName(org.apache.hadoop.conf.Configuration conf, String tableNameInConf, String defaultTableName) Get the table name based on the input config parameters.- Parameters:
conf- HBase configuration from which table name will be fetched.tableNameInConf- the table name parameter in conf.defaultTableName- the default table name.- Returns:
- A
TableNameobject.
-
createTable
public abstract void createTable(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.conf.Configuration hbaseConf) throws IOException Used to create the table in HBase. Should be called only once (per HBase instance).- Parameters:
admin- Used for doing HBase table operations.hbaseConf- Hbase configuration.- Throws:
IOException- if any exception occurs while creating the table.
-