Class IntegerStorageEngine
java.lang.Object
org.terracotta.offheapstore.storage.IntegerStorageEngine
- All Implemented Interfaces:
HalfStorageEngine<Integer>
- Direct Known Subclasses:
PersistentIntegerStorageEngine
A symmetric
Integer storage engine.
This engine stores the keys and values directly as their primitive representations, and therefore uses no additional data structure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Factory<IntegerStorageEngine> private static final IntegerStorageEngine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(StorageEngine.Owner owner, long mask) voidclear()Called to indicate that all keys and values are now free.static Factory<IntegerStorageEngine> voiddestroy()booleanCalled to determine the equality of the given Java object value against the given encoded form.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.static IntegerStorageEngineinstance()voidInvalidate any local key/value caches.read(int address) Converts the supplied encoded value into its correct object form.booleanshrink()Converts the supplied value object into it's encoded form.
-
Field Details
-
SINGLETON
-
FACTORY
-
-
Constructor Details
-
IntegerStorageEngine
public IntegerStorageEngine()
-
-
Method Details
-
instance
-
createFactory
-
read
Description copied from interface:HalfStorageEngineConverts the supplied encoded value into its correct object form.- Specified by:
readin interfaceHalfStorageEngine<Integer>- Parameters:
address- encoded value- Returns:
- a decoded value object
-
write
Description copied from interface:HalfStorageEngineConverts the supplied value object into it's encoded form.- Specified by:
writein interfaceHalfStorageEngine<Integer>- Parameters:
value- a value objecthash- the keys hash- Returns:
- encoded value
-
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<Integer>- Parameters:
address- encoded value
-
equals
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<Integer>- Parameters:
key- a value objectaddress- encoded value- Returns:
trueif the value and the encoding are equal
-
clear
public void clear()Description copied from interface:HalfStorageEngineCalled to indicate that all keys and values are now free.- Specified by:
clearin interfaceHalfStorageEngine<Integer>
-
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<Integer>- 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<Integer>- 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<Integer>- 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<Integer>- Returns:
- size of the stored keys and values in bytes
-
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<Integer>
-
bind
- Specified by:
bindin interfaceHalfStorageEngine<Integer>
-
destroy
public void destroy()- Specified by:
destroyin interfaceHalfStorageEngine<Integer>
-
shrink
public boolean shrink()- Specified by:
shrinkin interfaceHalfStorageEngine<Integer>
-