public class RestartableMinimalStorageEngine<I,K,V> extends AbstractListenableStorageEngine<K,V> implements StorageEngine<K,V>, BinaryStorageEngine, com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
RestartableMinimalStorageEngine.Entry |
StorageEngine.Owner| Modifier and Type | Field and Description |
|---|---|
protected Portability<? super K> |
keyPortability |
protected OffHeapStorageArea |
metadataArea |
protected StorageEngine.Owner |
owner |
protected Portability<? super V> |
valuePortability |
| Constructor and Description |
|---|
RestartableMinimalStorageEngine(I identifier,
com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource,
boolean synchronous,
PointerSize width,
PageSource source,
int initialPageSize,
int maximalPageSize,
Portability<? super K> keyPortability,
Portability<? super V> valuePortability,
boolean thief,
boolean victim,
float compressThreshold) |
RestartableMinimalStorageEngine(I identifier,
com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource,
boolean synchronous,
PointerSize width,
PageSource source,
int initialPageSize,
int maximalPageSize,
Portability<? super K> keyPortability,
Portability<? super V> valuePortability,
float compressThreshold) |
RestartableMinimalStorageEngine(I identifier,
com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource,
boolean synchronous,
PointerSize width,
PageSource source,
int pageSize,
Portability<? super K> keyPortability,
Portability<? super V> valuePortability,
boolean thief,
boolean victim,
float compressThreshold) |
RestartableMinimalStorageEngine(I identifier,
com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource,
boolean synchronous,
PointerSize width,
PageSource source,
int pageSize,
Portability<? super K> keyPortability,
Portability<? super V> valuePortability,
float compressThreshold) |
| Modifier and Type | Method and Description |
|---|---|
com.terracottatech.frs.object.ObjectManagerEntry<I,ByteBuffer,ByteBuffer> |
acquireCompactionEntry(long ceilingLsn) |
protected void |
assignLsn(long encoding,
long lsn) |
void |
attachedMapping(long encoding,
int hash,
int metadata) |
void |
bind(StorageEngine.Owner owner) |
void |
clear()
Called to indicate that all keys and values are now free.
|
static <I,K,V> Factory<RestartableMinimalStorageEngine<I,K,V>> |
createMinimalFactory(I identifier,
com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource,
boolean synchronous,
PointerSize width,
PageSource source,
int initialPageSize,
int maximalPageSize,
Portability<? super K> keyPortability,
Portability<? super V> valuePortability,
boolean thief,
boolean victim,
float compressThreshold) |
static <I,K,V> Factory<RestartableMinimalStorageEngine<I,K,V>> |
createMinimalFactory(I identifier,
com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource,
boolean synchronous,
PointerSize width,
PageSource source,
int pageSize,
Portability<? super K> keyPortability,
Portability<? super V> valuePortability,
boolean thief,
boolean victim,
float compressThreshold) |
protected int |
deriveMetadata(long encoding) |
void |
destroy() |
protected static ByteBuffer |
detach(ByteBuffer attached) |
protected boolean |
equalsBinaryKey(ByteBuffer probe,
ByteBuffer stored) |
boolean |
equalsBinaryKey(ByteBuffer offheapBinaryKey,
long encoding) |
boolean |
equalsKey(Object key,
long encoding)
Called to determine the equality of the given object against the
given encoded form.
|
boolean |
equalsValue(Object value,
long encoding)
Called to determine the equality of the given Java object value against the
given encoded form.
|
protected long |
firstEncoding() |
void |
freeMapping(long encoding,
int hash,
boolean removal)
Called to indicate that the associated encoded value is no longer needed.
|
protected int |
getActualEntrySize(long encoding) |
long |
getAllocatedMemory()
Returns a measure of the amount of memory allocated for this storage engine.
|
long |
getDataSize()
Returns a measure of the total size of the keys and values stored in this storage engine.
|
Long |
getLowestLsn() |
Long |
getLsn(int pojoHash,
ByteBuffer frsBinaryKey) |
long |
getOccupiedMemory()
Returns a measure of the amount of memory consumed by this storage engine.
|
protected int |
getRequiredEntrySize(ByteBuffer binaryKey,
ByteBuffer binaryValue) |
long |
getVitalMemory()
Returns a measure of the amount of vital memory allocated for this storage engine.
|
void |
invalidateCache()
Invalidate any local key/value caches.
|
protected long |
lastEncoding() |
protected void |
linkNodeExpectingFirst(long node,
long lsn) |
protected void |
linkNodeExpectingLast(long node,
long lsn) |
void |
put(int pojoHash,
ByteBuffer frsBinaryKey,
ByteBuffer frsBinaryValue,
long lsn) |
ByteBuffer |
readBinaryKey(long encoding) |
ByteBuffer |
readBinaryValue(long encoding) |
protected RestartableMinimalStorageEngine.Entry |
readEntry(long encoding) |
K |
readKey(long encoding,
int hashCode)
Converts the supplied encoded key into its correct object form.
|
int |
readKeyHash(long encoding) |
V |
readValue(long encoding)
Converts the supplied encoded value into its correct object form.
|
void |
releaseCompactionEntry(com.terracottatech.frs.object.ObjectManagerEntry<I,ByteBuffer,ByteBuffer> entry) |
void |
remove(int pojoHash,
ByteBuffer frsBinaryKey) |
void |
replayPut(int pojoHash,
ByteBuffer frsBinaryKey,
ByteBuffer frsBinaryValue,
long lsn) |
boolean |
shrink() |
long |
size() |
long |
sizeInBytes() |
protected void |
unlinkNode(long encoding) |
void |
updateLsn(int pojoHash,
com.terracottatech.frs.object.ObjectManagerEntry<I,ByteBuffer,ByteBuffer> entry,
long newLsn) |
protected void |
validChain() |
Long |
writeBinaryMapping(ByteBuffer[] binaryKey,
ByteBuffer[] binaryValue,
int pojoHash,
int metadata) |
Long |
writeBinaryMapping(ByteBuffer binaryKey,
ByteBuffer binaryValue,
int pojoHash,
int metadata) |
Long |
writeMapping(K key,
V value,
int hash,
int metadata)
Converts the supplied key and value objects into their encoded form.
|
protected Long |
writePartialEntry(int hash,
ByteBuffer binaryKey,
ByteBuffer binaryValue) |
fireCleared, fireCopied, fireFreed, fireRecovered, fireWritten, hasListeners, hasRecoveryListeners, registerListenerprotected final OffHeapStorageArea metadataArea
protected final Portability<? super K> keyPortability
protected final Portability<? super V> valuePortability
protected volatile StorageEngine.Owner owner
public RestartableMinimalStorageEngine(I identifier, com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource, boolean synchronous, PointerSize width, PageSource source, int pageSize, Portability<? super K> keyPortability, Portability<? super V> valuePortability, float compressThreshold)
public RestartableMinimalStorageEngine(I identifier, com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource, boolean synchronous, PointerSize width, PageSource source, int initialPageSize, int maximalPageSize, Portability<? super K> keyPortability, Portability<? super V> valuePortability, float compressThreshold)
public RestartableMinimalStorageEngine(I identifier, com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource, boolean synchronous, PointerSize width, PageSource source, int pageSize, Portability<? super K> keyPortability, Portability<? super V> valuePortability, boolean thief, boolean victim, float compressThreshold)
public RestartableMinimalStorageEngine(I identifier, com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource, boolean synchronous, PointerSize width, PageSource source, int initialPageSize, int maximalPageSize, Portability<? super K> keyPortability, Portability<? super V> valuePortability, boolean thief, boolean victim, float compressThreshold)
public static <I,K,V> Factory<RestartableMinimalStorageEngine<I,K,V>> createMinimalFactory(I identifier, com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource, boolean synchronous, PointerSize width, PageSource source, int pageSize, Portability<? super K> keyPortability, Portability<? super V> valuePortability, boolean thief, boolean victim, float compressThreshold)
public static <I,K,V> Factory<RestartableMinimalStorageEngine<I,K,V>> createMinimalFactory(I identifier, com.terracottatech.frs.RestartStore<I,ByteBuffer,ByteBuffer> transactionSource, boolean synchronous, PointerSize width, PageSource source, int initialPageSize, int maximalPageSize, Portability<? super K> keyPortability, Portability<? super V> valuePortability, boolean thief, boolean victim, float compressThreshold)
public Long writeMapping(K key, V value, int hash, int metadata)
StorageEnginewriteMapping in interface StorageEngine<K,V>key - a key objectvalue - a value objecthash - the key hashmetadata - the metadata bitsprotected Long writePartialEntry(int hash, ByteBuffer binaryKey, ByteBuffer binaryValue)
protected int getRequiredEntrySize(ByteBuffer binaryKey, ByteBuffer binaryValue)
protected int getActualEntrySize(long encoding)
public void attachedMapping(long encoding,
int hash,
int metadata)
attachedMapping in interface StorageEngine<K,V>public void freeMapping(long encoding,
int hash,
boolean removal)
StorageEngineThis call can be used to free any associated resources tied to the lifecycle of the supplied encoded value.
freeMapping in interface StorageEngine<K,V>encoding - encoded valuehash - hash of the freed mappingremoval - marks removal from a mappublic V readValue(long encoding)
StorageEnginereadValue in interface StorageEngine<K,V>encoding - encoded valuepublic boolean equalsValue(Object value, long encoding)
StorageEngine
Simple implementations will probably perform a decode on the given encoded
form in order to do a regular Object.equals(Object) comparison.
This method is provided to allow implementations to optimize this
comparison if possible.
equalsValue in interface StorageEngine<K,V>value - a value objectencoding - encoded valuetrue if the value and the encoding are equalpublic K readKey(long encoding, int hashCode)
StorageEnginereadKey in interface StorageEngine<K,V>encoding - encoded keyhashCode - hash-code of the decoded keypublic boolean equalsKey(Object key, long encoding)
StorageEngine
Simple implementations will probably perform a decode on the given encoded
form in order to do a regular Object.equals(Object) comparison.
This method is provided to allow implementations to optimize this
comparison if possible.
equalsKey in interface StorageEngine<K,V>key - a key objectencoding - encoded valuetrue if the key and the encoding are equalpublic boolean equalsBinaryKey(ByteBuffer offheapBinaryKey, long encoding)
equalsBinaryKey in interface BinaryStorageEngineprotected final boolean equalsBinaryKey(ByteBuffer probe, ByteBuffer stored)
public void clear()
StorageEngineclear in interface StorageEngine<K,V>public long getAllocatedMemory()
StorageEnginegetAllocatedMemory in interface StorageEngine<K,V>public long getOccupiedMemory()
StorageEnginegetOccupiedMemory in interface StorageEngine<K,V>public long getVitalMemory()
StorageEnginegetVitalMemory in interface StorageEngine<K,V>public long getDataSize()
StorageEnginegetDataSize in interface StorageEngine<K,V>public void invalidateCache()
StorageEngineThis is called to indicate the termination of a map write "phase". Caching is permitted within a write operation (i.e. to cache around allocation failures during eviction processes).
invalidateCache in interface StorageEngine<K,V>public void bind(StorageEngine.Owner owner)
bind in interface StorageEngine<K,V>public void destroy()
destroy in interface StorageEngine<K,V>public boolean shrink()
shrink in interface StorageEngine<K,V>protected final void assignLsn(long encoding,
long lsn)
protected final void unlinkNode(long encoding)
protected final void linkNodeExpectingLast(long node,
long lsn)
protected final void linkNodeExpectingFirst(long node,
long lsn)
protected final void validChain()
protected long firstEncoding()
protected long lastEncoding()
public long size()
size in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public Long getLowestLsn()
getLowestLsn in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public Long getLsn(int pojoHash, ByteBuffer frsBinaryKey)
getLsn in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public void put(int pojoHash,
ByteBuffer frsBinaryKey,
ByteBuffer frsBinaryValue,
long lsn)
put in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public void remove(int pojoHash,
ByteBuffer frsBinaryKey)
remove in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public void replayPut(int pojoHash,
ByteBuffer frsBinaryKey,
ByteBuffer frsBinaryValue,
long lsn)
replayPut in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public Long writeBinaryMapping(ByteBuffer binaryKey, ByteBuffer binaryValue, int pojoHash, int metadata)
writeBinaryMapping in interface BinaryStorageEnginepublic Long writeBinaryMapping(ByteBuffer[] binaryKey, ByteBuffer[] binaryValue, int pojoHash, int metadata)
writeBinaryMapping in interface BinaryStorageEnginepublic int readKeyHash(long encoding)
readKeyHash in interface BinaryStorageEnginepublic ByteBuffer readBinaryKey(long encoding)
readBinaryKey in interface BinaryStorageEnginepublic ByteBuffer readBinaryValue(long encoding)
readBinaryValue in interface BinaryStorageEngineprotected static ByteBuffer detach(ByteBuffer attached)
protected RestartableMinimalStorageEngine.Entry readEntry(long encoding)
public com.terracottatech.frs.object.ObjectManagerEntry<I,ByteBuffer,ByteBuffer> acquireCompactionEntry(long ceilingLsn)
acquireCompactionEntry in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public void releaseCompactionEntry(com.terracottatech.frs.object.ObjectManagerEntry<I,ByteBuffer,ByteBuffer> entry)
releaseCompactionEntry in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>public void updateLsn(int pojoHash,
com.terracottatech.frs.object.ObjectManagerEntry<I,ByteBuffer,ByteBuffer> entry,
long newLsn)
updateLsn in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>protected int deriveMetadata(long encoding)
public long sizeInBytes()
sizeInBytes in interface com.terracottatech.frs.object.ObjectManagerSegment<I,ByteBuffer,ByteBuffer>Copyright © 2015–2024. All rights reserved.