org.mapdb / DB

DB

open class DB : Closeable, ConcurrencyAware

A database with easy access to named maps and other collections.



Types

AtomicBooleanMaker class AtomicBooleanMaker : Maker<Boolean>
AtomicIntegerMaker class AtomicIntegerMaker : Maker<Integer>
AtomicLongMaker class AtomicLongMaker : Maker<Long>
AtomicStringMaker class AtomicStringMaker : Maker<String>
AtomicVarMaker class AtomicVarMaker<E> : Maker<Var<E>>
CatVal data class CatVal
HashMapMaker class HashMapMaker<K, V> : Maker<HTreeMap<K, V>>
HashSetMaker class HashSetMaker<E> : Maker<KeySet<E>>
IndexTreeListMaker class IndexTreeListMaker<E> : Maker<IndexTreeList<E>>
IndexTreeLongLongMapMaker class IndexTreeLongLongMapMaker : Maker<IndexTreeLongLongMap>
Keys object Keys
Maker abstract class Maker<E>
TreeMapMaker class TreeMapMaker<K, V> : Maker<BTreeMap<K, V>>
TreeMapSink abstract class TreeMapSink<K, V> : Sink<<ERROR CLASS><K, V>, BTreeMap<K, V>>
TreeSetMaker class TreeSetMaker<E> : Maker<NavigableSet<E>>

Constructors

<init> DB(store: Store, storeOpened: Boolean, isThreadSafe: Boolean = true, classLoader: ClassLoader = Thread.currentThread().contextClassLoader, shutdownHook: Int = 0)

A database with easy access to named maps and other collections.

Properties

classInfoSerializer val classInfoSerializer: Serializer<Array<<ERROR CLASS>>>
classLoader val classLoader: ClassLoader
defaultSerializer val defaultSerializer: GroupSerializerObjectArray<Any?>

Default serializer used if collection does not specify specialized serializer. It uses Elsa Serializer.

executors val executors: MutableSet<ExecutorService>

List of executors associated with this database. Those will be terminated on close()

isThreadSafe open val isThreadSafe: Boolean

returns true if this is configured to be thread safe

lock val lock: ReentrantReadWriteLock?
namesInstanciated var namesInstanciated: <ERROR CLASS><String, Any?>

Already loaded named collections. Values are weakly referenced. We need singletons for locking

shutdownHook val shutdownHook: Int

type of shutdown hook, 0 is disabled, 1 is hard ref, 2 is weak ref

storeOpened val storeOpened: Boolean

True if store existed before and was opened, false if store was created and is completely empty

Functions

atomicBoolean fun atomicBoolean(name: String): AtomicBooleanMaker
fun atomicBoolean(name: String, value: Boolean): AtomicBooleanMaker
atomicInteger fun atomicInteger(name: String): AtomicIntegerMaker
fun atomicInteger(name: String, value: Int): AtomicIntegerMaker
atomicLong fun atomicLong(name: String): AtomicLongMaker
fun atomicLong(name: String, value: Long): AtomicLongMaker
atomicString fun atomicString(name: String): AtomicStringMaker
fun atomicString(name: String, value: String?): AtomicStringMaker
atomicVar fun atomicVar(name: String): AtomicVarMaker<Any?>
fun <E> atomicVar(name: String, serializer: Serializer<E>): AtomicVarMaker<E>
fun <E> atomicVar(name: String, serializer: Serializer<E>, value: E?): AtomicVarMaker<E>
checkName fun checkName(name: String): Unit
checkNotClosed fun checkNotClosed(): Unit
checkThreadSafe open fun checkThreadSafe(): Unit

checks all subcomponents, if this component is really thread safe, and throws an exception if not thread safe

close open fun close(): Unit
commit fun commit(): Unit
defaultSerializerRegisterClass fun defaultSerializerRegisterClass(clazz: Class<*>): Unit

Register Class with default POJO serializer. Class structure will be stored in store, and will save space for collections which do not use specialized serializer.

exists fun exists(name: String): Boolean
get fun <E> get(name: String): E
getAll fun getAll(): Map<String, Any?>
getAllNames fun getAllNames(): Iterable<String>
getNameForObject fun getNameForObject(e: Any): String?
getStore fun getStore(): Store
hashMap fun hashMap(name: String): HashMapMaker<*, *>
fun <K, V> hashMap(name: String, keySerializer: Serializer<K>, valueSerializer: Serializer<V>): HashMapMaker<K, V>
hashSet fun hashSet(name: String): HashSetMaker<*>
fun <E> hashSet(name: String, serializer: Serializer<E>): HashSetMaker<E>
indexTreeList fun <E> indexTreeList(name: String, serializer: Serializer<E>): IndexTreeListMaker<E>
fun indexTreeList(name: String): IndexTreeListMaker<Any?>
isClosed fun isClosed(): Boolean
nameCatalogGet fun nameCatalogGet(name: String): String?
nameCatalogGetClass fun <E> nameCatalogGetClass(nameCatalog: SortedMap<String, String>, key: String): E?
nameCatalogLoad fun nameCatalogLoad(): SortedMap<String, String>
nameCatalogLoadLocked fun nameCatalogLoadLocked(): SortedMap<String, String>
nameCatalogParamsFor fun nameCatalogParamsFor(name: String): Map<String, String>
nameCatalogPutClass fun nameCatalogPutClass(nameCatalog: SortedMap<String, String>, key: String, obj: Any): Unit
nameCatalogSave fun nameCatalogSave(nameCatalog: SortedMap<String, String>): Unit
nameCatalogSaveLocked fun nameCatalogSaveLocked(nameCatalog: SortedMap<String, String>): Unit
nameCatalogVerifyGetMessages fun nameCatalogVerifyGetMessages(): Iterable<String>

verifies name catalog is valid (all parameters are known and have required values). If there are problems, it return list of messages

rollback fun rollback(): Unit
treeMap fun treeMap(name: String): TreeMapMaker<*, *>
fun <K, V> treeMap(name: String, keySerializer: GroupSerializer<K>, valueSerializer: GroupSerializer<V>): TreeMapMaker<K, V>
treeSet fun treeSet(name: String): TreeSetMaker<*>
fun <E> treeSet(name: String, serializer: GroupSerializer<E>): TreeSetMaker<E>

Companion Object Properties

NAMED_SERIALIZATION_HEADER val NAMED_SERIALIZATION_HEADER: Int
NAME_CATALOG_SERIALIZER val NAME_CATALOG_SERIALIZER: Serializer<SortedMap<String, String>>

Companion Object Functions

addShutdownHook fun addShutdownHook(ref: Any): Unit