public class StoreAppend extends Store
Store.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 ScheduledExecutorService |
compactionExecutor |
protected static int |
HEADER
4 byte file header
|
protected static long |
headerSize |
protected Volume |
headVol |
protected AtomicLong |
highestRecid |
protected Volume |
indexTable
In memory table which maps recids into their offsets.
|
protected boolean |
isSnapshot |
protected Store.LongLongMap[] |
modified |
protected long |
sizeIncrement |
protected int |
sliceShift |
protected Set<StoreAppend> |
snapshots |
protected long |
startSize |
protected static StoreAppend[] |
STORE_APPENDS_ZERO_ARRAY |
protected static int |
STORE_VERSION
2 byte store version
|
protected boolean |
tx |
protected WriteAheadLog |
wal |
caches, 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| Modifier | Constructor and Description |
|---|---|
protected |
StoreAppend(StoreAppend host,
Store.LongLongMap[] uncommitedData)
protected constructor used to take snapshots
|
|
StoreAppend(String fileName) |
protected |
StoreAppend(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,
boolean txDisabled,
ScheduledExecutorService compactionExecutor,
long startSize,
long sizeIncrement) |
| Modifier and Type | Method and Description |
|---|---|
void |
backup(OutputStream out,
boolean incremental) |
void |
backupRestore(InputStream[] in) |
boolean |
canRollback() |
boolean |
canSnapshot() |
void |
close()
Close store/cache.
|
void |
commit()
Makes all changes made since the previous commit/rollback permanent.
|
void |
compact() |
protected <A> void |
delete2(long recid,
Serializer<A> serializer) |
boolean |
fileLoad()
If underlying storage is memory-mapped-file, this method will try to
load and precache all file data into disk cache.
|
protected <A> A |
get2(long recid,
Serializer<A> serializer) |
long |
getCurrSize() |
long |
getFreeSize() |
protected void |
indexTablePut(long recid,
long walId) |
void |
init() |
protected void |
initCreate() |
protected void |
initOpen() |
long |
preallocate()
Preallocates recid for not yet created record.
|
<A> long |
put(A value,
Serializer<A> serializer)
Insert new record.
|
void |
rollback()
Undoes all changes made in the current transaction.
|
Engine |
snapshot()
Returns read-only snapshot of data in Engine.
|
protected void |
update2(long recid,
DataIO.DataOutputByteArray out) |
assertReadLocked, assertWriteLocked, checkFeaturesBitmap, clearCache, compareAndSwap, delete, deserialize, forDB, forEngine, get, getWrappedEngine, isClosed, isReadOnly, lockPos, longParityGet, longParitySet, makeFeaturesBitmap, metricsCollect, newDataOut2, serialize, updateprotected static final int STORE_VERSION
protected static final int HEADER
protected static final long headerSize
protected static final StoreAppend[] STORE_APPENDS_ZERO_ARRAY
protected WriteAheadLog wal
protected Volume headVol
protected Volume indexTable
-1 - records was deleted, return null
-2 - record has zero size
-3 - null record, return null
protected final AtomicLong highestRecid
protected final boolean tx
protected final Store.LongLongMap[] modified
protected final ScheduledExecutorService compactionExecutor
protected final Set<StoreAppend> snapshots
protected final boolean isSnapshot
protected final long startSize
protected final long sizeIncrement
protected final int sliceShift
protected StoreAppend(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, boolean txDisabled, ScheduledExecutorService compactionExecutor, long startSize, long sizeIncrement)
public StoreAppend(String fileName)
protected StoreAppend(StoreAppend host, Store.LongLongMap[] uncommitedData)
protected void initCreate()
protected void initOpen()
protected <A> A get2(long recid,
Serializer<A> serializer)
protected void update2(long recid,
DataIO.DataOutputByteArray out)
protected <A> void delete2(long recid,
Serializer<A> serializer)
public long getCurrSize()
getCurrSize in class Storepublic long getFreeSize()
getFreeSize in class Storepublic boolean fileLoad()
Store
If underlying storage is memory-mapped-file, this method will try to
load and precache all file data into disk cache.
Most likely it will call MappedByteBuffer.load(),
but could also read content of entire file etc
This method will not pin data into memory, they might be removed at any time.
public long preallocate()
Engineprotected void indexTablePut(long recid,
long walId)
public <A> long put(A value,
Serializer<A> serializer)
Enginevalue - records to be addedserializer - used to convert record into/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 void commit()
Enginepublic void rollback()
throws UnsupportedOperationException
EngineUnsupportedOperationException.UnsupportedOperationException - if transactions are disabledpublic boolean canRollback()
public boolean canSnapshot()
canSnapshot in interface EnginecanSnapshot in class Storepublic Engine snapshot() throws UnsupportedOperationException
EngineUnsupportedOperationException - if snapshots are not supported/enabledpublic void compact()
public void backup(OutputStream out, boolean incremental)
public void backupRestore(InputStream[] in)
backupRestore in class StoreCopyright © 2015. All Rights Reserved.