org.mapdb

Package org.mapdb

Types

Atomic class Atomic

A small toolkit of classes that support lock-free thread-safe programming on single records. In essence, the classes here provide provide an atomic conditional update operation of the form:

 boolean compareAndSet(expectedValue, updateValue); 

This method (which varies in argument types across different classes) atomically sets a record to the updateValue if it currently holds the expectedValue, reporting true on success. Classes jere also contain methods to get and unconditionally set values.

The specifications of these methods enable to employ more efficient internal DB locking. CompareAndSwap operation is typically faster than using transactions, global lock or other concurrent protection.

Instances of classes Atomic.Boolean, Atomic.Integer, Atomic.Long, Atomic.String and Atomic.Var each provide access and updates to a single record of the corresponding type. Each class also provides appropriate utility methods for that type. For example, classes Atomic.Long and Atomic.Integer provide atomic increment methods. One application is to generate unique keys for Maps:

 Atomic.Long id = Atomic.getLong("mapId"); map.put(id.getAndIncrement(), "something"); 

Atomic classes are designed primarily as building blocks for implementing non-blocking data structures and related infrastructure classes. The compareAndSet method is not a general replacement for locking. It applies only when critical updates for an object are confined to a single record.

Atomic classes are not general purpose replacements for java.lang.Integer and related classes. They do not define methods such as hashCode and compareTo. (Because atomic records are expected to be mutated, they are poor choices for hash table keys.) Additionally, classes are provided only for those types that are commonly useful in intended applications. Other types has to be wrapped into general Atomic.Var

You can also hold floats using java.lang.Float#floatToIntBits and java.lang.Float#intBitsToFloat conversions, and doubles using java.lang.Double#doubleToLongBits and java.lang.Double#longBitsToDouble conversions.

BTreeMap class BTreeMap<K, V> : Verifiable, Closeable, Serializable, ConcurrencyAware, ConcurrentNavigableMap<K, V>, ConcurrentNavigableMapExtra<K, V>

A scalable concurrent {@link ConcurrentNavigableMap} implementation. The map is sorted according to the {@linkplain Comparable natural ordering} of its keys, or by a {@link Comparator} provided at map creation time.

BTreeMapJava open class BTreeMapJava

Java code for BTreeMap. Mostly performance sensitive code.

CC interface CC

Compilation Configuration. Uses dead code elimination to remove `if(CONSTANT){code}` blocks

ConcurrencyAware interface ConcurrencyAware

Concurrency aware, can verify that its configuration is thread safe

ConcurrentNavigableMapExtra interface ConcurrentNavigableMapExtra<K, V> : ConcurrentNavigableMap<K, V>, MapExtra<K, V>, ConcurrentNavigableMap2<K, V>
DB open class DB : Closeable, ConcurrencyAware

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

DBMaker object DBMaker
DataIO class DataIO

Various IO classes and utilities..

DataInput2 abstract class DataInput2 : DataInput

Used for serialization

DataOutput2 open class DataOutput2 : OutputStream, DataOutput

Output of serialization

HTreeMap class HTreeMap<K, V> : ConcurrentMap<K, V>, ConcurrencyAware, MapExtra<K, V>, Verifiable, Closeable

Concurrent HashMap which uses IndexTree for hash table

IndexTreeList class IndexTreeList<E> : AbstractList<E?>

ArrayList like structure backed by tree

IndexTreeLongLongMap class IndexTreeLongLongMap

Primitive Sorted Map<Long,Long.

MapExtra interface MapExtra<K, V> : ConcurrentMap<K, V>

Extra methods for Map interface

MapModificationListener interface MapModificationListener<K : Any, V : Any>

Callback interface for MapExtra modification notifications.

Pump object Pump

Data streaming

QueueLong class QueueLong : Verifiable

FIFO Queue with option to remove element from middle

QueueLongTakeUntil interface QueueLongTakeUntil

Callback interface for QueueLong

Serializer interface Serializer<A : Any> : Comparator<A>

This interface specifies how Java Objects are serialized and de-serialized and also how objects are compared, hashed and tested for equality for use with MapDB.

Implementing classes do not have to be thread safe.

SortedTableMap class SortedTableMap<K, V> : ConcurrentMap<K, V>, ConcurrentNavigableMap<K, V>, ConcurrentNavigableMapExtra<K, V>

Read only Sorted Table Map. It stores data in table and uses binary search to find records

Store interface Store : StoreImmutable, Verifiable, ConcurrencyAware

Stores records, mutable version

StoreBinary interface StoreBinary : Store
StoreBinaryGetLong interface StoreBinaryGetLong

Binary operations performed on StoreBinary which retuns long

StoreDirect class StoreDirect : StoreDirectAbstract, StoreBinary

Store which uses binary storage (file, memory buffer...) and updates records on place. It has memory allocator, so it reuses space freed by deletes and updates.

StoreDirectAbstract abstract class StoreDirectAbstract : Store

Common utils for StoreDirect, StoreWAL and StoreCached

StoreImmutable interface StoreImmutable

Stores records

StoreOnHeap class StoreOnHeap : Store

Store which does not use serialization, but puts everything into on-heap Map.

StoreReadOnlyWrapper class StoreReadOnlyWrapper : Store

Wraps Store and throws UnsupportedOperationException("Read-only") on operations which would modify it

StoreTrivial open class StoreTrivial : Store

Store which serializes its content into primitive Map<Long,byte[]>. It optionally persist its content into file, in this case it supports rollback and durability.

StoreTrivialTx class StoreTrivialTx : StoreTrivial, StoreTx
StoreTx interface StoreTx : Store

Stores records, transactional version

StoreWAL class StoreWAL : StoreDirectAbstract, StoreTx

StoreDirect with write ahead log

Verifiable interface Verifiable

Class can verify its status and data integrity: collections, Stores...

WriteAheadLog open class WriteAheadLog

WAL shared between StoreWAL

Exceptions

DBException open class DBException : RuntimeException

Exception hierarchy for MapDB