@Override public GraphExtension create(long byteCount) { final File file = new File(dir.getLocation() + "/transit_schedule"); try { Files.deleteIfExists(file.toPath()); } catch (IOException e) { throw new RuntimeException(e); } this.data = DBMaker.newFileDB(file).transactionDisable().mmapFileEnable().asyncWriteEnable().make(); init(); return this; }
@Override public boolean loadExisting() { this.data = DBMaker.newFileDB(new File(dir.getLocation() + "/transit_schedule")).transactionDisable().mmapFileEnable().readOnly().make(); init(); for (String gtfsFeedId : this.gtfsFeedIds) { GTFSFeed feed = new GTFSFeed(new File(dir.getLocation() + "/" + gtfsFeedId)); this.gtfsFeeds.put(gtfsFeedId, feed); this.transfers.put(gtfsFeedId, new Transfers(feed)); } return true; }
.newFileDB(tmpFile) .closeOnJvmShutdown() .transactionDisable()
private static DB constructDB(File file) { return DBMaker.newFileDB(file) .transactionDisable() .mmapFileEnable() .asyncWriteEnable() .compressionEnable() .make(); }
db = DBMaker.newFileDB(dbFile) .closeOnJvmShutdown() .transactionDisable()
m = DBMaker.newFileDB(new File(rootPath.toFile(), storageType.toString()));
private void init() { DBMaker maker; if (file == null) maker = DBMaker.newMemoryDB(); else { if (overwrite) wipe(file); maker = DBMaker.newFileDB(new File(file)); maker = maker.cacheSize(cache_size); if (async) { maker = maker.asyncWriteEnable(); maker = maker.asyncWriteFlushDelay(10000); } if (mmap) maker = maker.mmapFileEnableIfSupported(); if (compression) maker = maker.compressionEnable(); if (snapshot) maker = maker.snapshotEnable(); if (notxn) maker = maker.transactionDisable(); } db = maker.make(); if (!db.exists("idmap")) idmap = db.createHashMap("idmap") .valueSerializer(new RecordSerializer()) .make(); else idmap = db.getHashMap("idmap"); }
public MapDbPersistentStore(File dataDirectory) { db = DBMaker.newFileDB(new File(dataDirectory, "store")).make(); }
@Activate public void activate() { dbFolderName = ConfigConstants.getUserDataFolder() + File.separator + dbFolderName; File folder = new File(dbFolderName); if (!folder.exists()) { folder.mkdirs(); } File dbFile = new File(dbFolderName, DB_FILE_NAME); db = DBMaker.newFileDB(dbFile).closeOnJvmShutdown().make(); logger.debug("Opened MapDB file at '{}'.", dbFile.getAbsolutePath()); }
public static synchronized DBMaker<?> SafeDefaultDb(String loc,String name){ File dbFile = new File(loc); if (!dbFile.exists()) dbFile.mkdirs(); dbFile = new File(dbFile, "mapdb"); logger.info("Opening DB "+name+" at " + dbFile); // Storing gigantic maps in this temporary DB return DBMaker.newFileDB(dbFile).freeSpaceReclaimQ(3) .mmapFileEnablePartial() .cacheLRUEnable() .closeOnJvmShutdown(); } public static <K extends Comparable<K>, V> BTreeMap<K, V> batchCreate(final Map<K, V> map,
public static synchronized DBMaker<?> SafeDefaultDb(String loc,String name){ File dbFile = new File(loc); if (!dbFile.exists()) dbFile.mkdirs(); dbFile = new File(dbFile, "mapdb"); logger.info("Opening DB "+name+" at " + dbFile); // Storing gigantic maps in this temporary DB return DBMaker.newFileDB(dbFile).freeSpaceReclaimQ(3) .mmapFileEnablePartial() .cacheLRUEnable() .closeOnJvmShutdown(); } public static <K extends Comparable<K>, V> BTreeMap<K, V> batchCreate(final Map<K, V> map,
public static synchronized DBMaker<?> SafeDefaultDb(String loc,String name){ File dbFile = new File(loc); if (!dbFile.exists()) dbFile.mkdirs(); dbFile = new File(dbFile, "mapdb"); logger.info("Opening DB "+name+" at " + dbFile); // Storing gigantic maps in this temporary DB return DBMaker.newFileDB(dbFile).freeSpaceReclaimQ(3) .mmapFileEnablePartial() .cacheLRUEnable() .closeOnJvmShutdown(); } public static <K extends Comparable<K>, V> BTreeMap<K, V> batchCreate(final Map<K, V> map,
public IdStore(File directory, String idName) { if(!directory.exists()) directory.mkdirs(); DBMaker dbm = DBMaker.newFileDB(new File(directory, "id_" + idName + ".db")) .mmapFileEnableIfSupported() .closeOnJvmShutdown(); db = dbm.make(); id = db.createAtomicLong(idName, INITIAL_VALUE); }
@Override public V put(K key, V value) { if (hashMap.size() == THRESHOLD) { File dbFile; try { dbFile = File.createTempFile("mapdb", "temp"); } catch (IOException e) { throw new UncheckedIOException(e); } mapDB = DBMaker.newFileDB(dbFile).deleteFilesAfterClose().transactionDisable().make(); map = mapDB.createHashMap("map").make(); map.putAll(hashMap); hashMap.clear(); } if (map == null) { return hashMap.put(key, value); } return map.put(key, value); }
@Provides @Singleton DB getMaker() { File dbLocation = new File(configuration.getLocation(), "SciGraphIdMap"); return DBMaker.newFileDB(dbLocation).closeOnJvmShutdown().transactionDisable().mmapFileEnable() .make(); }
private MapDb() { try { File file = File.createTempFile("geo-analyzer", ".db"); db = DBMaker.newFileDB(file).asyncWriteEnable().cacheSize(100000) .closeOnJvmShutdown().transactionDisable().make(); } catch (IOException e) { throw new RuntimeException(e); } }
private static DB constructDB(String dbFile) { DB db; try{ DBMaker dbMaker = DBMaker.newFileDB(new File(dbFile)); db = dbMaker .transactionDisable() .mmapFileEnable() .asyncWriteEnable() .compressionEnable() // .cacheSize(1024 * 1024) this bloats memory consumption .make(); return db; } catch (ExecutionError | IOError | Exception e) { LOG.error("Could not construct db from file.", e); return null; } }
public DB initDb(String cacheName) throws PropertyEnricherException { File mapdbCacheDir = new File(getCacheDir(), "mapdb"); createCacheDir(mapdbCacheDir, isTemporary()); DBMaker dbMaker = DBMaker .newFileDB(new File(mapdbCacheDir, cacheName)) .mmapFileEnableIfSupported() .closeOnJvmShutdown() .transactionDisable(); if (isTemporary()) { dbMaker.deleteFilesAfterClose(); } return dbMaker .make(); }
public MapDbByteStore(File dir, String dbname, boolean readonly) { this.dir = dir; LessFiles.initDirectory(dir); this.dbFile = new File(dir, "mapdb"); DBMaker dbMaker = DBMaker.newFileDB(dbFile) .transactionDisable() .cacheDisable() .mmapFileEnableIfSupported(); if (readonly) { dbMaker = dbMaker.readOnly(); } this.db = dbMaker.make(); this.btree = db.createTreeMap(dbname) .valuesOutsideNodesEnable() .comparator(UnsignedBytes.lexicographicalComparator()) .makeOrGet(); log.info("MapDB ByteStore started up for {}", dir); }