public class StoreHeap extends Store implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Queue<java.lang.Long> |
freeRecids
Queue of deleted recids, those are reused for new records
|
protected java.util.concurrent.atomic.AtomicLong |
maxRecid
Maximal returned recid, incremented if there are no free recids
|
protected static java.lang.Object |
NULL |
protected java.util.concurrent.ConcurrentNavigableMap<java.lang.Long,Fun.Tuple2> |
records
All commited records in store
|
protected java.util.concurrent.ConcurrentNavigableMap<java.lang.Long,Fun.Tuple2> |
rollback
All not-yet commited records in store
|
private static long |
serialVersionUID |
protected static Fun.Tuple2 |
TOMBSTONE |
checksum, CHECKSUM_FLAG_MASK, CHUNK_SIZE, CHUNK_SIZE_MOD_MASK, closeListeners, compress, COMPRESS_FLAG_MASK, encrypt, ENCRYPT_FLAG_MASK, encryptionXTEA, locks, LOG, LZF, newRecidLock, password, recycledDataOuts, serializerPojo, serializerPojoInitLock, structuralLockCATALOG_RECID, CHECK_RECORD, CLASS_INFO_RECID, LAST_RESERVED_RECID| Constructor and Description |
|---|
StoreHeap() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
calculateStatistics()
get some statistics about store.
|
boolean |
canRollback() |
void |
clearCache()
clears any underlying cache
|
void |
close()
Close store/cache.
|
void |
commit()
Makes all changes made since the previous commit/rollback permanent.
|
void |
compact() |
<A> boolean |
compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
Updates existing record in atomic (Compare And Swap) manner.
|
<A> void |
delete(long recid,
Serializer<A> serializer)
Remove existing record from store/cache
Recid must be a number returned by 'put' method.
|
<A> A |
get(long recid,
Serializer<A> serializer)
Get existing record.
|
long |
getCurrSize()
returns current size occupied by physical store (does not include index).
|
java.util.Iterator<java.lang.Long> |
getFreeRecids() |
long |
getFreeSize()
returns free size in physical store (does not include index).
|
long |
getMaxRecid() |
java.nio.ByteBuffer |
getRaw(long recid) |
long |
getSizeLimit()
returns maximal store size or `0` if there is no limit
|
boolean |
isClosed()
Checks whether Engine was closed.
|
boolean |
isReadOnly()
Check if you can write into this Engine.
|
long |
preallocate()
Preallocates recid for not yet created record.
|
void |
preallocate(long[] recids)
Preallocates recids 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.
|
<A> void |
update(long recid,
A value,
Serializer<A> serializer)
Update existing record with new value.
|
void |
updateRaw(long recid,
java.nio.ByteBuffer data) |
canSnapshot, closeListenerRegister, closeListenerUnregister, deserialize, expectedMasks, forDB, forEngine, getSerializerPojo, lockAllWrite, lockPos, newDataOut2, printStatistics, serialize, snapshot, unlockAllWriteprotected static final Fun.Tuple2 TOMBSTONE
protected static final java.lang.Object NULL
private static final long serialVersionUID
protected final java.util.concurrent.ConcurrentNavigableMap<java.lang.Long,Fun.Tuple2> records
protected final java.util.concurrent.ConcurrentNavigableMap<java.lang.Long,Fun.Tuple2> rollback
protected final java.util.Queue<java.lang.Long> freeRecids
protected final java.util.concurrent.atomic.AtomicLong maxRecid
public long preallocate()
Enginepreallocate in interface Enginepublic void preallocate(long[] recids)
Enginepreallocate in interface Enginerecids - array to put result intopublic <A> long put(A value,
Serializer<A> serializer)
Enginepublic <A> A get(long recid,
Serializer<A> serializer)
Enginepublic <A> void update(long recid,
A value,
Serializer<A> serializer)
Enginepublic <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 Enginerecid - (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 formpublic <A> void delete(long recid,
Serializer<A> serializer)
Enginepublic void close()
EngineNullPointerException
There is an configuration option DBMaker.closeOnJvmShutdown() which uses shutdown hook to automatically
close Engine when JVM shutdowns.public boolean isClosed()
Enginepublic void commit()
Enginepublic void rollback()
throws java.lang.UnsupportedOperationException
EngineUnsupportedOperationException.public boolean isReadOnly()
EngineisReadOnly in interface Enginepublic void clearCache()
EngineclearCache in interface Enginepublic boolean canRollback()
canRollback in interface Enginepublic long getMaxRecid()
getMaxRecid in class Storepublic java.util.Iterator<java.lang.Long> getFreeRecids()
getFreeRecids in class Storepublic void updateRaw(long recid,
java.nio.ByteBuffer data)
public long getSizeLimit()
StoregetSizeLimit in class Storepublic long getCurrSize()
StoregetCurrSize in class Storepublic long getFreeSize()
StoregetFreeSize in class Storepublic java.lang.String calculateStatistics()
StorecalculateStatistics in class Store