Search in sources :

Example 1 with InMemoryTableAdmin

use of co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTableAdmin in project cdap by caskdata.

the class InMemoryStreamConsumerStateStoreFactory method dropAllInNamespace.

@Override
public synchronized void dropAllInNamespace(NamespaceId namespace) throws IOException {
    TableId tableId = StreamUtils.getStateStoreTableId(namespace);
    InMemoryTableAdmin admin = new InMemoryTableAdmin(DatasetContext.from(tableId.getNamespace()), tableId.getTableName(), cConf);
    admin.drop();
}
Also used : TableId(co.cask.cdap.data2.util.TableId) InMemoryTableAdmin(co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTableAdmin)

Example 2 with InMemoryTableAdmin

use of co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTableAdmin in project cdap by caskdata.

the class InMemoryStreamConsumerStateStoreFactory method create.

@Override
public synchronized StreamConsumerStateStore create(StreamConfig streamConfig) throws IOException {
    NamespaceId namespace = streamConfig.getStreamId().getParent();
    TableId tableId = StreamUtils.getStateStoreTableId(namespace);
    InMemoryTableAdmin admin = new InMemoryTableAdmin(DatasetContext.from(tableId.getNamespace()), tableId.getTableName(), cConf);
    if (!admin.exists()) {
        admin.create();
    }
    InMemoryTable table = new NoTxInMemoryTable(DatasetContext.from(tableId.getNamespace()), tableId.getTableName(), cConf);
    return new InMemoryStreamConsumerStateStore(streamConfig, table);
}
Also used : TableId(co.cask.cdap.data2.util.TableId) InMemoryTable(co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTable) NoTxInMemoryTable(co.cask.cdap.data2.dataset2.lib.table.inmemory.NoTxInMemoryTable) InMemoryTableAdmin(co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTableAdmin) NamespaceId(co.cask.cdap.proto.id.NamespaceId) NoTxInMemoryTable(co.cask.cdap.data2.dataset2.lib.table.inmemory.NoTxInMemoryTable)

Aggregations

InMemoryTableAdmin (co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTableAdmin)2 TableId (co.cask.cdap.data2.util.TableId)2 InMemoryTable (co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTable)1 NoTxInMemoryTable (co.cask.cdap.data2.dataset2.lib.table.inmemory.NoTxInMemoryTable)1 NamespaceId (co.cask.cdap.proto.id.NamespaceId)1