Interface IOEngine

All Known Implementing Classes:
ByteBufferIOEngine, ExclusiveMemoryMmapIOEngine, FileIOEngine, FileMmapIOEngine, PersistentIOEngine, SharedMemoryMmapIOEngine

@Private public interface IOEngine
A class implementing IOEngine interface supports data services for BucketCache.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if persistent storage is supported for the cache when shutdown
    Transfers data from IOEngine to a Cacheable object.
    void
    Shutdown the IOEngine
    void
    Sync the data to IOEngine after writing
    default boolean
    IOEngine uses shared memory means, when reading Cacheable from it, those refers to the same memory area as used by the Engine for caching it.
    void
    write(ByteBuffer srcBuffer, long offset)
    Transfers data from the given byte buffer to IOEngine
    void
    write(ByteBuff srcBuffer, long offset)
    Transfers the data from the given MultiByteBuffer to IOEngine
  • Method Details

    • isPersistent

      boolean isPersistent()
      Returns true if persistent storage is supported for the cache when shutdown
    • usesSharedMemory

      default boolean usesSharedMemory()
      IOEngine uses shared memory means, when reading Cacheable from it, those refers to the same memory area as used by the Engine for caching it.
      Returns:
      true when IOEngine using shared memory.
    • read

      Transfers data from IOEngine to a Cacheable object.
      Parameters:
      be - maintains an (offset,len,refCnt) inside.
      Returns:
      Cacheable which will wrap the NIO ByteBuffers from IOEngine.
      Throws:
      IOException - when any IO error happen
      IllegalArgumentException - when the length of the ByteBuff read is less than 'len'
    • write

      void write(ByteBuffer srcBuffer, long offset) throws IOException
      Transfers data from the given byte buffer to IOEngine
      Parameters:
      srcBuffer - the given byte buffer from which bytes are to be read
      offset - The offset in the IO engine where the first byte to be written
      Throws:
      IOException
    • write

      void write(ByteBuff srcBuffer, long offset) throws IOException
      Transfers the data from the given MultiByteBuffer to IOEngine
      Parameters:
      srcBuffer - the given MultiBytebufffers from which bytes are to be read
      offset - the offset in the IO engine where the first byte to be written
      Throws:
      IOException
    • sync

      void sync() throws IOException
      Sync the data to IOEngine after writing
      Throws:
      IOException
    • shutdown

      void shutdown()
      Shutdown the IOEngine