org.mapdb.DBMaker Java Examples

The following examples show how to use org.mapdb.DBMaker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HugeMap.java    From molgenis with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: WalletDatabase.java    From Qora with MIT License 6 votes vote down vote up
public WalletDatabase()
{
	//OPEN WALLET
	WALLET_FILE.getParentFile().mkdirs();
	
	//DELETE TRANSACTIONS
	//File transactionFile = new File(Settings.getInstance().getWalletDir(), "wallet.dat.t");
	//transactionFile.delete();	
	
    this.database = DBMaker.newFileDB(WALLET_FILE)
    		.closeOnJvmShutdown()
    		.cacheSize(2048)
    		.checksumEnable()
    		.mmapFileEnableIfSupported()
            .make();
    
    this.accountMap = new AccountMap(this, this.database);
    this.transactionMap = new TransactionMap(this, this.database);
    this.blockMap = new BlockMap(this, this.database);
    this.nameMap = new NameMap(this, this.database);
    this.nameSaleMap = new NameSaleMap(this, this.database);
    this.pollMap = new PollMap(this, this.database);
    this.assetMap = new AssetMap(this, this.database);
    this.orderMap = new OrderMap(this, this.database);
    this.assetFavoritesSet = new AssetFavoritesSet(this, this.database);
}
 
Example #3
Source File: DBSet.java    From Qora with MIT License 6 votes vote down vote up
public static DBSet getInstance()
{
	if(instance == null)
	{
		//OPEN DB
		File dbFile = new File(Settings.getInstance().getDataDir(), "data.dat");
		dbFile.getParentFile().mkdirs();
		
		//CREATE DATABASE	
		DB database = DBMaker.newFileDB(dbFile)
				.closeOnJvmShutdown()
				.cacheSize(2048)
				.checksumEnable()
				.mmapFileEnableIfSupported()
				.make();
		
		//CREATE INSTANCE
		instance = new DBSet(database);
	}
	
	return instance;
}
 
Example #4
Source File: SecureWalletDatabase.java    From Qora with MIT License 6 votes vote down vote up
public SecureWalletDatabase(String password)
{
	//OPEN WALLET
	SECURE_WALLET_FILE.getParentFile().mkdirs();
			
	//DELETE TRANSACTIONS
	//File transactionFile = new File(Settings.getInstance().getWalletDir(), "wallet.s.dat.t");
	//transactionFile.delete();	
	
	this.database = DBMaker.newFileDB(SECURE_WALLET_FILE)
					.encryptionEnable(password)
		    		.closeOnJvmShutdown()
		    		.cacheSize(2048)
		    		.checksumEnable()
		    		.mmapFileEnableIfSupported()
		            .make();
		    
	this.accountSeedMap = new AccountSeedMap(this, this.database);
}
 
Example #5
Source File: SparkCache.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
private SparkCache() {
	sparkMap = DBMaker.newTempTreeMap();
	dataMap = DBMaker.newTempTreeMap();
	
	// If we're running in a cluster, where the API is load balanced, we actually
	// need to store the spark bytes in a DB. In memory cache wouldn't work.
	Mongo mongo;
	try {
		mongo = Configuration.getInstance().getMongoConnection();
	} catch (UnknownHostException e) {
		e.printStackTrace();
		return;
	}
	DB db = mongo.getDB("scava");
	DBCollection col = db.getCollection("sparks");
	col.ensureIndex("sparkid");
	col.ensureIndex(new BasicDBObject("created_at", 1), new BasicDBObject("expireAfterSeconds", 3600));
}
 
Example #6
Source File: GroupIterator.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public GroupIterator(EvaluationStrategy strategy, Group group, BindingSet parentBindings,
		long iterationCacheSyncThreshold) throws QueryEvaluationException {
	this.strategy = strategy;
	this.group = group;
	this.parentBindings = parentBindings;
	this.iterationCacheSyncThreshold = iterationCacheSyncThreshold;

	if (this.iterationCacheSyncThreshold > 0) {
		try {
			this.tempFile = File.createTempFile("group-eval", null);
		} catch (IOException e) {
			throw new QueryEvaluationException("could not initialize temp db", e);
		}
		this.db = DBMaker.newFileDB(tempFile).deleteFilesAfterClose().closeOnJvmShutdown().make();
	} else {
		this.tempFile = null;
		this.db = null;
	}
}
 
