Search in sources :

Example 41 with MetricsTable

use of io.cdap.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.

the class SystemDatasetRuntimeModule method getInMemoryModules.

@Override
public Module getInMemoryModules() {
    return new AbstractModule() {

        @Override
        protected void configure() {
            MapBinder<String, DatasetModule> mapBinder = MapBinder.newMapBinder(binder(), String.class, DatasetModule.class, Constants.Dataset.Manager.DefaultDatasetModules.class);
            // NOTE: order is important due to dependencies between modules
            mapBinder.addBinding("orderedTable-memory").toInstance(new InMemoryTableModule());
            mapBinder.addBinding("metricsTable-memory").toInstance(new InMemoryMetricsTableModule());
            bindDefaultModules(mapBinder);
            bind(String.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE)).toInstance("table");
            bind(DatasetDefinition.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE)).to(InMemoryTableDefinition.class);
            bind(String.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE_NO_TX)).toInstance("table-no-tx");
            bind(DatasetDefinition.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE_NO_TX)).to(InMemoryMetricsTableDefinition.class);
            // Direct binding for the Metrics table definition such that metrics system doesn't need to go through
            // dataset service to get metrics table.
            bind(new TypeLiteral<DatasetDefinition<MetricsTable, DatasetAdmin>>() {
            }).toInstance(new InMemoryMetricsTableDefinition(MetricsTable.class.getName()));
        }
    };
}
Also used : InMemoryMetricsTableDefinition(io.cdap.cdap.data2.dataset2.lib.table.inmemory.InMemoryMetricsTableDefinition) InMemoryTableModule(io.cdap.cdap.data2.dataset2.module.lib.inmemory.InMemoryTableModule) MetricsTable(io.cdap.cdap.data2.dataset2.lib.table.MetricsTable) InMemoryMetricsTableModule(io.cdap.cdap.data2.dataset2.module.lib.inmemory.InMemoryMetricsTableModule) TypeLiteral(com.google.inject.TypeLiteral) Constants(io.cdap.cdap.common.conf.Constants) DatasetAdmin(io.cdap.cdap.api.dataset.DatasetAdmin) ExternalDatasetModule(io.cdap.cdap.data2.dataset2.lib.external.ExternalDatasetModule) DatasetModule(io.cdap.cdap.api.dataset.module.DatasetModule) AbstractModule(com.google.inject.AbstractModule)

Example 42 with MetricsTable

use of io.cdap.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.

the class CubeModule method register.

@Override
public void register(DatasetDefinitionRegistry registry) {
    DatasetDefinition<Table, ? extends DatasetAdmin> tableDef = registry.get(Table.TYPE);
    DatasetDefinition<MetricsTable, ? extends DatasetAdmin> metricsTableDef = registry.get(MetricsTable.class.getName());
    registry.add(new CubeDatasetDefinition(FULL_NAME, tableDef, metricsTableDef));
    registry.add(new CubeDatasetDefinition(SHORT_NAME, tableDef, metricsTableDef));
}
Also used : Table(io.cdap.cdap.api.dataset.table.Table) CubeDatasetDefinition(io.cdap.cdap.data2.dataset2.lib.cube.CubeDatasetDefinition)

Example 43 with MetricsTable

use of io.cdap.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.

the class NoSqlStructuredTableRegistry method removeSpecification.

@Override
public void removeSpecification(StructuredTableId tableId) {
    LOG.debug("Removing table specification for table {}", tableId);
    MetricsTable table = getRegistryTable();
    try {
        table.delete(getRowKeyBytes(tableId), SCHEMA_COL_BYTES_ARRAY);
    } finally {
        closeRegistryTable(table);
    }
}
Also used : MetricsTable(io.cdap.cdap.data2.dataset2.lib.table.MetricsTable)

Aggregations

MetricsTable (co.cask.cdap.data2.dataset2.lib.table.MetricsTable)19 Test (org.junit.Test)16 MetricsTable (io.cdap.cdap.data2.dataset2.lib.table.MetricsTable)15 DatasetId (co.cask.cdap.proto.id.DatasetId)6 AbstractModule (com.google.inject.AbstractModule)6 InMemoryMetricsTable (io.cdap.cdap.data2.dataset2.lib.table.inmemory.InMemoryMetricsTable)6 InMemoryMetricsTable (co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryMetricsTable)5 MetricsTableTest (co.cask.cdap.data2.dataset2.lib.table.MetricsTableTest)4 CombinedHBaseMetricsTable (co.cask.cdap.data2.dataset2.lib.table.hbase.CombinedHBaseMetricsTable)4 DatasetManagementException (co.cask.cdap.api.dataset.DatasetManagementException)3 DatasetModule (co.cask.cdap.api.dataset.module.DatasetModule)3 Row (co.cask.cdap.api.dataset.table.Row)3 Scanner (co.cask.cdap.api.dataset.table.Scanner)3 Table (co.cask.cdap.api.dataset.table.Table)3 Constants (co.cask.cdap.common.conf.Constants)3 ExternalDatasetModule (co.cask.cdap.data2.dataset2.lib.external.ExternalDatasetModule)3 MetadataDatasetModule (co.cask.cdap.data2.metadata.dataset.MetadataDatasetModule)3 LineageDatasetModule (co.cask.cdap.data2.metadata.lineage.LineageDatasetModule)3 UsageDatasetModule (co.cask.cdap.data2.registry.UsageDatasetModule)3 HBaseQueueDatasetModule (co.cask.cdap.data2.transaction.queue.hbase.HBaseQueueDatasetModule)3