org.h2.mvstore
Class MVStoreBuilder

java.lang.Object
  extended by org.h2.mvstore.MVStoreBuilder

public class MVStoreBuilder
extends java.lang.Object

A builder for an MVStore.


Constructor Summary
MVStoreBuilder()
           
 
Method Summary
 MVStoreBuilder cacheSizeMB(int mb)
          Set the read cache size in MB.
static MVStoreBuilder fileBased(java.lang.String fileName)
          Use the following file name.
static MVStoreBuilder fromString(java.lang.String s)
          Read the configuration from a string.
static MVStoreBuilder inMemory()
          Open the store in-memory.
 MVStore open()
          Open the store.
 MVStoreBuilder readOnly()
          Open the file in read-only mode.
 java.lang.String toString()
           
 MVStoreBuilder with(DataTypeFactory factory)
          Use the given data type factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MVStoreBuilder

public MVStoreBuilder()
Method Detail

fileBased

public static MVStoreBuilder fileBased(java.lang.String fileName)
Use the following file name. If the file does not exist, it is automatically created.

Parameters:
fileName - the file name
Returns:
this

inMemory

public static MVStoreBuilder inMemory()
Open the store in-memory. In this case, no data may be saved.

Returns:
the store

readOnly

public MVStoreBuilder readOnly()
Open the file in read-only mode. In this case, a shared lock will be acquired to ensure the file is not concurrently opened in write mode.

If this option is not used, the file is locked exclusively.

Please note a store may only be opened once in every JVM (no matter whether it is opened in read-only or read-write mode), because each file may be locked only once in a process.

Returns:
this

cacheSizeMB

public MVStoreBuilder cacheSizeMB(int mb)
Set the read cache size in MB. The default is 16 MB.

Parameters:
mb - the cache size
Returns:
this

with

public MVStoreBuilder with(DataTypeFactory factory)
Use the given data type factory.

Parameters:
factory - the data type factory
Returns:
this

open

public MVStore open()
Open the store.

Returns:
the opened store

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

fromString

public static MVStoreBuilder fromString(java.lang.String s)
Read the configuration from a string.

Parameters:
s - the string representation
Returns:
the builder