Example #7
Source File: CachedUtsSynonymExpansionProvider.java    From bioasq with Apache License 2.0 6 votes vote down vote up
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  // initialize delegate
  CustomResourceSpecifier delegateResourceSpecifier = new CustomResourceSpecifier_impl();
  delegateResourceSpecifier.setResourceClassName(delegateClass.getCanonicalName());
  delegate = delegateClass.cast(UIMAFramework.produceResource(delegateClass,
          delegateResourceSpecifier, aAdditionalParams));
  // initialize mapdb
  File file = new File((String) getParameterValue("db-file"));
  db = DBMaker.newFileDB(file).compressionEnable().commitFileSyncDisable().cacheSize(128)
          .closeOnJvmShutdown().make();
  String map = (String) getParameterValue("map-name");
  id2synonyms = db.getHashMap(map);
  return ret;
}
 
Example #8
Source File: FileBackedHashQueue.java    From datacollector with Apache License 2.0 6 votes vote down vote up
public FileBackedHashQueue(File file) throws IOException {
  Files.createDirectories(file.toPath());
  Path f = Files.createTempDirectory(file.toPath(), "db-");
  db = DBMaker.fileDB(new File(f.toFile(), "dbFile"))
      .allocateStartSize(MB_100)
      .allocateIncrement(MB_100)
      .closeOnJvmShutdown()
      .fileDeleteAfterOpen()
      .fileDeleteAfterClose()
      .fileMmapEnable()
      .fileLockDisable()
      .transactionEnable()
      .make();

  underlying = db.hashMap("t").create();
}
 
Example #9
Source File: CachedUtsConceptSearchProvider.java    From bioasq with Apache License 2.0 6 votes vote down vote up
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  // initialize delegate
  CustomResourceSpecifier delegateResourceSpecifier = new CustomResourceSpecifier_impl();
  delegateResourceSpecifier.setResourceClassName(delegateClass.getCanonicalName());
  delegate = delegateClass.cast(UIMAFramework.produceResource(delegateClass,
          delegateResourceSpecifier, aAdditionalParams));
  // initialize mapdb
  File file = new File((String) getParameterValue("db-file"));
  db = DBMaker.newFileDB(file).compressionEnable().commitFileSyncDisable().cacheSize(128)
          .closeOnJvmShutdown().make();
  String map = (String) getParameterValue("map-name");
  string2concept = db.getHashMap(map);
  return ret;
}
 
Example #10
Source File: StoreTest.java    From TarsosLSH with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testStore(){
	DB db = DBMaker.memoryDB().make();
	NavigableSet<long[]>  treeSet = db.treeSet("tree", Serializer.LONG_ARRAY ).createOrOpen();
	long[] e = {7,78,78};
	long[] f = {7,12,78};
	long[] g = {9,78,78};
	long[] h = {6,78,78};
	long[] i = {7,1,78};
	
	treeSet.add(e);
	treeSet.add(f);
	treeSet.add(g);
	treeSet.add(h);
	treeSet.add(i);
	
	long[] k = {7,0,0};
	long[] l = {7,Integer.MAX_VALUE,Integer.MAX_VALUE};
	
	assertEquals(3,treeSet.subSet(k, l).size());
	
	for(long[] element : treeSet.subSet(k, l)){
		System.out.println(element[1]);
	}
}
 
Example #11
Source File: FileBackedHashQueue.java    From datacollector with Apache License 2.0 6 votes vote down vote up
public FileBackedHashQueue(File file) throws IOException {
  Files.createDirectories(file.toPath());
  Path f = Files.createTempDirectory(file.toPath(), "db-");
  db = DBMaker.fileDB(new File(f.toFile(), "dbFile"))
      .allocateStartSize(MB_100)
      .allocateIncrement(MB_100)
      .closeOnJvmShutdown()
      .fileDeleteAfterOpen()
      .fileDeleteAfterClose()
      .fileMmapEnable()
      .fileLockDisable()
      .transactionEnable()
      .make();

  underlying = db.hashMap("t").create();
}
 
