Search in sources :

Example 1 with VersionedValue

use of org.h2.mvstore.db.TransactionStore.VersionedValue in project h2database by h2database.

the class TransactionStore method openMap.

/**
 * Open the map with the given name.
 *
 * @param <K> the key type
 * @param name the map name
 * @param keyType the key type
 * @param valueType the value type
 * @return the map
 */
synchronized <K> MVMap<K, VersionedValue> openMap(String name, DataType keyType, DataType valueType) {
    if (keyType == null) {
        keyType = new ObjectDataType();
    }
    if (valueType == null) {
        valueType = new ObjectDataType();
    }
    VersionedValueType vt = new VersionedValueType(valueType);
    MVMap<K, VersionedValue> map;
    MVMap.Builder<K, VersionedValue> builder = new MVMap.Builder<K, VersionedValue>().keyType(keyType).valueType(vt);
    map = store.openMap(name, builder);
    @SuppressWarnings("unchecked") MVMap<Object, VersionedValue> m = (MVMap<Object, VersionedValue>) map;
    maps.put(map.getId(), m);
    return map;
}
Also used : MVMap(org.h2.mvstore.MVMap) ObjectDataType(org.h2.mvstore.type.ObjectDataType)

Aggregations

MVMap (org.h2.mvstore.MVMap)1 ObjectDataType (org.h2.mvstore.type.ObjectDataType)1