Search in sources :

Example 1 with InMemoryTable

use of co.cask.cdap.data2.dataset2.lib.table.inmemory.InMemoryTable 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

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