Example #12
Source File: SQL_Auto_Incremental_Unique_Key.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    DB db = DBMaker.newTempFileDB().make();

    //open or create new map
    Map<Long, String> map = db.getTreeMap("map");

    // open existing or create new Atomic record with given name
    // if no record with given name exist, new recid is created with value `0`
    Atomic.Long keyinc = Atomic.getLong(db, "map_keyinc");


    // Allocate new unique key to use in map
    // Atomic.Long will use `compare-and-swap` operation to atomically store incremented value
    // Key values can be used only for single insert
    // key == 1
    Long key = keyinc.incrementAndGet();
    map.put(key, "some string");

    // insert second entry,
    // key==2
    map.put(keyinc.incrementAndGet(), "some other string");

    System.out.println(map);

}
 
Example #13
Source File: MapDbPersistenceService.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
public void activate() {
    logger.debug("MapDB persistence service is being activated");

    threadPool = ThreadPoolManager.getPool(getClass().getSimpleName());

    File folder = new File(DB_FOLDER_NAME);
    if (!folder.exists()) {
        if (!folder.mkdirs()) {
            logger.warn("Failed to create one or more directories in the path '{}'", DB_FOLDER_NAME);
            logger.warn("MapDB persistence service activation has failed.");
            return;
        }
    }

    File dbFile = new File(DB_FOLDER_NAME, DB_FILE_NAME);
    db = DBMaker.newFileDB(dbFile).closeOnJvmShutdown().make();
    map = db.createTreeMap("itemStore").makeOrGet();
    logger.debug("MapDB persistence service is now activated");
}
 
Example #14
Source File: Huge_Read.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] args){
DB db = DBMaker.newFileDB(new File("/tmp/db2"))
        .journalDisable()
                //.asyncWriteDisable()
        .make();

Map<Integer, String> map = db.getTreeMap("map");

long time = System.currentTimeMillis();
long max = (int) 1e8;
long step = max/100;
for(int i=0;i<max;i++){
    map.get(i);
    if(i%step == 0){
        System.out.println(100.0 * i/max);
    }

}

System.out.println("Closing");
db.close();

System.out.println(System.currentTimeMillis() - time);
}
 
Example #15
Source File: PersistentCacheConfig.java    From git-as-svn with GNU General Public License v2.0 6 votes vote down vote up
@NotNull
@Override
public DB createCache(@NotNull Path basePath) throws IOException {
  final Path cacheBase = ConfigHelper.joinPath(basePath, path);
  Files.createDirectories(cacheBase.getParent());

  try {
    final DBMaker.Maker maker = DBMaker.fileDB(cacheBase.toFile())
        .closeOnJvmShutdown()
        .fileMmapEnableIfSupported();

    if (enableTransactions)
      maker.transactionEnable();

    return maker
        .make();
  } catch (DBException e) {
    throw new DBException(String.format("Failed to open %s: %s", cacheBase, e.getMessage()), e);
  }
}
 
Example #16
Source File: RCDB.java    From OSPREY3 with GNU General Public License v2.0 6 votes vote down vote up
public RCDB(MultiStateConfSpace confSpace, MathContext mathContext, File file) {

		this.confSpace = confSpace;
		this.mathContext = mathContext;
		this.file = file;

		// open the DB
		if (file != null) {
			db = DBMaker.fileDB(file)
				.fileMmapEnableIfSupported() // use memory-mapped files if possible (can be much faster)
				.closeOnJvmShutdown()
				.make();
		} else {
			db = DBMaker.memoryDB()
				.make();
		}
	}
 
