Class OffHeapBufferHalfStorageEngine<T>
java.lang.Object
org.terracotta.offheapstore.storage.PortabilityBasedHalfStorageEngine<T>
org.terracotta.offheapstore.storage.OffHeapBufferHalfStorageEngine<T>
- All Implemented Interfaces:
OffHeapStorageArea.Owner,HalfStorageEngine<T>
public class OffHeapBufferHalfStorageEngine<T>
extends PortabilityBasedHalfStorageEngine<T>
implements OffHeapStorageArea.Owner
-
Nested Class Summary
Nested classes/interfaces inherited from class org.terracotta.offheapstore.storage.PortabilityBasedHalfStorageEngine
PortabilityBasedHalfStorageEngine.CachedEncode<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate longprivate StorageEngine.Ownerprivate final OffHeapStorageArea -
Constructor Summary
ConstructorsConstructorDescriptionOffHeapBufferHalfStorageEngine(PageSource source, int initialPageSize, int maximalPageSize, Portability<? super T> portability, boolean thief, boolean victim) OffHeapBufferHalfStorageEngine(PageSource source, int pageSize, Portability<? super T> portability) OffHeapBufferHalfStorageEngine(PageSource source, int pageSize, Portability<? super T> portability, boolean thief, boolean victim) -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(StorageEngine.Owner o, long m) voidclear()Called to indicate that all keys and values are now free.static <T> Factory<OffHeapBufferHalfStorageEngine<T>> createFactory(PageSource source, int initialPageSize, int maximalPageSize, Portability<? super T> portability, boolean thief, boolean victim) static <T> Factory<OffHeapBufferHalfStorageEngine<T>> createFactory(PageSource source, int pageSize, Portability<? super T> portability) static <T> Factory<OffHeapBufferHalfStorageEngine<T>> createFactory(PageSource source, int pageSize, Portability<? super T> portability, boolean thief, boolean victim) voiddestroy()evictAtAddress(long address, boolean shrink) voidfree(int address) Called to indicate that the associated encoded value is no longer needed.longReturns a measure of the amount of memory allocated for this storage engine.longReturns a measure of the total size of the keys and values stored in this storage engine.longReturns a measure of the amount of memory consumed by this storage engine.longReturns a measure of the amount of vital memory allocated for this storage engine.booleanisThief()booleanmoved(long from, long to) protected ByteBufferreadBuffer(int address) booleanshrink()intsizeOf(long address) toString()protected IntegerwriteBuffer(ByteBuffer buffer, int hash) Methods inherited from class org.terracotta.offheapstore.storage.PortabilityBasedHalfStorageEngine
equals, invalidateCache, read, write
-
Field Details
-
KEY_HASH_OFFSET
private static final int KEY_HASH_OFFSET- See Also:
-
LENGTH_OFFSET
private static final int LENGTH_OFFSET- See Also:
-
DATA_OFFSET
private static final int DATA_OFFSET- See Also:
-
HEADER_LENGTH
private static final int HEADER_LENGTH- See Also:
-
owner
-
mask
private volatile long mask -
storageArea
-
-
Constructor Details
-
OffHeapBufferHalfStorageEngine
public OffHeapBufferHalfStorageEngine(PageSource source, int pageSize, Portability<? super T> portability) -
OffHeapBufferHalfStorageEngine
public OffHeapBufferHalfStorageEngine(PageSource source, int pageSize, Portability<? super T> portability, boolean thief, boolean victim) -
OffHeapBufferHalfStorageEngine
public OffHeapBufferHalfStorageEngine(PageSource source, int initialPageSize, int maximalPageSize, Portability<? super T> portability, boolean thief, boolean victim)
-
-
Method Details
-
createFactory
public static <T> Factory<OffHeapBufferHalfStorageEngine<T>> createFactory(PageSource source, int pageSize, Portability<? super T> portability) -
createFactory
public static <T> Factory<OffHeapBufferHalfStorageEngine<T>> createFactory(PageSource source, int pageSize, Portability<? super T> portability, boolean thief, boolean victim) -
createFactory
public static <T> Factory<OffHeapBufferHalfStorageEngine<T>> createFactory(PageSource source, int initialPageSize, int maximalPageSize, Portability<? super T> portability, boolean thief, boolean victim) -
clear
public void clear()Description copied from interface:HalfStorageEngineCalled to indicate that all keys and values are now free.- Specified by:
clearin interfaceHalfStorageEngine<T>
-
free
public void free(int address) 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>- Specified by:
freein classPortabilityBasedHalfStorageEngine<T>- Parameters:
address- encoded value
-
readBuffer
- Specified by:
readBufferin classPortabilityBasedHalfStorageEngine<T>
-
writeBuffer
- Specified by:
writeBufferin classPortabilityBasedHalfStorageEngine<T>
-
getAllocatedMemory
public long getAllocatedMemory()Description copied from interface:HalfStorageEngineReturns a measure of the amount of memory allocated for this storage engine.- Specified by:
getAllocatedMemoryin interfaceHalfStorageEngine<T>- Returns:
- memory allocated for this engine in bytes
-
getOccupiedMemory
public long getOccupiedMemory()Description copied from interface:HalfStorageEngineReturns a measure of the amount of memory consumed by this storage engine.- Specified by:
getOccupiedMemoryin interfaceHalfStorageEngine<T>- Returns:
- memory occupied by this engine in bytes
-
getVitalMemory
public long getVitalMemory()Description copied from interface:HalfStorageEngineReturns a measure of the amount of vital memory allocated for this storage engine.- Specified by:
getVitalMemoryin interfaceHalfStorageEngine<T>- Returns:
- vital memory allocated for this engine in bytes
-
getDataSize
public long getDataSize()Description copied from interface:HalfStorageEngineReturns a measure of the total size of the keys and values stored in this storage engine.- Specified by:
getDataSizein interfaceHalfStorageEngine<T>- Returns:
- size of the stored keys and values in bytes
-
toString
-
bind
- Specified by:
bindin interfaceHalfStorageEngine<T>
-
destroy
public void destroy()- Specified by:
destroyin interfaceHalfStorageEngine<T>
-
shrink
public boolean shrink()- Specified by:
shrinkin interfaceHalfStorageEngine<T>
-
evictAtAddress
- Specified by:
evictAtAddressin interfaceOffHeapStorageArea.Owner
-
writeLock
- Specified by:
writeLockin interfaceOffHeapStorageArea.Owner
-
isThief
public boolean isThief()- Specified by:
isThiefin interfaceOffHeapStorageArea.Owner
-
moved
public boolean moved(long from, long to) - Specified by:
movedin interfaceOffHeapStorageArea.Owner
-
sizeOf
public int sizeOf(long address) - Specified by:
sizeOfin interfaceOffHeapStorageArea.Owner
-