org.mapdb / DBMaker / Maker


class Maker


<init> Maker(_storeType: StoreType?, _customVolume: Volume? = null, _volumeExist: Boolean? = null, file: String? = null)


allocateIncrement fun allocateIncrement(incrementSize: Long): Maker
allocateStartSize fun allocateStartSize(size: Long): Maker
assertFile fun assertFile(): Unit
checksumHeaderBypass fun checksumHeaderBypass(): Maker

MapDB detects unclean shutdown (and possible data corruption) by Header Checksum. This checksum becomes invalid if store was modified, but not closed correctly. In that case MapDB will throw an exception and will refuse to open the store.

checksumStoreEnable fun checksumStoreEnable(): Maker

Enables store wide checksum. Entire file is covered by 64bit checksum to catch possible data corruption. This could be slow, since entire file is traversed to calculate checksum on store open, commit and close.

cleanerHackEnable fun cleanerHackEnable(): Maker
closeOnJvmShutdown fun closeOnJvmShutdown(): Maker

Adds JVM shutdown hook and closes DB just before JVM;

closeOnJvmShutdownWeakReference fun closeOnJvmShutdownWeakReference(): Maker

Adds JVM shutdown hook and closes DB just before JVM. This is similar to closeOnJvmShutdown(), but DB is referenced with WeakReference from shutdown hook and can be GCed. That might prevent memory leaks under some conditions, but does not guarantee DB will be actually closed.

concurrencyDisable fun concurrencyDisable(): Maker

WARNING: this option is dangerous. With locks disabled multi-threaded access could cause data corruption and causes. MapDB does not have fail-fast iterator or any other means of protection

concurrencyScale fun concurrencyScale(segmentCount: Int): Maker

This value has to be power of two, so it is rounded up automatically.

deleteFilesAfterClose fun deleteFilesAfterClose(): Maker
executorEnable fun executorEnable(): Maker

Enables background executor

fileChannelEnable fun fileChannelEnable(): Maker

Enable FileChannel access. By default MapDB uses {@link}. whic is slower and more robust. but does not allow concurrent access (parallel read and writes). RAF is still thread-safe but has global lock. FileChannel does not have global lock, and is faster compared to RAF. However memory-mapped files are probably best choice.

fileDeleteAfterClose fun fileDeleteAfterClose(): Maker
fileDeleteAfterOpen fun fileDeleteAfterOpen(): Maker
fileLockDisable fun fileLockDisable(): Maker
fileLockWait fun fileLockWait(timeout: Long): Maker
fun fileLockWait(): Maker
fileMmapEnable fun fileMmapEnable(): Maker

You may experience {@code java.lang.OutOfMemoryError: Map failed} exception on 32bit JVM, if you enable this mode.

fileMmapEnableIfSupported fun fileMmapEnableIfSupported(): Maker

Enable Memory Mapped Files only if current JVM supports it (is 64bit).

fileMmapPreclearDisable fun fileMmapPreclearDisable(): Maker
make fun make(): DB
readOnly fun readOnly(): Maker

Open store in read-only mode. Any modification attempt will throw UnsupportedOperationException("Read-only")

transactionEnable fun transactionEnable(): Maker