Class MemoryPageFile<P extends Page>

  • Type Parameters:
    P - Page type
    All Implemented Interfaces:
    PageFile<P>

    public class MemoryPageFile<P extends Page>
    extends AbstractStoringPageFile<P>
    A memory based implementation of a PageFile that simulates I/O-access. Implemented as a Map with keys representing the ids of the saved pages.
    Since:
    0.1
    Author:
    Elke Achtert
    • Field Detail

      • LOG

        private static final Logging LOG
        Class logger.
      • file

        private final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<P extends Page> file
        Holds the pages.
    • Constructor Detail

      • MemoryPageFile

        public MemoryPageFile​(int pageSize)
        Creates a new MemoryPageFile that is supported by a cache with the specified parameters.
        Parameters:
        pageSize - the size of a page in Bytes
    • Method Detail

      • readPage

        public P readPage​(int pageID)
        Description copied from interface: PageFile
        Reads the page with the given id from this file.
        Parameters:
        pageID - the id of the page to be returned
        Returns:
        the page with the given pageId
      • writePage

        protected void writePage​(int pageID,
                                 P page)
        Description copied from class: AbstractPageFile
        Perform the actual page write operation.
        Specified by:
        writePage in class AbstractPageFile<P extends Page>
        Parameters:
        pageID - Page id
        page - Page to write
      • clear

        public void clear()
        Description copied from interface: PageFile
        Clears this PageFile.