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

    Constructors
    Modifier
    Constructor
    Description
    protected
    BaseTableRW(String tableNameConfName, String defaultTableName)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    createTable(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.Result
    getResult(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.ResultScanner
    getResultScanner(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.TableName
    getTableName(org.apache.hadoop.conf.Configuration conf)
    Get the table name for this table.
    static org.apache.hadoop.hbase.TableName
    getTableName(org.apache.hadoop.conf.Configuration conf, String tableName)
    Get the table name for the input table.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BaseTableRW

      protected BaseTableRW(String tableNameConfName, String defaultTableName)
      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 BufferedMutator for 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 defaults
      conn - used to create table from
      scan - 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 defaults
      conn - used to create table from
      get - 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 TableName object.
    • 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 TableName object.
    • 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 TableName object.
    • 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.