public class StoreCached extends StoreDirect
StoreDirect with Write CacheStoreDirect.SnapshotStore.Cache, Store.LongList, Store.LongLongMap, Store.LongObjectMap<V>, Store.LongObjectObjectMap<V1,V2>, Store.LongQueue, Store.MemoryBarrierLessLock, Store.ReadWriteSingleLockEngine.CloseOnJVMShutdown, Engine.ReadOnly, Engine.ReadOnlyWrapper| Modifier and Type | Field and Description |
|---|---|
protected boolean |
flushInThread |
protected static byte[] |
LONG_STACK_PAGE_TOMBSTONE |
protected static Object |
TOMBSTONE2 |
protected Store.LongObjectMap<byte[]> |
uncommittedStackPages
stores modified stack pages.
|
protected Store.LongObjectObjectMap[] |
writeCache |
protected int |
writeQueueSize |
protected int |
writeQueueSizePerSegment |
EMPTY_LONGS, executor, FREE_RECID_STACK, freeSize, HEAD_END, HEADER, headVol, INDEX_VAL_SIZE, indexPages, INITCRC_INDEX_PAGE, LAST_PHYS_ALLOCATED_DATA_OFFSET, LONG_STACK_MAX_SIZE, LONG_STACK_MIN_SIZE, LONG_STACK_PREF_SIZE, MARCHIVE, MAX_REC_SIZE, MAX_RECID_OFFSET, MLINKED, MOFFSET, MPARITY, MUNUSED, PAGE_MASK, PAGE_MASK_INVERSE, PAGE_SIZE, recidReuseDisable, sizeIncrement, sliceShift, SLOTS_COUNT, snapshots, startSize, STORE_SIZE, STORE_VERSION, UNUSED1, UNUSED2, UNUSED3, UNUSED4, UNUSED5, volcaches, checksum, closed, commitLock, compress, deserializeExtra, encrypt, encryptionXTEA, FEAT_COMP_LZF, FEAT_CRC, FEAT_ENC_XTEA, fileLockDisable, fileLockHeartbeat, fileName, HEAD_CHECKSUM, HEAD_FEATURES, LOCKING_STRATEGY_NOLOCK, LOCKING_STRATEGY_READWRITELOCK, LOCKING_STRATEGY_WRITELOCK, lockMask, locks, lockScale, LOG, LZF, metricsDataRead, metricsDataWrite, metricsRecordRead, metricsRecordWrite, NOLOCK, readonly, recycledDataOut, snapshotEnable, structuralLock, volumeFactoryCLOSED_ENGINE, RECID_CLASS_CATALOG, RECID_FIRST, RECID_LAST_RESERVED, RECID_NAME_CATALOG, RECID_RECORD_CHECK| Constructor and Description |
|---|
StoreCached(String fileName) |
StoreCached(String fileName,
Volume.VolumeFactory volumeFactory,
Store.Cache cache,
int lockScale,
int lockingStrategy,
boolean checksum,
boolean compress,
byte[] password,
boolean readonly,
boolean snapshotEnable,
boolean fileLockDisable,
DataIO.HeartbeatFileLock fileLockHeartbeat,
ScheduledExecutorService executor,
long startSize,
long sizeIncrement,
boolean recidReuseDisable,
long executorScheduledRate,
int writeQueueSize) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertLongStackPage(long offset,
byte[] val) |
protected void |
assertNoOverlaps(Store.LongObjectMap<byte[]> pages) |
<A> boolean |
compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
Updates existing record in atomic (Compare And Swap) manner.
|
protected <A> void |
delete2(long recid,
Serializer<A> serializer) |
protected void |
flush() |
protected void |
flushWriteCache() |
protected void |
flushWriteCacheSegment(int segment) |
protected <A> A |
get2(long recid,
Serializer<A> serializer) |
protected void |
initHeadVol() |
protected byte[] |
loadLongStackPage(long pageOffset,
boolean willBeModified) |
protected long |
longStackCount(long masterLinkOffset) |
protected void |
longStackNewPage(long masterLinkOffset,
long prevPageOffset,
long value,
boolean recursive) |
protected void |
longStackPut(long masterLinkOffset,
long value,
boolean recursive) |
protected long |
longStackTake(long masterLinkOffset,
boolean recursive) |
<A> long |
put(A value,
Serializer<A> serializer)
Insert new record.
|
<A> void |
update(long recid,
A value,
Serializer<A> serializer)
Update existing record with new value.
|
backup, backupRestore, canRollback, clearCache, close, closeFilesIgnoreException, commit, compact, compactIndexPage, compactIndexPages, compactOldFilesExists, composeIndexVal, fileLoad, freeDataPut, freeDataPut, freeDataTake, freeDataTakeSingle, freeRecidTake, freeSizeIncrement, getCurrSize, getFreeSize, getFromOffset, headChecksum, indexLongPut, indexValGet, indexValGetRaw, indexValPut, init, initCreate, initFailedCloseFiles, initOpen, lastAllocatedDataGet, lastAllocatedDataSet, longStackMasterLinkOffset, maxRecidGet, maxRecidSet, offsetsGet, offsetsTotalSize, offsetsVerify, pageAllocate, pageIndexEnsurePageForRecidAllocated, pageIndexExtend, preallocate, putData, putDataSingleWithLink, putDataSingleWithoutLink, recidToOffset, recidTooLarge, rollback, round16Up, snapshot, snapshotCloseAllOnCompact, storeSizeGet, storeSizeSet, update2assertReadLocked, assertWriteLocked, canSnapshot, checkFeaturesBitmap, delete, deserialize, forDB, forEngine, get, getWrappedEngine, isClosed, isReadOnly, lockPos, longParityGet, longParitySet, makeFeaturesBitmap, metricsCollect, newDataOut2, serializeprotected static final byte[] LONG_STACK_PAGE_TOMBSTONE
protected final Store.LongObjectMap<byte[]> uncommittedStackPages
protected final Store.LongObjectObjectMap[] writeCache
protected static final Object TOMBSTONE2
protected final int writeQueueSize
protected final int writeQueueSizePerSegment
protected final boolean flushInThread
public StoreCached(String fileName, Volume.VolumeFactory volumeFactory, Store.Cache cache, int lockScale, int lockingStrategy, boolean checksum, boolean compress, byte[] password, boolean readonly, boolean snapshotEnable, boolean fileLockDisable, DataIO.HeartbeatFileLock fileLockHeartbeat, ScheduledExecutorService executor, long startSize, long sizeIncrement, boolean recidReuseDisable, long executorScheduledRate, int writeQueueSize)
public StoreCached(String fileName)
protected void initHeadVol()
initHeadVol in class StoreDirectprotected void longStackPut(long masterLinkOffset,
long value,
boolean recursive)
longStackPut in class StoreDirectprotected long longStackTake(long masterLinkOffset,
boolean recursive)
longStackTake in class StoreDirectprotected byte[] loadLongStackPage(long pageOffset,
boolean willBeModified)
protected long longStackCount(long masterLinkOffset)
longStackCount in class StoreDirectprotected void longStackNewPage(long masterLinkOffset,
long prevPageOffset,
long value,
boolean recursive)
longStackNewPage in class StoreDirectprotected void flush()
flush in class StoreDirectprotected void assertLongStackPage(long offset,
byte[] val)
protected void assertNoOverlaps(Store.LongObjectMap<byte[]> pages)
protected void flushWriteCache()
protected void flushWriteCacheSegment(int segment)
protected <A> A get2(long recid,
Serializer<A> serializer)
get2 in class StoreDirectprotected <A> void delete2(long recid,
Serializer<A> serializer)
delete2 in class StoreDirectpublic <A> long put(A value,
Serializer<A> serializer)
Engineput in interface Engineput in class StoreDirectvalue - records to be addedserializer - used to convert record into/from binary formpublic <A> void update(long recid,
A value,
Serializer<A> serializer)
EngineUpdate existing record with new value.
Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it throws 'EndOfFileException', but it may also corrupt store.
public <A> boolean compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
EngineUpdates existing record in atomic (Compare And Swap) manner. Value is modified only if old value matches expected value. There are three ways to match values, MapDB may use any of them:
oldValue==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
Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it throws 'EndOfFileException', but it may also corrupt store.
compareAndSwap in interface EnginecompareAndSwap in class Storerecid - (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 formCopyright © 2015. All Rights Reserved.