public static final class StoreDirect.Snapshot extends Engine.ReadOnly
Engine.CloseOnJVMShutdown, Engine.ReadOnly, Engine.ReadOnlyWrapper| Modifier and Type | Field and Description |
|---|---|
protected StoreDirect |
engine |
protected Store.LongLongMap[] |
oldRecids |
CLOSED_ENGINE, RECID_CLASS_CATALOG, RECID_FIRST, RECID_LAST_RESERVED, RECID_NAME_CATALOG, RECID_RECORD_CHECK| Constructor and Description |
|---|
StoreDirect.Snapshot(StoreDirect engine) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRollback() |
boolean |
canSnapshot() |
void |
clearCache()
clears any underlying cache
|
void |
close()
Close store/cache.
|
<A> A |
get(long recid,
Serializer<A> serializer)
Get existing record.
|
Engine |
getWrappedEngine()
if this is wrapper return underlying engine, or null
|
boolean |
isClosed()
Checks whether Engine was closed.
|
Engine |
snapshot()
Returns read-only snapshot of data in Engine.
|
commit, compact, compareAndSwap, delete, isReadOnly, preallocate, put, rollback, updateprotected StoreDirect engine
protected Store.LongLongMap[] oldRecids
public StoreDirect.Snapshot(StoreDirect engine)
public <A> A get(long recid,
Serializer<A> serializer)
EngineGet existing record.
Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it returns null or throws 'EndOfFileException'
recid - (record identifier) under which record was persistedserializer - used to deserialize record from binary formpublic void close()
EngineClose store/cache. This method must be called before JVM exits to flush all caches and prevent store corruption. Also it releases resources used by MapDB (disk, memory..).
Engine can no longer be used after this method was called. If Engine is used after closing, it may
throw any exception including NullPointerException
There is an configuration option DBMaker.Maker.closeOnJvmShutdown() which uses shutdown hook to automatically
close Engine when JVM shutdowns.
public boolean isClosed()
Enginepublic boolean canRollback()
public boolean canSnapshot()
public Engine snapshot() throws UnsupportedOperationException
EngineUnsupportedOperationException - if snapshots are not supported/enabledpublic Engine getWrappedEngine()
Enginepublic void clearCache()
EngineCopyright © 2015. All Rights Reserved.