Class DBMaker
- java.lang.Object
-
- org.mapdb.DBMaker
-
public final class DBMaker extends java.lang.ObjectA builder class to creare and open new database and individual collections. It has several static factory methods. Method names depends on type of storage it opens.
DBMakeris typically used this wayDB db = DBMaker .memoryDB() //static method .transactionDisable() //configuration option .make() //opens db
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classDBMaker.Maker
-
Constructor Summary
Constructors Constructor and Description DBMaker()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description static DBMaker.MakerappendFileDB(java.io.File file)Creates or open append-only database stored in file.static DBMaker.MakerarchiveFileDB(java.io.File file)static java.util.Map<java.lang.String,java.lang.Object>CC()Returns Compiler Config, static settings MapDB was compiled withstatic DBMaker.MakerfileDB(java.io.File file)Creates or open database stored in file.static DB.HTreeMapMakerhashMapSegmented(DBMaker.Maker maker)static DB.HTreeMapMakerhashMapSegmentedMemory()static DB.HTreeMapMakerhashMapSegmentedMemoryDirect()static DBMaker.MakerheapDB()Creates new in-memory database which stores all data on heap without serialization.static DBMaker.MakermemoryDB()Creates new in-memory database.static DBMaker.MakermemoryDirectDB()Creates new in-memory database.static DBMaker.MakermemoryUnsafeDB()Creates new in-memory database.static DBMaker.MakernewAppendFileDB(java.io.File file)Deprecated.method renamed, prefix removed, useappendFileDB(File)static <K,V> HTreeMap<K,V>newCache(double size)Deprecated.TODO this method is going to be replaced by somethingstatic <K,V> HTreeMap<K,V>newCacheDirect(double size)Deprecated.TODO this method is going to be replaced by somethingstatic DBMaker.MakernewFileDB(java.io.File file)Deprecated.method renamed, prefix removed, usefileDB(File)static DBMaker.MakernewHeapDB()Deprecated.method renamed, prefix removed, useheapDB()static DBMaker.MakernewMemoryDB()Deprecated.method renamed, prefix removed, usememoryDB()static DBMaker.MakernewMemoryDirectDB()Deprecated.method renamed, prefix removed, usememoryDirectDB()static DBMaker.MakernewMemoryUnsafeDB()Deprecated.method renamed, prefix removed, usememoryUnsafeDB()static DBMaker.MakernewTempFileDB()Deprecated.method renamed, prefix removed, usetempFileDB()static <K,V> HTreeMap<K,V>newTempHashMap()Deprecated.method renamed, prefix removed, usetempHashMap()static <K> java.util.Set<K>newTempHashSet()Deprecated.method renamed, prefix removed, usetempHashSet()static <K,V> BTreeMap<K,V>newTempTreeMap()Deprecated.method renamed, prefix removed, usetempTreeMap()static <K> java.util.NavigableSet<K>newTempTreeSet()Deprecated.method renamed, prefix removed, usetempTreeSet()static DBMaker.MakertempFileDB()Creates new database in temporary folder.static <K,V> HTreeMap<K,V>tempHashMap()Create new HTreeMap backed by temporary file storage.static <K> java.util.Set<K>tempHashSet()Create new HashSet backed by temporary file storage.static <K,V> BTreeMap<K,V>tempTreeMap()Create new BTreeMap backed by temporary file storage.static <K> java.util.NavigableSet<K>tempTreeSet()Create new TreeSet backed by temporary file storage.
-
-
-
Method Detail
-
heapDB
public static DBMaker.Maker heapDB()
Creates new in-memory database which stores all data on heap without serialization. This mode should be very fast, but data will affect Garbage Collector the same way as traditional Java Collections.
-
newHeapDB
public static DBMaker.Maker newHeapDB()
Deprecated. method renamed, prefix removed, useheapDB()
-
memoryDB
public static DBMaker.Maker memoryDB()
Creates new in-memory database. Changes are lost after JVM exits. This option serializes data intobyte[], so they are not affected by Garbage Collector.
-
newMemoryDB
public static DBMaker.Maker newMemoryDB()
Deprecated. method renamed, prefix removed, usememoryDB()
-
memoryDirectDB
public static DBMaker.Maker memoryDirectDB()
Creates new in-memory database. Changes are lost after JVM exits.
This will use
DirectByteBufferoutside of HEAP, so Garbage Collector is not affected You should increase ammount of direct memory with-XX:MaxDirectMemorySize=10GJVM param
-
newMemoryDirectDB
public static DBMaker.Maker newMemoryDirectDB()
Deprecated. method renamed, prefix removed, usememoryDirectDB()
-
memoryUnsafeDB
public static DBMaker.Maker memoryUnsafeDB()
Creates new in-memory database. Changes are lost after JVM exits.
This will use
sun.misc.Unsafe. It uses direct-memory access and avoids boundary checking. It is bit faster compared toDirectByteBuffer, but can cause JVM crash in case of error.If
sun.misc.Unsafeis not available for some reason, MapDB will log an warning and fallback intoDirectByteBufferbased in-memory store without throwing an exception.
-
newMemoryUnsafeDB
public static DBMaker.Maker newMemoryUnsafeDB()
Deprecated. method renamed, prefix removed, usememoryUnsafeDB()
-
appendFileDB
public static DBMaker.Maker appendFileDB(java.io.File file)
Creates or open append-only database stored in file. This database uses format other than usual file db- Parameters:
file-- Returns:
- maker
-
archiveFileDB
public static DBMaker.Maker archiveFileDB(java.io.File file)
-
newAppendFileDB
public static DBMaker.Maker newAppendFileDB(java.io.File file)
Deprecated. method renamed, prefix removed, useappendFileDB(File)
-
tempTreeMap
public static <K,V> BTreeMap<K,V> tempTreeMap()
Create new BTreeMap backed by temporary file storage. This is quick way to create 'throw away' collection.
Storage is created in temp folder and deleted on JVM shutdown
-
newTempTreeMap
public static <K,V> BTreeMap<K,V> newTempTreeMap()
Deprecated. method renamed, prefix removed, usetempTreeMap()
-
tempHashMap
public static <K,V> HTreeMap<K,V> tempHashMap()
Create new HTreeMap backed by temporary file storage. This is quick way to create 'throw away' collection.
Storage is created in temp folder and deleted on JVM shutdown
-
newTempHashMap
public static <K,V> HTreeMap<K,V> newTempHashMap()
Deprecated. method renamed, prefix removed, usetempHashMap()
-
tempTreeSet
public static <K> java.util.NavigableSet<K> tempTreeSet()
Create new TreeSet backed by temporary file storage. This is quick way to create 'throw away' collection.
Storage is created in temp folder and deleted on JVM shutdown
-
newTempTreeSet
public static <K> java.util.NavigableSet<K> newTempTreeSet()
Deprecated. method renamed, prefix removed, usetempTreeSet()
-
tempHashSet
public static <K> java.util.Set<K> tempHashSet()
Create new HashSet backed by temporary file storage. This is quick way to create 'throw away' collection.
Storage is created in temp folder and deleted on JVM shutdown
-
newTempHashSet
public static <K> java.util.Set<K> newTempHashSet()
Deprecated. method renamed, prefix removed, usetempHashSet()
-
tempFileDB
public static DBMaker.Maker tempFileDB()
Creates new database in temporary folder.
-
newTempFileDB
public static DBMaker.Maker newTempFileDB()
Deprecated. method renamed, prefix removed, usetempFileDB()
-
newCacheDirect
public static <K,V> HTreeMap<K,V> newCacheDirect(double size)
Deprecated. TODO this method is going to be replaced by somethingCreates new off-heap cache with maximal size in GBs. Entries are removed from cache in most-recently-used fashion if store becomes too big. This method uses off-heap direct ByteBuffers. SeeByteBuffer.allocateDirect(int)- Parameters:
size- maximal size of off-heap store in gigabytes.- Returns:
- map
-
newCache
public static <K,V> HTreeMap<K,V> newCache(double size)
Deprecated. TODO this method is going to be replaced by somethingCreates new cache with maximal size in GBs. Entries are removed from cache in most-recently-used fashion if store becomes too big. This cache uses on-heapbyte[], but does not affect GC since objects are serialized into binary form. This method uses ByteBuffers backed by on-heap byte[]. SeeByteBuffer.allocate(int)- Parameters:
size- maximal size of off-heap store in gigabytes.- Returns:
- map
-
fileDB
public static DBMaker.Maker fileDB(java.io.File file)
Creates or open database stored in file.
-
newFileDB
public static DBMaker.Maker newFileDB(java.io.File file)
Deprecated. method renamed, prefix removed, usefileDB(File)
-
hashMapSegmented
public static DB.HTreeMapMaker hashMapSegmented(DBMaker.Maker maker)
-
hashMapSegmentedMemory
public static DB.HTreeMapMaker hashMapSegmentedMemory()
-
hashMapSegmentedMemoryDirect
public static DB.HTreeMapMaker hashMapSegmentedMemoryDirect()
-
CC
public static java.util.Map<java.lang.String,java.lang.Object> CC() throws java.lang.IllegalAccessExceptionReturns Compiler Config, static settings MapDB was compiled with- Returns:
- Compiler Config
- Throws:
java.lang.IllegalAccessException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG