|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.offheapstore.storage.listener.AbstractListenableStorageEngine<K,V>
org.terracotta.offheapstore.storage.PortabilityBasedStorageEngine<K,V>
public abstract class PortabilityBasedStorageEngine<K,V>
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.terracotta.offheapstore.storage.StorageEngine |
|---|
StorageEngine.Owner |
| Field Summary | |
|---|---|
protected Portability<? super K> |
keyPortability
|
protected Portability<? super V> |
valuePortability
|
| Constructor Summary | |
|---|---|
PortabilityBasedStorageEngine(Portability<? super K> keyPortability,
Portability<? super V> valuePortability)
Creates a storage engine using the given allocator, and portabilities. |
|
| Method Summary | |
|---|---|
void |
attachedMapping(long encoding,
int hash,
int metadata)
|
void |
clear()
Called to indicate that all keys and values are now free. |
protected abstract void |
clearInternal()
|
boolean |
equalsBinaryKey(ByteBuffer binaryKey,
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 abstract void |
free(long address)
|
void |
freeMapping(long encoding,
int hash,
boolean removal)
Called to indicate that the associated encoded value is no longer needed. |
protected abstract WriteContext |
getKeyWriteContext(long address)
|
protected abstract WriteContext |
getValueWriteContext(long address)
|
void |
invalidateCache()
Invalidate any local key/value caches. |
ByteBuffer |
readBinaryKey(long encoding)
|
ByteBuffer |
readBinaryValue(long encoding)
|
K |
readKey(long encoding,
int hashCode)
Converts the supplied encoded key into its correct object form. |
protected abstract ByteBuffer |
readKeyBuffer(long address)
|
V |
readValue(long encoding)
Converts the supplied encoded value into its correct object form. |
protected abstract ByteBuffer |
readValueBuffer(long address)
|
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 value object into it's encoded form. |
protected abstract Long |
writeMappingBuffers(ByteBuffer keyBuffer,
ByteBuffer valueBuffer,
int hash)
|
protected Long |
writeMappingBuffersGathering(ByteBuffer[] keyBuffers,
ByteBuffer[] valueBuffers,
int hash)
|
| Methods inherited from class org.terracotta.offheapstore.storage.listener.AbstractListenableStorageEngine |
|---|
fireCleared, fireCopied, fireFreed, fireRecovered, fireWritten, hasListeners, hasRecoveryListeners, registerListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.terracotta.offheapstore.storage.StorageEngine |
|---|
bind, destroy, getAllocatedMemory, getDataSize, getOccupiedMemory, getVitalMemory, shrink |
| Methods inherited from interface org.terracotta.offheapstore.storage.BinaryStorageEngine |
|---|
readKeyHash |
| Field Detail |
|---|
protected final Portability<? super K> keyPortability
protected final Portability<? super V> valuePortability
| Constructor Detail |
|---|
public PortabilityBasedStorageEngine(Portability<? super K> keyPortability,
Portability<? super V> valuePortability)
allocator - allocator used for storage allocationkeyPortability - key type portabilityvaluePortability - value type portability| Method Detail |
|---|
public final Long writeMapping(K key,
V value,
int hash,
int metadata)
StorageEngine
writeMapping in interface StorageEngine<K,V>value - a value object
public void attachedMapping(long encoding,
int hash,
int metadata)
attachedMapping in interface StorageEngine<K,V>
public final 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 final void clear()
StorageEngine
clear in interface StorageEngine<K,V>public V readValue(long encoding)
StorageEngine
readValue in interface StorageEngine<K,V>encoding - encoded value
public 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 value
true if the value and the encoding are equal
public K readKey(long encoding,
int hashCode)
StorageEngine
readKey in interface StorageEngine<K,V>encoding - encoded keyhashCode - hash-code of the decoded key
public 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 value
true if the key and the encoding are equalpublic ByteBuffer readBinaryKey(long encoding)
readBinaryKey in interface BinaryStorageEnginepublic ByteBuffer readBinaryValue(long encoding)
readBinaryValue in interface BinaryStorageEngine
public boolean equalsBinaryKey(ByteBuffer binaryKey,
long encoding)
equalsBinaryKey in interface BinaryStorageEngine
public Long writeBinaryMapping(ByteBuffer[] binaryKey,
ByteBuffer[] binaryValue,
int pojoHash,
int metadata)
writeBinaryMapping in interface BinaryStorageEngine
public Long writeBinaryMapping(ByteBuffer binaryKey,
ByteBuffer binaryValue,
int pojoHash,
int metadata)
writeBinaryMapping in interface BinaryStorageEngine
protected Long writeMappingBuffersGathering(ByteBuffer[] keyBuffers,
ByteBuffer[] valueBuffers,
int hash)
protected abstract void free(long address)
protected abstract void clearInternal()
protected abstract ByteBuffer readKeyBuffer(long address)
protected abstract WriteContext getKeyWriteContext(long address)
protected abstract ByteBuffer readValueBuffer(long address)
protected abstract WriteContext getValueWriteContext(long address)
protected abstract Long writeMappingBuffers(ByteBuffer keyBuffer,
ByteBuffer valueBuffer,
int hash)
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>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||