Search in sources :

Example 1 with IndexedTableDefinition

use of io.cdap.cdap.api.dataset.lib.IndexedTableDefinition in project cdap by caskdata.

the class CoreDatasetsModule method register.

@Override
public void register(DatasetDefinitionRegistry registry) {
    DatasetDefinition<Table, DatasetAdmin> tableDef = registry.get("table");
    DatasetDefinition<KeyValueTable, DatasetAdmin> kvTableDef = new KeyValueTableDefinition(KeyValueTable.TYPE, tableDef);
    registry.add(kvTableDef);
    registry.add(new KeyValueTableDefinition(KeyValueTable.class.getName(), tableDef));
    DatasetDefinition<ObjectStore, DatasetAdmin> objectStoreDef = new ObjectStoreDefinition(ObjectStore.TYPE, kvTableDef);
    registry.add(new ObjectStoreDefinition(ObjectStore.TYPE, kvTableDef));
    registry.add(new ObjectStoreDefinition(ObjectStore.class.getName(), kvTableDef));
    registry.add(new IndexedObjectStoreDefinition(IndexedObjectStore.TYPE, tableDef, objectStoreDef));
    registry.add(new IndexedObjectStoreDefinition(IndexedObjectStore.class.getName(), tableDef, objectStoreDef));
    registry.add(new IndexedTableDefinition(IndexedTable.TYPE, tableDef));
    registry.add(new IndexedTableDefinition(IndexedTable.class.getName(), tableDef));
    registry.add(new TimeseriesTableDefinition(TimeseriesTable.TYPE, tableDef));
    registry.add(new TimeseriesTableDefinition(TimeseriesTable.class.getName(), tableDef));
    registry.add(new CounterTimeseriesTableDefinition(CounterTimeseriesTable.TYPE, tableDef));
    registry.add(new CounterTimeseriesTableDefinition(CounterTimeseriesTable.class.getName(), tableDef));
    // in-memory table
    registry.add(new InMemoryTableDefinition(InMemoryTable.TYPE));
}
Also used : ObjectStore(io.cdap.cdap.api.dataset.lib.ObjectStore) IndexedObjectStore(io.cdap.cdap.api.dataset.lib.IndexedObjectStore) Table(io.cdap.cdap.api.dataset.table.Table) InMemoryTable(io.cdap.cdap.data2.dataset2.lib.table.inmemory.InMemoryTable) CounterTimeseriesTable(io.cdap.cdap.api.dataset.lib.CounterTimeseriesTable) TimeseriesTable(io.cdap.cdap.api.dataset.lib.TimeseriesTable) IndexedTable(io.cdap.cdap.api.dataset.lib.IndexedTable) KeyValueTable(io.cdap.cdap.api.dataset.lib.KeyValueTable) DatasetAdmin(io.cdap.cdap.api.dataset.DatasetAdmin) InMemoryTableDefinition(io.cdap.cdap.data2.dataset2.lib.table.inmemory.InMemoryTableDefinition) CounterTimeseriesTableDefinition(io.cdap.cdap.api.dataset.lib.CounterTimeseriesTableDefinition) IndexedTableDefinition(io.cdap.cdap.api.dataset.lib.IndexedTableDefinition) KeyValueTable(io.cdap.cdap.api.dataset.lib.KeyValueTable) IndexedObjectStoreDefinition(io.cdap.cdap.api.dataset.lib.IndexedObjectStoreDefinition) KeyValueTableDefinition(io.cdap.cdap.api.dataset.lib.KeyValueTableDefinition) IndexedObjectStoreDefinition(io.cdap.cdap.api.dataset.lib.IndexedObjectStoreDefinition) TimeseriesTableDefinition(io.cdap.cdap.api.dataset.lib.TimeseriesTableDefinition) CounterTimeseriesTableDefinition(io.cdap.cdap.api.dataset.lib.CounterTimeseriesTableDefinition)

Example 2 with IndexedTableDefinition

use of io.cdap.cdap.api.dataset.lib.IndexedTableDefinition in project cdap by caskdata.

the class MetadataDatasetTest method before.

@SuppressWarnings("unchecked")
@Before
public void before() throws Exception {
    DatasetContext datasetContext = DatasetContext.from(NamespaceId.SYSTEM.getNamespace());
    if (admin == null) {
        DatasetDefinition tableDefinition = dsFrameworkUtil.getInjector().getInstance(Key.get(DatasetDefinition.class, Names.named(Constants.Dataset.TABLE_TYPE)));
        definition = new MetadataDatasetDefinition(MetadataDataset.TYPE, new IndexedTableDefinition("indexedTable", tableDefinition));
        String scope = MetadataScope.SYSTEM.name();
        spec = definition.configure("testMetadata", DatasetProperties.builder().add(MetadataDatasetDefinition.SCOPE_KEY, scope).build());
        admin = definition.getAdmin(datasetContext, spec, null);
    }
    if (!admin.exists()) {
        admin.create();
    }
    dataset = definition.getDataset(datasetContext, spec, Collections.emptyMap(), null);
    txnl = dsFrameworkUtil.newInMemoryTransactionExecutor((TransactionAware) dataset);
}
Also used : IndexedTableDefinition(io.cdap.cdap.api.dataset.lib.IndexedTableDefinition) TransactionAware(org.apache.tephra.TransactionAware) DatasetContext(io.cdap.cdap.api.dataset.DatasetContext) DatasetDefinition(io.cdap.cdap.api.dataset.DatasetDefinition) Before(org.junit.Before)

Aggregations

IndexedTableDefinition (io.cdap.cdap.api.dataset.lib.IndexedTableDefinition)2 DatasetAdmin (io.cdap.cdap.api.dataset.DatasetAdmin)1 DatasetContext (io.cdap.cdap.api.dataset.DatasetContext)1 DatasetDefinition (io.cdap.cdap.api.dataset.DatasetDefinition)1 CounterTimeseriesTable (io.cdap.cdap.api.dataset.lib.CounterTimeseriesTable)1 CounterTimeseriesTableDefinition (io.cdap.cdap.api.dataset.lib.CounterTimeseriesTableDefinition)1 IndexedObjectStore (io.cdap.cdap.api.dataset.lib.IndexedObjectStore)1 IndexedObjectStoreDefinition (io.cdap.cdap.api.dataset.lib.IndexedObjectStoreDefinition)1 IndexedTable (io.cdap.cdap.api.dataset.lib.IndexedTable)1 KeyValueTable (io.cdap.cdap.api.dataset.lib.KeyValueTable)1 KeyValueTableDefinition (io.cdap.cdap.api.dataset.lib.KeyValueTableDefinition)1 ObjectStore (io.cdap.cdap.api.dataset.lib.ObjectStore)1 TimeseriesTable (io.cdap.cdap.api.dataset.lib.TimeseriesTable)1 TimeseriesTableDefinition (io.cdap.cdap.api.dataset.lib.TimeseriesTableDefinition)1 Table (io.cdap.cdap.api.dataset.table.Table)1 InMemoryTable (io.cdap.cdap.data2.dataset2.lib.table.inmemory.InMemoryTable)1 InMemoryTableDefinition (io.cdap.cdap.data2.dataset2.lib.table.inmemory.InMemoryTableDefinition)1 TransactionAware (org.apache.tephra.TransactionAware)1 Before (org.junit.Before)1