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();
}
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);
}
Aggregations