Class AbstractPageFile<P extends Page>

  • Type Parameters:
    P - page type
    All Implemented Interfaces:
    PageFile<P>
    Direct Known Subclasses:
    AbstractStoringPageFile, LRUCache

    public abstract class AbstractPageFile<P extends Page>
    extends java.lang.Object
    implements PageFile<P>
    Abstract base class for the page file API for both caches and true page files (in-memory and on-disk).
    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Detail

      • readAccess

        private Counter readAccess
        The read I/O-Access of this file.
      • writeAccess

        private Counter writeAccess
        The write I/O-Access of this file.
    • Constructor Detail

      • AbstractPageFile

        public AbstractPageFile()
        Constructor.
    • Method Detail

      • getLogger

        protected abstract Logging getLogger()
        Get the class logger.
        Returns:
        Logger
      • writePage

        public final int writePage​(P page)
        Writes a page into this file. The method tests if the page has already an id, otherwise a new id is assigned and returned.
        Specified by:
        writePage in interface PageFile<P extends Page>
        Parameters:
        page - the page to be written
        Returns:
        the id of the page
      • writePage

        protected abstract void writePage​(int pageid,
                                          P page)
        Perform the actual page write operation.
        Parameters:
        pageid - Page id
        page - Page to write
      • close

        public void close()
        Description copied from interface: PageFile
        Closes this file.
        Specified by:
        close in interface PageFile<P extends Page>
      • logStatistics

        public void logStatistics()
        Description copied from interface: PageFile
        Log some statistics to the appropriate logger.
        Specified by:
        logStatistics in interface PageFile<P extends Page>
      • countRead

        protected void countRead()
        Count a page read access.
      • countWrite

        protected void countWrite()
        Count a page write access.