Example #17
Source File: RafsStrategy.java    From Panako with GNU Affero General Public License v3.0 6 votes vote down vote up
public RafsStrategy(){
	
	String mapsDBFileName = Config.get(Key.RAFS_DATABASE);
	int searchRadius = Config.getInt(Key.RAFS_HAMMINNG_SEARCH_RADIUS);
	int chunks = Config.getInt(Key.RAFS_MIH_CHUNKS);
	int numBits = Config.getInt(Key.RAFS_HAMMING_SPACE_NUM_BITS);
	
	mih = new MultiIndexHasher(numBits, searchRadius, chunks, new MapDBStorage(chunks,mapsDBFileName));
	
	 File dbFile = new File(Config.get(Key.RAFS_DATABASE) + "desc.db");
	 db = DBMaker.fileDB(dbFile)
				.closeOnJvmShutdown() // close the database automatically
				.make();
		
	 final String audioStore = "audio_store";
	// The meta-data store.
	audioNameStore = db.treeMap(audioStore).keySerializer(Serializer.INTEGER).valueSerializer(Serializer.STRING)
	.counterEnable() // enable size counter
	.createOrOpen();
		
}
 
Example #18
Source File: AbstractProcessorGroupByExpressions.java    From FortifyBugTrackerUtility with MIT License 6 votes vote down vote up
/**
 * If grouping is enabled, initialize the temporary cache that will hold grouped objects.
 */
@SuppressWarnings("unchecked")
@Override
protected final boolean preProcess(Context context) {
	if ( isGroupingEnabled(context) ) {
		IContextGrouping ctx = context.as(IContextGrouping.class);
		DB db = DBMaker.tempFileDB()
				.closeOnJvmShutdown().fileDeleteAfterClose()
				.fileMmapEnableIfSupported()
				.make();
		Map<String, List<Object>> groups = db.hashMap("groups", Serializer.STRING, Serializer.JAVA).create();
		groups.clear(); // Make sure that we start with a clean cache 
		ctx.setGroupByExpressionsMapDB(db);
		ctx.setGroupByExpressionsGroupsMap(groups);
	}
	return preProcessBeforeGrouping(context);
}
 
Example #19
Source File: ChromaPrintStrategy.java    From Panako with GNU Affero General Public License v3.0 6 votes vote down vote up
public ChromaPrintStrategy() {
	String chomaprintDBFileName = "chormaprint.db";
	 File dbFile = new File(chomaprintDBFileName);
	 db = DBMaker.fileDB(dbFile)
				.closeOnJvmShutdown() // close the database automatically
				.make();
		
	 final String chromaPrintStoreName = "chroma_print_store";
	// The meta-data store.
	 chromaPrintStore = db.treeMap(chromaPrintStoreName)
			.keySerializer(Serializer.LONG)
			.valueSerializer(Serializer.STRING)
			.counterEnable() // enable size counter
			.createOrOpen();
	// The meta-data store.
	 final String audioStoreName = "audio_store";
	audioNameStore = db.treeMap(audioStoreName)
			.keySerializer(Serializer.INTEGER)
			.valueSerializer(Serializer.STRING)
			.counterEnable() // enable size counter
			.createOrOpen();
	
}
 
Example #20
Source File: MapDBTestSuite.java    From eagle with Apache License 2.0 6 votes vote down vote up
@Test
public void testOnHeapDB() {
    DB db = DBMaker.heapDB().make();
    BTreeMap<Long, String> map = db.treeMap("btree").keySerializer(Serializer.LONG).valueSerializer(Serializer.STRING).create();
    Assert.assertFalse(map.putIfAbsentBoolean(1L, "val_1"));
    Assert.assertTrue(map.putIfAbsentBoolean(1L, "val_2"));
    Assert.assertTrue(map.putIfAbsentBoolean(1L, "val_3"));
    Assert.assertFalse(map.putIfAbsentBoolean(2L, "val_4"));

    Assert.assertEquals("val_1", map.get(1L));
    Assert.assertEquals("val_4", map.get(2L));

    Assert.assertTrue(map.replace(2L, "val_4", "val_5"));
    Assert.assertEquals("val_5", map.get(2L));

    map.close();
    db.close();
}
 
