Documentation of 'org.mapdb.DBMaker' Java class
DBMaker
org.mapdb

Class DBMaker



  • public final class DBMaker
    extends java.lang.Object

    A 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 way

      DB db = DBMaker
          .memoryDB()          //static method
          .transactionDisable()   //configuration option
          .make()                 //opens db
     
    • Constructor Detail

      • DBMaker

        public DBMaker()
    • 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, use heapDB()
      • memoryDB

        public static DBMaker.Maker memoryDB()
        Creates new in-memory database. Changes are lost after JVM exits. This option serializes data into byte[], so they are not affected by Garbage Collector.
      • newMemoryDB

        public static DBMaker.Maker newMemoryDB()
        Deprecated. method renamed, prefix removed, use memoryDB()
      • memoryDirectDB

        public static DBMaker.Maker memoryDirectDB()

        Creates new in-memory database. Changes are lost after JVM exits.

        This will use DirectByteBuffer outside of HEAP, so Garbage Collector is not affected You should increase ammount of direct memory with -XX:MaxDirectMemorySize=10G JVM param

      • 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 to DirectByteBuffer, but can cause JVM crash in case of error.

        If sun.misc.Unsafe is not available for some reason, MapDB will log an warning and fallback into DirectByteBuffer based in-memory store without throwing an exception.

      • 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)
      • 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, use tempTreeMap()
      • 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, use tempHashMap()
      • 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, use tempTreeSet()
      • 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, use tempHashSet()
      • tempFileDB

        public static DBMaker.Maker tempFileDB()
        Creates new database in temporary folder.
      • newCacheDirect

        public static <K,V> HTreeMap<K,V> newCacheDirect(double size)
        Deprecated. TODO this method is going to be replaced by something
        Creates 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. See ByteBuffer.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 something
        Creates 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-heap byte[], but does not affect GC since objects are serialized into binary form. This method uses ByteBuffers backed by on-heap byte[]. See ByteBuffer.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, use fileDB(File)
      • 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.IllegalAccessException
        Returns Compiler Config, static settings MapDB was compiled with
        Returns:
        Compiler Config
        Throws:
        java.lang.IllegalAccessException

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.