|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.Store
org.mapdb.StoreHeap
public class StoreHeap
Store which keeps all instances on heap. It does not use serialization.
| Field Summary | |
|---|---|
protected Queue<Long> |
freeRecids
Queue of deleted recids, those are reused for new records |
protected AtomicLong |
maxRecid
Maximal returned recid, incremented if there are no free recids |
protected static Object |
NULL
|
protected ConcurrentNavigableMap<Long,Fun.Tuple2> |
records
All commited records in store |
protected ConcurrentNavigableMap<Long,Fun.Tuple2> |
rollback
All not-yet commited records in store |
protected static Fun.Tuple2 |
TOMBSTONE
|
| 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 | |
|---|---|
StoreHeap()
|
|
| Method Summary | ||
|---|---|---|
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()
|
|
|
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. |
|
long |
getCurrSize()
returns current size occupied by physical store (does not include index). |
|
Iterator<Long> |
getFreeRecids()
|
|
long |
getFreeSize()
returns free size in physical store (does not include index). |
|
long |
getMaxRecid()
|
|
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. |
|
|
put(A value,
Serializer<A> serializer)
Insert new record. |
|
void |
rollback()
Undoes all changes made in the current transaction. |
|
|
update(long recid,
A value,
Serializer<A> serializer)
Update existing record with new value. |
|
void |
updateRaw(long recid,
ByteBuffer data)
|
|
| 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 Fun.Tuple2 TOMBSTONE
protected static final Object NULL
protected final ConcurrentNavigableMap<Long,Fun.Tuple2> records
protected final ConcurrentNavigableMap<Long,Fun.Tuple2> rollback
protected final Queue<Long> freeRecids
protected final AtomicLong maxRecid
| Constructor Detail |
|---|
public StoreHeap()
| Method Detail |
|---|
public long preallocate()
Engine
preallocate in interface Enginepublic void preallocate(long[] recids)
Engine
preallocate in interface Enginerecids - array to put result into
public <A> long put(A value,
Serializer<A> serializer)
Engine
put in interface Enginevalue - records to be addedserializer - used to convert record into/from binary form
public <A> A get(long recid,
Serializer<A> serializer)
Engine
get in interface Enginerecid - (record identifier) under which record was persistedserializer - used to deserialize record from binary form
public <A> void update(long recid,
A value,
Serializer<A> serializer)
Engine
update in interface Enginerecid - (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 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 form
public <A> void delete(long recid,
Serializer<A> serializer)
Engine
delete in interface Enginerecid - (record identifier) under which was record persistedserializer - which may be used in some circumstances to deserialize and store old objectpublic void close()
EngineNullPointerException
There is an configuration option DBMaker.closeOnJvmShutdown() which uses shutdown hook to automatically
close Engine when JVM shutdowns.
close in interface Enginepublic boolean isClosed()
Engine
isClosed in interface Enginepublic void commit()
Engine
commit in interface Engine
public void rollback()
throws UnsupportedOperationException
EngineUnsupportedOperationException.
rollback in interface EngineUnsupportedOperationException - if transactions are disabledpublic boolean isReadOnly()
Engine
isReadOnly in interface Enginepublic void clearCache()
Engine
clearCache in interface Enginepublic void compact()
compact in interface Enginepublic boolean canRollback()
canRollback in interface Enginepublic long getMaxRecid()
getMaxRecid in class Storepublic ByteBuffer getRaw(long recid)
getRaw in class Storepublic Iterator<Long> getFreeRecids()
getFreeRecids in class Store
public void updateRaw(long recid,
ByteBuffer data)
updateRaw in class Storepublic long getSizeLimit()
Store
getSizeLimit in class Storepublic long getCurrSize()
Store
getCurrSize in class Storepublic long getFreeSize()
Store
getFreeSize in class Storepublic String calculateStatistics()
Store
calculateStatistics in class Store
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||