Example #21
Source File: DiffIndexUpgrades.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private static void upgradeV2(DiffIndex index) {
	index.close();
	File file = new File(index.getDir(), "indexfile");
	DB db = DBMaker.fileDB(file).lockDisable().closeOnJvmShutdown().make();
	org.mapdb.Atomic.Integer v = db.atomicInteger("version");
	File tmpFile = new File(index.getDir(), "tmpindexfile");
	DB db2 = DBMaker.fileDB(tmpFile).lockDisable().closeOnJvmShutdown().make();
	Map<String, Diff> oldIndex = db.hashMap("diffIndex");
	Map<String, Set<String>> changedTopLevelElements = db.hashMap("changedTopLevelElements");
	Map<String, Diff> tmpIndex = db2.hashMap("diffIndex");
	Map<String, Set<String>> tmpChangedTopLevelElements = db2.hashMap("changedTopLevelElements");
	for (String oldKey : oldIndex.keySet()) {
		Diff value = oldIndex.get(oldKey);
		tmpIndex.put(value.getDataset().toId(), value);
	}
	tmpChangedTopLevelElements.putAll(changedTopLevelElements);
	v = db2.atomicInteger("version");
	v.set(2);
	db2.commit();
	db2.close();
	db.close();
	file.delete();
	tmpFile.renameTo(file);
	index.open();
}
 
Example #22
Source File: CacheManager.java    From NNAnalytics with Apache License 2.0 6 votes vote down vote up
/** Opens and initializes the cache for reading / writing. */
public void start(ApplicationConfiguration conf) throws IOException {
  String baseDir = conf.getBaseDir();
  File expectedDbDir = new File(baseDir + "/db");
  if (!expectedDbDir.exists()) {
    FileUtils.forceMkdir(new File(baseDir + "/db"));
  }
  cache =
      DBMaker.fileDB(baseDir + "/db/nna_cache")
          .fileMmapEnableIfSupported()
          .fileMmapPreclearDisable()
          .transactionEnable()
          .closeOnJvmShutdown()
          .cleanerHackEnable()
          .make();
}
 
Example #23
Source File: MapDB.java    From dexter with Apache License 2.0 6 votes vote down vote up
private void openDb(File dbFolder, String dbName) {
	if (!dbFolder.exists())
		dbFolder.mkdir();
	if (!dbFolder.isDirectory())
		throw new MapDBException("file " + dbFolder
				+ " exists but it is not a directory");
	File dbPath = new File(dbFolder, dbName);
	logger.info("open db in {} ", dbPath.getAbsolutePath());
	if (readonly) {
		// NOTE: i don't need transactions, disabling should improve speed
		db = DBMaker.newFileDB(dbPath).transactionDisable()
				.closeOnJvmShutdown().readOnly().make();
	} else {
		db = DBMaker.newFileDB(dbPath).transactionDisable()
				.closeOnJvmShutdown().make();
	}

}
 
Example #24
Source File: Cacher.java    From griffin with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new Cacher with a file database in the ROOT_FOLDER with
 * asyncWriteEnabled and transactionDisabled with JVM shutdown hook.
 */
public Cacher() {
    db = DBMaker.newFileDB(new File(CACHE_PATH))
            .asyncWriteEnable()
            .closeOnJvmShutdown()
            .transactionDisable()
            .mmapFileEnableIfSupported()
            .make();
}
 
Example #25
Source File: StreamWindowRepository.java    From eagle with Apache License 2.0 5 votes vote down vote up
private DB createMapDB(StorageType storageType) {
    synchronized (dbPool) {
        if (!dbPool.containsKey(storageType)) {
            DB db;
            switch (storageType) {
                case ONHEAP:
                    db = DBMaker.heapDB().closeOnJvmShutdown().make();
                    LOG.info("Create ONHEAP mapdb");
                    break;
                case MEMORY:
                    db = DBMaker.memoryDB().closeOnJvmShutdown().make();
                    LOG.info("Create MEMORY mapdb");
                    break;
                case DIRECT_MEMORY:
                    db = DBMaker.memoryDirectDB().closeOnJvmShutdown().make();
                    LOG.info("Create DIRECT_MEMORY mapdb");
                    break;
                case FILE_RAF:
                    try {
                        File file = File.createTempFile("window-", ".map");
                        file.delete();
                        file.deleteOnExit();
                        Preconditions.checkNotNull(file, "file is null");
                        db = DBMaker.fileDB(file).deleteFilesAfterClose().make();
                        LOG.info("Created FILE_RAF map file at {}", file.getAbsolutePath());
                    } catch (IOException e) {
                        throw new IllegalStateException(e);
                    }
                    break;
                default:
                    throw new IllegalArgumentException("Illegal storage type: " + storageType);
            }
            dbPool.put(storageType, db);
            return db;
        }
        return dbPool.get(storageType);
    }
}
 
