Class OffHeapStorageArea
java.lang.Object
org.terracotta.offheapstore.paging.OffHeapStorageArea
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Allocatorprivate final floatprivate static final ByteBuffer[]private final intprivate static final longprivate static final org.slf4j.Loggerprivate final intprivate final OffHeapStorageArea.Ownerprivate final intprivate final PageSourceprivate final Randomprivate Deque<Collection<Page>> private final booleanprivate static final booleanprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionOffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int pageSize, boolean thief, boolean victim) OffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int pageSize, boolean thief, boolean victim, float compressThreshold) OffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int initialPageSize, int maximalPageSize, boolean thief, boolean victim) OffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int initialPageSize, int maximalPageSize, boolean thief, boolean victim, float compressThreshold) -
Method Summary
Modifier and TypeMethodDescriptionprivate longaddressForPage(int index) longallocate(long size) voidclear()private booleancompress()voiddestroy()private booleanvoidfree(long address) private voidlongprivate intlongprivate booleanmoveAddressDown(long target) private booleanmoveAddressDown(long target, int size, long start) private intprivate intpageAddressFor(long address) private intpageIndexFor(long address) private intpageSizeFor(int index) readBuffer(long address, int length) Read the given range and return the data as a single read-onlyByteBuffer.readBuffers(long address, int length) Read the given range and return the data as an array of read-onlyByteBuffers.bytereadByte(long address) intreadInt(long address) longreadLong(long address) shortreadShort(long address) voidrelease(long address) release(Collection<Page> targets) booleanshrink()toString()private voidvoidvoidwriteBuffer(long address, ByteBuffer data) voidwriteBuffers(long address, ByteBuffer[] data) voidwriteByte(long address, byte value) voidwriteInt(long address, int value) voidwriteLong(long address, long value) voidwriteShort(long address, short value)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
VALIDATING
private static final boolean VALIDATING -
LARGEST_POWER_OF_TWO
private static final long LARGEST_POWER_OF_TWO -
EMPTY_BUFFER_ARRAY
-
initialPageSize
private final int initialPageSize -
maximalPageSize
private final int maximalPageSize -
pageGrowthAreaSize
private final int pageGrowthAreaSize -
compressThreshold
private final float compressThreshold -
owner
-
pageSource
-
allocator
-
random
-
released
-
pages
-
thief
private final boolean thief -
victim
private final boolean victim
-
-
Constructor Details
-
OffHeapStorageArea
public OffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int pageSize, boolean thief, boolean victim) -
OffHeapStorageArea
public OffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int pageSize, boolean thief, boolean victim, float compressThreshold) -
OffHeapStorageArea
public OffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int initialPageSize, int maximalPageSize, boolean thief, boolean victim) -
OffHeapStorageArea
public OffHeapStorageArea(PointerSize width, OffHeapStorageArea.Owner owner, PageSource pageSource, int initialPageSize, int maximalPageSize, boolean thief, boolean victim, float compressThreshold)
-
-
Method Details
-
clear
public void clear() -
readByte
public byte readByte(long address) -
readShort
public short readShort(long address) -
readInt
public int readInt(long address) -
readLong
public long readLong(long address) -
readBuffer
Read the given range and return the data as a single read-onlyByteBuffer.- Parameters:
address- address to read fromlength- number of bytes to read- Returns:
- a read-only buffer
-
readBuffers
Read the given range and return the data as an array of read-onlyByteBuffers.- Parameters:
address- address to read fromlength- number of bytes to read- Returns:
- an array of read-only buffers
-
writeByte
public void writeByte(long address, byte value) -
writeShort
public void writeShort(long address, short value) -
writeInt
public void writeInt(long address, int value) -
writeLong
public void writeLong(long address, long value) -
writeBuffer
-
writeBuffers
-
free
public void free(long address) -
compress
private boolean compress() -
destroy
public void destroy() -
allocate
public long allocate(long size) -
expandData
private boolean expandData() -
getAllocatedMemory
public long getAllocatedMemory() -
getOccupiedMemory
public long getOccupiedMemory() -
toString
-
pageIndexFor
private int pageIndexFor(long address) -
addressForPage
private long addressForPage(int index) -
pageAddressFor
private int pageAddressFor(long address) -
pageSizeFor
private int pageSizeFor(int index) -
nextPageSize
private int nextPageSize() -
validateStorageArea
public void validateStorageArea() -
release
public void release(long address) -
freePage
-
release
-
moveAddressDown
private boolean moveAddressDown(long target) -
moveAddressDown
private boolean moveAddressDown(long target, int size, long start) -
shrink
public boolean shrink() -
getIndexForPage
-
validatePages
private void validatePages()
-