@Override public TableProvider getTableProvider(TableSpec tableSpec) { return new CachingTableProvider(tableSpec); } }
@Override public TableSpec getTableSpec() { validate(); Map<String, String> tableSpecConfig = new HashMap<>(); generateTableSpecConfig(tableSpecConfig); if (cache != null) { tableSpecConfig.put(CachingTableProvider.CACHE_TABLE_ID, ((BaseTableDescriptor) cache).getTableSpec().getId()); } else { if (readTtl != null) { tableSpecConfig.put(CachingTableProvider.READ_TTL_MS, String.valueOf(readTtl.toMillis())); } if (writeTtl != null) { tableSpecConfig.put(CachingTableProvider.WRITE_TTL_MS, String.valueOf(writeTtl.toMillis())); } if (cacheSize > 0) { tableSpecConfig.put(CachingTableProvider.CACHE_SIZE, String.valueOf(cacheSize)); } } tableSpecConfig.put(CachingTableProvider.REAL_TABLE_ID, ((BaseTableDescriptor) table).getTableSpec().getId()); tableSpecConfig.put(CachingTableProvider.WRITE_AROUND, String.valueOf(isWriteAround)); return new TableSpec(tableId, serde, CachingTableProviderFactory.class.getName(), tableSpecConfig); }
@Override public Table getTable() { String realTableId = tableSpec.getConfig().get(REAL_TABLE_ID); ReadableTable table = (ReadableTable) this.context.getTaskContext().getTable(realTableId); String cacheTableId = tableSpec.getConfig().get(CACHE_TABLE_ID); ReadWriteTable cache; if (cacheTableId != null) { cache = (ReadWriteTable) this.context.getTaskContext().getTable(cacheTableId); } else { cache = createDefaultCacheTable(realTableId); defaultCaches.add(cache); } boolean isWriteAround = Boolean.parseBoolean(tableSpec.getConfig().get(WRITE_AROUND)); CachingTable cachingTable = new CachingTable(tableSpec.getId(), table, cache, isWriteAround); cachingTable.init(this.context); return cachingTable; }
@Override public TableSpec getTableSpec() { validate(); Map<String, String> tableSpecConfig = new HashMap<>(); generateTableSpecConfig(tableSpecConfig); if (cache != null) { tableSpecConfig.put(CachingTableProvider.CACHE_TABLE_ID, ((BaseTableDescriptor) cache).getTableSpec().getId()); } else { if (readTtl != null) { tableSpecConfig.put(CachingTableProvider.READ_TTL_MS, String.valueOf(readTtl.toMillis())); } if (writeTtl != null) { tableSpecConfig.put(CachingTableProvider.WRITE_TTL_MS, String.valueOf(writeTtl.toMillis())); } if (cacheSize > 0) { tableSpecConfig.put(CachingTableProvider.CACHE_SIZE, String.valueOf(cacheSize)); } } tableSpecConfig.put(CachingTableProvider.REAL_TABLE_ID, ((BaseTableDescriptor) table).getTableSpec().getId()); tableSpecConfig.put(CachingTableProvider.WRITE_AROUND, String.valueOf(isWriteAround)); return new TableSpec(tableId, serde, CachingTableProviderFactory.class.getName(), tableSpecConfig); }
@Override public TableProvider getTableProvider(TableSpec tableSpec) { return new CachingTableProvider(tableSpec); } }
@Override public Table getTable() { String realTableId = tableSpec.getConfig().get(REAL_TABLE_ID); ReadableTable table = (ReadableTable) this.context.getTaskContext().getTable(realTableId); String cacheTableId = tableSpec.getConfig().get(CACHE_TABLE_ID); ReadWriteTable cache; if (cacheTableId != null) { cache = (ReadWriteTable) this.context.getTaskContext().getTable(cacheTableId); } else { cache = createDefaultCacheTable(realTableId); defaultCaches.add(cache); } boolean isWriteAround = Boolean.parseBoolean(tableSpec.getConfig().get(WRITE_AROUND)); CachingTable cachingTable = new CachingTable(tableSpec.getId(), table, cache, isWriteAround); cachingTable.init(this.context); return cachingTable; }
@Override public TableSpec getTableSpec() { validate(); Map<String, String> tableSpecConfig = new HashMap<>(); generateTableSpecConfig(tableSpecConfig); if (cache != null) { tableSpecConfig.put(CachingTableProvider.CACHE_TABLE_ID, ((BaseTableDescriptor) cache).getTableSpec().getId()); } else { if (readTtl != null) { tableSpecConfig.put(CachingTableProvider.READ_TTL_MS, String.valueOf(readTtl.toMillis())); } if (writeTtl != null) { tableSpecConfig.put(CachingTableProvider.WRITE_TTL_MS, String.valueOf(writeTtl.toMillis())); } if (cacheSize > 0) { tableSpecConfig.put(CachingTableProvider.CACHE_SIZE, String.valueOf(cacheSize)); } } tableSpecConfig.put(CachingTableProvider.REAL_TABLE_ID, ((BaseTableDescriptor) table).getTableSpec().getId()); tableSpecConfig.put(CachingTableProvider.WRITE_AROUND, String.valueOf(isWriteAround)); return new TableSpec(tableId, serde, CachingTableProviderFactory.class.getName(), tableSpecConfig); }
@Override public TableProvider getTableProvider(TableSpec tableSpec) { return new CachingTableProvider(tableSpec); } }
@Override public Table getTable() { String realTableId = tableSpec.getConfig().get(REAL_TABLE_ID); ReadableTable table = (ReadableTable) this.context.getTaskContext().getTable(realTableId); String cacheTableId = tableSpec.getConfig().get(CACHE_TABLE_ID); ReadWriteTable cache; if (cacheTableId != null) { cache = (ReadWriteTable) this.context.getTaskContext().getTable(cacheTableId); } else { cache = createDefaultCacheTable(realTableId); defaultCaches.add(cache); } boolean isWriteAround = Boolean.parseBoolean(tableSpec.getConfig().get(WRITE_AROUND)); CachingTable cachingTable = new CachingTable(tableSpec.getId(), table, cache, isWriteAround); cachingTable.init(this.context); return cachingTable; }
@Override public TableSpec getTableSpec() { validate(); Map<String, String> tableSpecConfig = new HashMap<>(); generateTableSpecConfig(tableSpecConfig); if (cache != null) { tableSpecConfig.put(CachingTableProvider.CACHE_TABLE_ID, ((BaseTableDescriptor) cache).getTableSpec().getId()); } else { if (readTtl != null) { tableSpecConfig.put(CachingTableProvider.READ_TTL_MS, String.valueOf(readTtl.toMillis())); } if (writeTtl != null) { tableSpecConfig.put(CachingTableProvider.WRITE_TTL_MS, String.valueOf(writeTtl.toMillis())); } if (cacheSize > 0) { tableSpecConfig.put(CachingTableProvider.CACHE_SIZE, String.valueOf(cacheSize)); } } tableSpecConfig.put(CachingTableProvider.REAL_TABLE_ID, ((BaseTableDescriptor) table).getTableSpec().getId()); tableSpecConfig.put(CachingTableProvider.WRITE_AROUND, String.valueOf(isWriteAround)); return new TableSpec(tableId, serde, CachingTableProviderFactory.class.getName(), tableSpecConfig); }
@Override public TableProvider getTableProvider(TableSpec tableSpec) { return new CachingTableProvider(tableSpec); } }
@Override public Table getTable() { String realTableId = tableSpec.getConfig().get(REAL_TABLE_ID); ReadableTable table = (ReadableTable) this.context.getTaskContext().getTable(realTableId); String cacheTableId = tableSpec.getConfig().get(CACHE_TABLE_ID); ReadWriteTable cache; if (cacheTableId != null) { cache = (ReadWriteTable) this.context.getTaskContext().getTable(cacheTableId); } else { cache = createDefaultCacheTable(realTableId); defaultCaches.add(cache); } boolean isWriteAround = Boolean.parseBoolean(tableSpec.getConfig().get(WRITE_AROUND)); CachingTable cachingTable = new CachingTable(tableSpec.getId(), table, cache, isWriteAround); cachingTable.init(this.context); return cachingTable; }