private File getMetadataDBPath(String tableName) throws IOException { String fileName = String.format("%s.%s", NamespaceId.SYSTEM, tableName); return ensureDirExists(new File(baseDir, fileName)); }
private File getDataDBPath(String tableName, TopicId topicId, int generation) throws IOException { return getDataDBPath(tableName, topicId, generation, true); }
@Override public synchronized MetadataTable createMetadataTable() throws IOException { if (metadataTable != null) { return metadataTable; } File dbPath = getMetadataDBPath(metadataTableName); metadataTable = new LevelDBMetadataTable(LEVEL_DB_FACTORY.open(dbPath, dbOptions)); LOG.info("Messaging metadata table created at {}", dbPath); return metadataTable; }
@BeforeClass public static void init() throws IOException { cConf = CConfiguration.create(); cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath()); tableFactory = new LevelDBTableFactory(cConf); }
@BeforeClass public static void init() throws IOException { CConfiguration cConf = CConfiguration.create(); cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath()); tableFactory = new LevelDBTableFactory(cConf); }
private File getDataDBPath(String tableName, TopicId topicId, int generation, boolean ensureExists) throws IOException { String fileName = String.format("%s.%s.%s.%d", topicId.getNamespace(), tableName, topicId.getTopic(), generation); File file = new File(baseDir, fileName); if (ensureExists) { ensureDirExists(file); } return file; }
@BeforeClass public static void init() throws IOException { CConfiguration cConf = CConfiguration.create(); cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath()); tableFactory = new LevelDBTableFactory(cConf); }
@Override public synchronized PayloadTable createPayloadTable(String tableName) throws IOException { if (payloadTable != null) { return payloadTable; } File dbPath = ensureDirExists(new File(baseDir, NamespaceId.SYSTEM.getNamespace() + "." + tableName)); payloadTable = new LevelDBPayloadTable(LEVEL_DB_FACTORY.open(dbPath, dbOptions)); LOG.info("Messaging payload table created at {}", dbPath); return payloadTable; }
@BeforeClass public static void init() throws IOException { CConfiguration cConf = CConfiguration.create(); cConf.set(Constants.MessagingSystem.LOCAL_DATA_CLEANUP_FREQUENCY, Integer.toString(CLEANUP_PERIOD_IN_SECS)); cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath()); tableFactory = new LevelDBTableFactory(cConf); }
@Override public synchronized MessageTable createMessageTable(String tableName) throws IOException { if (messageTable != null) { return messageTable; } File dbPath = ensureDirExists(new File(baseDir, NamespaceId.SYSTEM.getNamespace() + "." + tableName)); messageTable = new LevelDBMessageTable(LEVEL_DB_FACTORY.open(dbPath, dbOptions)); LOG.info("Messaging message table created at {}", dbPath); return messageTable; }
@BeforeClass public static void init() throws IOException { zkServer = InMemoryZKServer.builder().setDataDir(TEMP_FOLDER.newFolder()).build(); zkServer.startAndWait(); cConf = CConfiguration.create(); cConf.set(Constants.Zookeeper.QUORUM, zkServer.getConnectionStr()); cConf.setInt(Constants.Zookeeper.CFG_SESSION_TIMEOUT_MILLIS, 2000); cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath()); cConf.set(Constants.MessagingSystem.HTTP_SERVER_BIND_ADDRESS, InetAddress.getLocalHost().getHostName()); cConf.set(Constants.MessagingSystem.SYSTEM_TOPICS, "topic"); cConf.setLong(Constants.MessagingSystem.HA_FENCING_DELAY_SECONDS, 0L); namespaceQueryAdmin = new InMemoryNamespaceAdmin(); levelDBTableFactory = new LevelDBTableFactory(cConf); }
@Override public synchronized MetadataTable createMetadataTable(String tableName) throws IOException { if (metadataTable != null) { return metadataTable; } File dbPath = ensureDirExists(new File(baseDir, NamespaceId.SYSTEM.getNamespace() + "." + tableName)); metadataTable = new LevelDBMetadataTable(LEVEL_DB_FACTORY.open(dbPath, dbOptions)); LOG.info("Messaging metadata table created at {}", dbPath); return metadataTable; }