Class PortabilityBasedHalfStorageEngine<T>
- java.lang.Object
-
- org.terracotta.offheapstore.storage.PortabilityBasedHalfStorageEngine<T>
-
- All Implemented Interfaces:
HalfStorageEngine<T>
- Direct Known Subclasses:
OffHeapBufferHalfStorageEngine
public abstract class PortabilityBasedHalfStorageEngine<T> extends java.lang.Object implements HalfStorageEngine<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPortabilityBasedHalfStorageEngine.CachedEncode<T>
-
Field Summary
Fields Modifier and Type Field Description private PortabilityBasedHalfStorageEngine.CachedEncode<T>lastObjectprivate Portability<? super T>portability
-
Constructor Summary
Constructors Constructor Description PortabilityBasedHalfStorageEngine(Portability<? super T> portability)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object value, int encoding)Called to determine the equality of the given Java object value against the given encoded form.abstract voidfree(int encoding)Called to indicate that the associated encoded value is no longer needed.voidinvalidateCache()Invalidate any local key/value caches.Tread(int encoding)Converts the supplied encoded value into its correct object form.protected abstract java.nio.ByteBufferreadBuffer(int encoding)java.lang.Integerwrite(T object, int hash)Converts the supplied value object into it's encoded form.protected abstract java.lang.IntegerwriteBuffer(java.nio.ByteBuffer buffer, int hash)-
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.HalfStorageEngine
bind, clear, destroy, getAllocatedMemory, getDataSize, getOccupiedMemory, getVitalMemory, shrink
-
-
-
-
Field Detail
-
portability
private final Portability<? super T> portability
-
lastObject
private PortabilityBasedHalfStorageEngine.CachedEncode<T> lastObject
-
-
Constructor Detail
-
PortabilityBasedHalfStorageEngine
public PortabilityBasedHalfStorageEngine(Portability<? super T> portability)
-
-
Method Detail
-
write
public java.lang.Integer write(T object, int hash)
Description copied from interface:HalfStorageEngineConverts the supplied value object into it's encoded form.- Specified by:
writein interfaceHalfStorageEngine<T>- Parameters:
object- a value objecthash- the keys hash- Returns:
- encoded value
-
free
public abstract void free(int encoding)
Description copied from interface:HalfStorageEngineCalled to indicate that the associated encoded value is no longer needed.This call can be used to free any associated resources tied to the lifecycle of the supplied encoded value.
- Specified by:
freein interfaceHalfStorageEngine<T>- Parameters:
encoding- encoded value
-
read
public T read(int encoding)
Description copied from interface:HalfStorageEngineConverts the supplied encoded value into its correct object form.- Specified by:
readin interfaceHalfStorageEngine<T>- Parameters:
encoding- encoded value- Returns:
- a decoded value object
-
equals
public boolean equals(java.lang.Object value, int encoding)Description copied from interface:HalfStorageEngineCalled to determine the equality of the given Java object value against the given encoded form.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.- Specified by:
equalsin interfaceHalfStorageEngine<T>- Parameters:
value- a value objectencoding- encoded value- Returns:
trueif the value and the encoding are equal
-
readBuffer
protected abstract java.nio.ByteBuffer readBuffer(int encoding)
-
writeBuffer
protected abstract java.lang.Integer writeBuffer(java.nio.ByteBuffer buffer, int hash)
-
invalidateCache
public void invalidateCache()
Description copied from interface:HalfStorageEngineInvalidate any local key/value caches.This 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).
- Specified by:
invalidateCachein interfaceHalfStorageEngine<T>
-
-