Class OffHeapStorageArea

java.lang.Object
org.terracotta.offheapstore.paging.OffHeapStorageArea

public class OffHeapStorageArea extends Object
  • 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

      private static final ByteBuffer[] EMPTY_BUFFER_ARRAY
    • initialPageSize

      private final int initialPageSize
    • maximalPageSize

      private final int maximalPageSize
    • pageGrowthAreaSize

      private final int pageGrowthAreaSize
    • compressThreshold

      private final float compressThreshold
    • owner

      private final OffHeapStorageArea.Owner owner
    • pageSource

      private final PageSource pageSource
    • allocator

      private final Allocator allocator
    • random

      private final Random random
    • released

      private Deque<Collection<Page>> released
    • pages

      private final Map<Integer,Page> pages
    • thief

      private final boolean thief
    • victim

      private final boolean victim
  • Constructor Details

  • 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

      public ByteBuffer readBuffer(long address, int length)
      Read the given range and return the data as a single read-only ByteBuffer.
      Parameters:
      address - address to read from
      length - number of bytes to read
      Returns:
      a read-only buffer
    • readBuffers

      public ByteBuffer[] readBuffers(long address, int length)
      Read the given range and return the data as an array of read-only ByteBuffers.
      Parameters:
      address - address to read from
      length - 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

      public void writeBuffer(long address, ByteBuffer data)
    • writeBuffers

      public void writeBuffers(long address, ByteBuffer[] data)
    • 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

      public String toString()
      Overrides:
      toString in class Object
    • 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

      private void freePage(Page p)
    • release

      public Collection<Page> release(Collection<Page> targets)
    • moveAddressDown

      private boolean moveAddressDown(long target)
    • moveAddressDown

      private boolean moveAddressDown(long target, int size, long start)
    • shrink

      public boolean shrink()
    • getIndexForPage

      private int getIndexForPage(Page p)
    • validatePages

      private void validatePages()