Top Description Fields Constructors Methods
org.h2.mvstore.db

public final Class Store

extends Object
Class Inheritance
Imports
java.util.ArrayList, .BitSet, .HashMap, .List, .Map, java.util.concurrent.ConcurrentHashMap, org.h2.api.ErrorCode, org.h2.command.ddl.CreateTableData, org.h2.engine.Constants, .Database, .SessionLocal, org.h2.message.DbException, org.h2.mvstore.DataUtils, .FileStore, .MVStore, .MVStoreException, .MVStoreTool, org.h2.mvstore.tx.Transaction, .TransactionStore, org.h2.mvstore.type.MetaType, org.h2.store.InDoubtTransaction, org.h2.store.fs.FileUtils, org.h2.util.HasSQL, .StringUtils, .Utils, org.h2.value.TypeInfo, .Typed, .Value

A store with open tables.

Field Summary

Modifier and TypeField and Description
private final boolean
private final String
private final MVStore
mvStore

The store.

private long
private final ConcurrentHashMap<String, MVTable>
tableMap

The map of open tables.

private int
private final TransactionStore
transactionStore

The transaction store.

Constructor Summary

AccessConstructor and Description
public
Store(Database
the database
db
,
byte[]
for file encryption
key
)

Creates the store.

Method Summary

Modifier and TypeMethod and Description
public void
close(int
time (in milliseconds) allotted for store housekeeping activity, 0 means none, -1 means unlimited time (i.e.full compaction)
allowedCompactionTime
)

Close the store.

public void
closeImmediately()

Close the store, without persisting changes.

private static void
compact(String sourceFilename, FileStore<?> targetFileStore)

public void
compactFile(int
the maximum time in milliseconds to compact
maxCompactTime
)

Compact the database file, that is, compact blocks that have a low fill rate, and move chunks next to each other.

pack-priv DbException

Returns:

the database exception
convertMVStoreException
(MVStoreException
the illegal state exception
e
)

Convert a MVStoreException to the similar exception used for the table/sql layers.

public MVTable

Returns:

table created
createTable
(CreateTableData
CreateTableData
data
)

Create a table.

pack-priv static char[]

Returns:

password as char[].
decodePassword
(byte[]
password as byte[]
key
)

Convert password from byte[] to char[].

public void
flush()

Store all pending changes.

public ArrayList<InDoubtTransaction>
public static DbException

Returns:

the exception
getInvalidExpressionTypeException
(String
the name of the parameter
param
,
Typed
the expression
e
)

Gets a SQL exception meaning the type of expression is invalid or unknown.

public MVStore
public MVTable

Returns:

MVTable
getTable
(String
table name
tableName
)

Get MVTable by table name.

public TransactionStore
public synchronized String

Returns:

the map name
nextTemporaryMapName
()

Get the name of the next available temporary map.

public void
prepareCommit(SessionLocal
the session
session
,
String
the transaction name (may be null)
transactionName
)

Prepare a transaction.

public void
removeTable(MVTable
the table
table
)

Remove a table.

public void
removeTemporaryMaps(BitSet
the ids of the objects to keep
objectIds
)

Remove all temporary maps.

public void
setCacheSize(int
the maximum size in KB
kb
)

Set the maximum memory to be used by the cache.

public Map<String, Integer>

Returns:

the statistics
statisticsEnd
()

Stop collecting statistics.

public void
statisticsStart()

Start collecting statistics.

public void
sync()

Force the changes to disk.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

encryptedback to summary
private final boolean encrypted
fileNameback to summary
private final String fileName
mvStoreback to summary
private final MVStore mvStore

The store.

statisticsStartback to summary
private long statisticsStart
tableMapback to summary
private final ConcurrentHashMap<String, MVTable> tableMap

The map of open tables. Key: the map name, value: the table.

temporaryMapIdback to summary
private int temporaryMapId
transactionStoreback to summary
private final TransactionStore transactionStore

The transaction store.

Constructor Detail

Storeback to summary
public Store(Database db, byte[] key)

Creates the store.

Parameters
db:Database

the database

key:byte[]

for file encryption

Method Detail

closeback to summary
public void close(int allowedCompactionTime)

Close the store. Pending changes are persisted.

Parameters
allowedCompactionTime:int

time (in milliseconds) allotted for store housekeeping activity, 0 means none, -1 means unlimited time (i.e.full compaction)

closeImmediatelyback to summary
public void closeImmediately()

Close the store, without persisting changes.

compactback to summary
private static void compact(String sourceFilename, FileStore<?> targetFileStore)
compactFileback to summary
public void compactFile(int maxCompactTime)

Compact the database file, that is, compact blocks that have a low fill rate, and move chunks next to each other. This will typically shrink the database file. Changes are flushed to the file, and old chunks are overwritten.

Parameters
maxCompactTime:int

the maximum time in milliseconds to compact

Annotations
@SuppressWarnings:unused
convertMVStoreExceptionback to summary
pack-priv DbException convertMVStoreException(MVStoreException e)

Convert a MVStoreException to the similar exception used for the table/sql layers.

Parameters
e:MVStoreException

the illegal state exception

Returns:DbException

the database exception

createTableback to summary
public MVTable createTable(CreateTableData data)

Create a table.

Parameters
data:CreateTableData

CreateTableData

Returns:MVTable

table created

decodePasswordback to summary
pack-priv static char[] decodePassword(byte[] key)

Convert password from byte[] to char[].

Parameters
key:byte[]

password as byte[]

Returns:char[]

password as char[].

flushback to summary
public void flush()

Store all pending changes.

getInDoubtTransactionsback to summary
public ArrayList<InDoubtTransaction> getInDoubtTransactions()
getInvalidExpressionTypeExceptionback to summary
public static DbException getInvalidExpressionTypeException(String param, Typed e)

Gets a SQL exception meaning the type of expression is invalid or unknown.

Parameters
param:String

the name of the parameter

e:Typed

the expression

Returns:DbException

the exception

getMvStoreback to summary
public MVStore getMvStore()
getTableback to summary
public MVTable getTable(String tableName)

Get MVTable by table name.

Parameters
tableName:String

table name

Returns:MVTable

MVTable

getTransactionStoreback to summary
public TransactionStore getTransactionStore()
nextTemporaryMapNameback to summary
public synchronized String nextTemporaryMapName()

Get the name of the next available temporary map.

Returns:String

the map name

prepareCommitback to summary
public void prepareCommit(SessionLocal session, String transactionName)

Prepare a transaction.

Parameters
session:SessionLocal

the session

transactionName:String

the transaction name (may be null)

removeTableback to summary
public void removeTable(MVTable table)

Remove a table.

Parameters
table:MVTable

the table

removeTemporaryMapsback to summary
public void removeTemporaryMaps(BitSet objectIds)

Remove all temporary maps.

Parameters
objectIds:BitSet

the ids of the objects to keep

setCacheSizeback to summary
public void setCacheSize(int kb)

Set the maximum memory to be used by the cache.

Parameters
kb:int

the maximum size in KB

statisticsEndback to summary
public Map<String, Integer> statisticsEnd()

Stop collecting statistics.

Returns:Map<String, Integer>

the statistics

statisticsStartback to summary
public void statisticsStart()

Start collecting statistics.

syncback to summary
public void sync()

Force the changes to disk.