@Override public <K, V> Map<K, V> getMap(String name) { return db.<K, V>hashMap(name, JAVA, JAVA).createOrOpen(); }
public MapDBHashMap(File f) { this.db = DBMaker.fileDB(f).closeOnJvmShutdown().transactionEnable().make(); this.hashMap = db.hashMap(f.getName()) .keySerializer(Serializer.STRING) .valueSerializer(Serializer.STRING) .createOrOpen(); }
private HTreeMap<String, String> getMap(DB db) { HTreeMap<String, String> treeMap = db.hashMap(context); return treeMap; }
public <K, V> HTreeMap<K, V> hashMap(final String name, final Serializer<K> keySerializer, final Serializer<V> valueSerializer, final Function1<V, K> valueCreator) { this.assertNotClosed(); return this.tx.hashMap(name, keySerializer, valueSerializer, valueCreator); }
private ConcurrentMap<Integer, byte[]> getMap(String dataset) { return db.hashMap(dataset, Serializer.INTEGER, Serializer.BYTE_ARRAY).createOrOpen(); }
public <K, V> HTreeMap<K, V> hashMap(final String name) { this.assertNotClosed(); return this.tx.hashMap(name); }
private ConcurrentMap<Integer, byte[]> getMap(String dataset) { return db.hashMap(dataset, Serializer.INTEGER, Serializer.BYTE_ARRAY).createOrOpen(); }
@NotNull public static HTreeMap<String, Long> getCacheSize(@NotNull GitFilter filter, @NotNull DB cacheDb) { return cacheDb.hashMap("cache.filter." + filter.getName() + ".size", Serializer.STRING, Serializer.LONG).createOrOpen(); }
@NotNull public static HTreeMap<String, String> getCacheMd5(@NotNull GitFilter filter, @NotNull DB cacheDb) { return cacheDb.hashMap("cache.filter." + filter.getName() + ".md5", Serializer.STRING, Serializer.STRING).createOrOpen(); }
@Override @SuppressWarnings({"unchecked", "rawtypes"}) protected void internalCopyTo(DataMapper target) { AbstractMapDbBackend to = (AbstractMapDbBackend) target; for (Map.Entry<String, Object> entry : database.getAll().entrySet()) { Object collection = entry.getValue(); if (collection instanceof Map) { Map fromMap = (Map) collection; Map toMap = to.database.hashMap(entry.getKey()).open(); toMap.putAll(fromMap); } else { throw new UnsupportedOperationException(String.format("Cannot copy MapDB backend: store type %s is not supported", collection.getClass().getSimpleName())); } } }
public GitConverter(@NotNull DB cache, @NotNull Path basePath, @NotNull String[] globs) throws IOException, InvalidPatternException { this.basePath = basePath; this.cache = cache; this.globs = globs.clone(); this.matchers = convertGlobs(globs); Arrays.sort(globs); for (String glob : globs) { new FileNameMatcher(glob, '/'); } tempPath = basePath.resolve("lfs/tmp"); Files.createDirectories(tempPath); //noinspection unchecked cacheMeta = cache.<String, MetaData>hashMap("meta") .keySerializer(Serializer.STRING) .valueSerializer(new SerializerJava()) .createOrOpen(); }
protected Storage(){ /* create or open-connection the databases optionally with with crash corruption resistance "transactionEnable" and Mmap if on 64 bit system: */ accountsDB = getDB(pathAccountsDB,false,true); blocksDB = getDB(pathBlocksDB,false,true); transactionsDB = getDB(pathTransactionsDB,false,true); contractCodeDB = getDB(pathContractCodeDB,false,true); contractStatesDB = getDB(pathContractStateDB,false,true); /* create or open the the keyvalue stores: */ accountsMap = accountsDB.hashMap("map").keySerializer(Serializer.BYTE_ARRAY).valueSerializer(Serializer.BYTE_ARRAY).createOrOpen(); blocksMap = blocksDB.hashMap("map").keySerializer(Serializer.BYTE_ARRAY).valueSerializer(Serializer.BYTE_ARRAY).createOrOpen(); transactionsMap = transactionsDB.hashMap("map").keySerializer(Serializer.BYTE_ARRAY).valueSerializer(Serializer.BYTE_ARRAY).createOrOpen(); contractCodeMap = contractCodeDB.hashMap("map").keySerializer(Serializer.BYTE_ARRAY).valueSerializer(Serializer.BYTE_ARRAY).createOrOpen(); contractStatesMap = contractStatesDB.hashMap("map").keySerializer(Serializer.BYTE_ARRAY).valueSerializer(Serializer.BYTE_ARRAY).createOrOpen(); //testing }
/** * Constructs a new {@code MapDbBackendIndices} wrapping the provided {@code database}. * * @param database the {@link org.mapdb.DB} used to creates the used {@link org.mapdb.HTreeMap}s and manage the * database * * @see MapDbBackendFactory */ @SuppressWarnings("unchecked") protected MapDbBackendIndices(DB database) { super(database); manyFeatures = database.hashMap("features/many") .keySerializer(new SerializerDecorator<>(SERIALIZER_FACTORY.forManyFeature())) .valueSerializer(Serializer.ELSA) .createOrOpen(); }
public static ConcurrentMap setup() { DB db = DBMaker.fileDB("test.db").fileMmapEnable().fileMmapPreclearDisable() .allocateStartSize(124 * 1024 * 1024).allocateIncrement(5 * 1024 * 1024).make(); ConcurrentMap<?, ?> dictionaryUpdates = db.hashMap("test").createOrOpen(); return dictionaryUpdates; }
public MapDBImpl(long maxSize) { super(maxSize); db = DBMaker.heapDB() .make(); map = db.hashMap("rxcache",Serializer.STRING,Serializer.JAVA) .expireMaxSize(maxSize) .expireAfterCreate() .expireAfterUpdate() .expireAfterGet() .counterEnable() .create(); }
public MapDBImpl(long maxSize, MapDBCacheConfig cacheConfig) { super(maxSize); db = DBMaker.heapDB() .make(); map = db.hashMap("rxcache",Serializer.STRING,Serializer.JAVA) .expireMaxSize(maxSize) .expireAfterCreate(cacheConfig.expireDuration,cacheConfig.expireTimeUnit) .expireAfterUpdate(cacheConfig.expireDuration,cacheConfig.expireTimeUnit) .expireAfterGet(cacheConfig.expireAfterGetDuration,cacheConfig.expireAfterGetTimeUnit) .counterEnable() .create(); }
@Override public Map<Integer, SubscriberState> createMap() { if (storageFile == null) { //In-Memory Stats Storage db = DBMaker.memoryDB().make(); } else { db = DBMaker.fileDB(storageFile).closeOnJvmShutdown().transactionEnable() //Default to Write Ahead Log - lower performance, but has crash protection .make(); } statusStorageMap = db.hashMap("statusStorageMap").keySerializer(Serializer.INTEGER) .valueSerializer(new StatusStorageSerializer()).createOrOpen(); return statusStorageMap; }
@Override public Map<Integer, SubscriberState> createMap() { if (storageFile == null) { //In-Memory Stats Storage db = DBMaker.memoryDB().make(); } else { db = DBMaker.fileDB(storageFile).closeOnJvmShutdown().transactionEnable() //Default to Write Ahead Log - lower performance, but has crash protection .make(); } statusStorageMap = db.hashMap("statusStorageMap").keySerializer(Serializer.INTEGER) .valueSerializer(new StatusStorageSerializer()).createOrOpen(); return statusStorageMap; }
@Override public Map<Integer, SubscriberState> createMap() { if (storageFile == null) { //In-Memory Stats Storage db = DBMaker.memoryDB().make(); } else { db = DBMaker.fileDB(storageFile).closeOnJvmShutdown().transactionEnable() //Default to Write Ahead Log - lower performance, but has crash protection .make(); } statusStorageMap = db.hashMap("statusStorageMap").keySerializer(Serializer.INTEGER) .valueSerializer(new StatusStorageSerializer()).createOrOpen(); return statusStorageMap; }
/** * Create the storage map * * @return */ @Override public Map<Integer, Long> createUpdatedMap() { if (storageFile == null) { //In-Memory Stats Storage db = DBMaker.memoryDB().make(); } else { db = DBMaker.fileDB(storageFile).closeOnJvmShutdown().transactionEnable() //Default to Write Ahead Log - lower performance, but has crash protection .make(); } updated = db.hashMap("updated").keySerializer(Serializer.INTEGER).valueSerializer(Serializer.LONG) .createOrOpen(); return updated; }