Example #26
Source File: MapDBContext.java    From TelegramBots with MIT License 5 votes vote down vote up
/**
 * This DB returned by this method gets deleted on JVM shutdown.
 *
 * @param name name of the DB file
 * @return an offline instance of {@link MapDBContext}
 */
public static DBContext offlineInstance(String name) {
  DB db = DBMaker
      .fileDB(name)
      .fileMmapEnableIfSupported()
      .closeOnJvmShutdown()
      .transactionEnable()
      .fileDeleteAfterClose()
      .make();

  return new MapDBContext(db);
}
 
Example #27
Source File: GitConverterTest.java    From git-lfs-migrate with MIT License 5 votes vote down vote up
@Test(dataProvider = "matchFilenameProvider")
public void matchFilenameTest(@NotNull String path, boolean expected) throws IOException, InvalidPatternException {
  FileSystem fs = Jimfs.newFileSystem(Configuration.unix());
  GitConverter converter = new GitConverter(DBMaker.memoryDB().make(), fs.getPath("/tmp/migrate"), new String[]{
      "*.zip",
      ".*",
      "LICENSE",
      "test*",
      "/root",
      "some/data",
  });
  Assert.assertEquals(converter.matchFilename(path), expected);
}
 
Example #28
Source File: DBSet.java    From Qora with MIT License 5 votes vote down vote up
public static DBSet createEmptyDatabaseSet()
{
	DB database = DBMaker.newMemoryDB()
			.make();
	
	return new DBSet(database);
}
 
Example #29
Source File: InMemoryModesUnitTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void givenDBCreatedBaseOnByteArray_whenUsed_checkUsageCorrect() {

    DB heapDB = DBMaker.memoryDB().make();

    HTreeMap<Integer, String> map = heapDB
      .hashMap("myMap")
      .keySerializer(Serializer.INTEGER)
      .valueSerializer(Serializer.STRING)
      .createOrOpen();

    map.put(1, "ONE");

    assertEquals("ONE", map.get(1));
}
 
Example #30
Source File: JelectrumDBMapDB.java    From jelectrum with MIT License 5 votes vote down vote up
private void openDb()
{
    String path = conf.get("db_path");

    db = DBMaker.newFileDB(new File(path + "/jelectrum"))
        .closeOnJvmShutdown()
        //.checksumEnable()
        //.compressionEnable()
        //.transactionDisable()
        //.mmapFileEnable()
        .make();

    //tx_map = db.getHashMap("tx_map");
    tx_map = new FragMap<Sha256Hash, SerializedTransaction>(db, "tx_map", 64);
    //address_to_tx_map = db.getHashMap("address_to_tx_map");
    address_to_tx_map = new FragMap<String, HashSet<Sha256Hash> >(db, "address_to_tx_map", 64);
    block_store_map = db.getHashMap("block_store_map");
    special_block_store_map = db.getHashMap("special_block_store_map");
    block_map = db.getHashMap("block_map");
    //tx_to_block_map = db.getHashMap("tx_to_block_map");
    tx_to_block_map = new FragMap<Sha256Hash, HashSet<Sha256Hash> >(db, "tx_to_block_map", 64);

    //db.compact();

    //System.out.println("Blocks: " + block_map.size());
    //System.out.println("Transactions: " + tx_map.size());
    //System.out.println("Addresses: " + address_to_tx_map.size());

}