|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.Store
org.mapdb.StoreDirect
org.mapdb.StoreWAL
public class StoreWAL
Write-Ahead-Log
| Field Summary | |
|---|---|
protected long[] |
indexVals
|
protected boolean[] |
indexValsModified
|
protected Volume |
log
|
protected static long |
LOG_MASK_OFFSET
|
protected static long |
LOG_SEAL
added to offset 8 into log file, indicates that log was synced and closed |
protected AtomicInteger |
logChecksum
|
protected long |
logSize
|
protected LongMap<byte[]> |
longStackPages
|
protected LongConcurrentHashMap<long[]> |
modified
|
protected static long[] |
PREALLOC
|
protected boolean |
replayPending
|
protected static long[] |
TOMBSTONE
|
static String |
TRANS_LOG_FILE_EXT
|
protected Volume.Factory |
volFac
|
protected static byte |
WAL_INDEX_LONG
|
protected static byte |
WAL_LONGSTACK_PAGE
|
protected static byte |
WAL_PHYS_ARRAY
|
protected static byte |
WAL_PHYS_ARRAY_ONE_LONG
|
protected static byte |
WAL_SEAL
last instruction in log file |
protected static byte |
WAL_SKIP_REST_OF_BLOCK
|
| Fields inherited from class org.mapdb.Store |
|---|
checksum, CHECKSUM_FLAG_MASK, CHUNK_SIZE, CHUNK_SIZE_MOD_MASK, compress, COMPRESS_FLAG_MASK, encrypt, ENCRYPT_FLAG_MASK, encryptionXTEA, locks, LOG, LZF, newRecidLock, password, recycledDataOuts, serializerPojo, serializerPojoInitLock, structuralLock |
| Fields inherited from interface org.mapdb.Engine |
|---|
CATALOG_RECID, CHECK_RECORD, CLASS_INFO_RECID, LAST_RESERVED_RECID |
| Constructor Summary | |
|---|---|
StoreWAL(Volume.Factory volFac)
|
|
StoreWAL(Volume.Factory volFac,
boolean readOnly,
boolean deleteFilesAfterClose,
int spaceReclaimMode,
boolean syncOnCommitDisabled,
long sizeLimit,
boolean checksum,
boolean compress,
byte[] password,
boolean disableLocks,
int sizeIncrement)
|
|
| Method Summary | ||
|---|---|---|
boolean |
canRollback()
|
|
protected void |
checkHeaders()
|
|
protected void |
checkLogRounding()
|
|
void |
close()
Close store/cache. |
|
void |
commit()
Makes all changes made since the previous commit/rollback permanent. |
|
protected void |
compactPostUnderLock()
subclasses put additional cleanup after compaction finishes here |
|
protected void |
compactPreUnderLock()
subclasses put additional checks before compaction starts here |
|
|
compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
Updates existing record in atomic (Compare And Swap) manner. |
|
|
delete(long recid,
Serializer<A> serializer)
Remove existing record from store/cache Recid must be a number returned by 'put' method. |
|
|
get(long recid,
Serializer<A> serializer)
Get existing record. |
|
protected
|
get2(long ioRecid,
Serializer<A> serializer)
|
|
protected long[] |
getLinkedRecordsFromLog(long ioRecid)
|
|
protected long |
indexHeaderChecksumUncommited()
|
|
protected long[] |
logAllocate(long[] physPos)
|
|
protected void |
logChecksumAdd(int cs)
|
|
protected boolean |
logDirty()
|
|
protected void |
logReset()
|
|
protected byte[] |
longStackGetPage(long offset)
|
|
protected static long |
longStackGetSixLong(byte[] page,
int pos)
|
|
protected void |
longStackPut(long ioList,
long offset,
boolean recursive)
|
|
protected static void |
longStackPutSixLong(byte[] page,
int pos,
long value)
|
|
protected long |
longStackTake(long ioList,
boolean recursive)
|
|
long |
preallocate()
Preallocates recid for not yet created record. |
|
void |
preallocate(long[] recids)
Preallocates recids for not yet created record. |
|
|
put(A value,
Serializer<A> serializer)
Insert new record. |
|
protected void |
reloadIndexFile()
|
|
protected void |
replayLogFile()
|
|
void |
rollback()
Undoes all changes made in the current transaction. |
|
|
update(long recid,
A value,
Serializer<A> serializer)
Update existing record with new value. |
|
protected boolean |
verifyLogFile()
|
|
protected void |
walIndexVal(long logPos,
long ioRecid,
long indexVal)
|
|
protected void |
walPhysArray(DataOutput2 out,
long[] physPos,
long[] logPos)
|
|
| Methods inherited from class org.mapdb.StoreDirect |
|---|
calculateStatistics, clearCache, compact, countLongStackItems, createStructure, freeIoRecidPut, freeIoRecidTake, freePhysPut, freePhysTake, getCurrSize, getFreeRecids, getFreeSize, getLinkedRecordsIndexVals, getMaxRecid, getRaw, getSizeLimit, indexHeaderChecksum, isClosed, isReadOnly, physAllocate, put2, roundTo16, size2ListIoRecid, update2, updateRaw |
| Methods inherited from class org.mapdb.Store |
|---|
canSnapshot, closeListenerRegister, closeListenerUnregister, deserialize, expectedMasks, forDB, forEngine, getSerializerPojo, lockAllWrite, lockPos, newDataOut2, printStatistics, serialize, snapshot, unlockAllWrite |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final long LOG_MASK_OFFSET
protected static final byte WAL_INDEX_LONG
protected static final byte WAL_LONGSTACK_PAGE
protected static final byte WAL_PHYS_ARRAY_ONE_LONG
protected static final byte WAL_PHYS_ARRAY
protected static final byte WAL_SKIP_REST_OF_BLOCK
protected static final byte WAL_SEAL
protected static final long LOG_SEAL
public static final String TRANS_LOG_FILE_EXT
protected static final long[] TOMBSTONE
protected static final long[] PREALLOC
protected final Volume.Factory volFac
protected Volume log
protected volatile long logSize
protected final LongConcurrentHashMap<long[]> modified
protected final LongMap<byte[]> longStackPages
protected final long[] indexVals
protected final boolean[] indexValsModified
protected boolean replayPending
protected final AtomicInteger logChecksum
| Constructor Detail |
|---|
public StoreWAL(Volume.Factory volFac)
public StoreWAL(Volume.Factory volFac,
boolean readOnly,
boolean deleteFilesAfterClose,
int spaceReclaimMode,
boolean syncOnCommitDisabled,
long sizeLimit,
boolean checksum,
boolean compress,
byte[] password,
boolean disableLocks,
int sizeIncrement)
| Method Detail |
|---|
protected void checkHeaders()
checkHeaders in class StoreDirectprotected void reloadIndexFile()
protected void logReset()
public long preallocate()
Engine
preallocate in interface Enginepreallocate in class StoreDirectpublic void preallocate(long[] recids)
Engine
preallocate in interface Enginepreallocate in class StoreDirectrecids - array to put result into
public <A> long put(A value,
Serializer<A> serializer)
Engine
put in interface Engineput in class StoreDirectvalue - records to be addedserializer - used to convert record into/from binary form
protected void walPhysArray(DataOutput2 out,
long[] physPos,
long[] logPos)
protected void walIndexVal(long logPos,
long ioRecid,
long indexVal)
protected long[] logAllocate(long[] physPos)
protected void checkLogRounding()
public <A> A get(long recid,
Serializer<A> serializer)
Engine
get in interface Engineget in class StoreDirectrecid - (record identifier) under which record was persistedserializer - used to deserialize record from binary form
protected <A> A get2(long ioRecid,
Serializer<A> serializer)
throws IOException
get2 in class StoreDirectIOException
public <A> void update(long recid,
A value,
Serializer<A> serializer)
Engine
update in interface Engineupdate in class StoreDirectrecid - (record identifier) under which record was persisted.value - new record value to be storedserializer - used to serialize record into binary form
public <A> boolean compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
EngineoldValue==expectedOldValue when old value is found in instance cacheoldValue using serializer and checking oldValue.equals(expectedOldValue)expectedOldValue using serializer and comparing binary array with already serialized oldValue
compareAndSwap in interface EnginecompareAndSwap in class StoreDirectrecid - (record identifier) under which record was persisted.expectedOldValue - old value to be compared with existing recordnewValue - to be written if values are matchingserializer - used to serialize record into binary form
public <A> void delete(long recid,
Serializer<A> serializer)
Engine
delete in interface Enginedelete in class StoreDirectrecid - (record identifier) under which was record persistedserializer - which may be used in some circumstances to deserialize and store old objectpublic void commit()
Engine
commit in interface Enginecommit in class StoreDirectprotected boolean logDirty()
protected long indexHeaderChecksumUncommited()
protected boolean verifyLogFile()
protected void replayLogFile()
public void rollback()
throws UnsupportedOperationException
EngineUnsupportedOperationException.
rollback in interface Enginerollback in class StoreDirectUnsupportedOperationException - if transactions are disabledprotected long[] getLinkedRecordsFromLog(long ioRecid)
protected long longStackTake(long ioList,
boolean recursive)
longStackTake in class StoreDirect
protected void longStackPut(long ioList,
long offset,
boolean recursive)
longStackPut in class StoreDirect
protected static long longStackGetSixLong(byte[] page,
int pos)
protected static void longStackPutSixLong(byte[] page,
int pos,
long value)
protected byte[] longStackGetPage(long offset)
public void close()
EngineNullPointerException
There is an configuration option DBMaker.closeOnJvmShutdown() which uses shutdown hook to automatically
close Engine when JVM shutdowns.
close in interface Engineclose in class StoreDirectprotected void compactPreUnderLock()
StoreDirect
compactPreUnderLock in class StoreDirectprotected void compactPostUnderLock()
StoreDirect
compactPostUnderLock in class StoreDirectpublic boolean canRollback()
canRollback in interface EnginecanRollback in class StoreDirectprotected void logChecksumAdd(int cs)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||