Package elki.persistent
Class AbstractPageFile<P extends Page>
- java.lang.Object
-
- elki.persistent.AbstractPageFile<P>
-
- 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 Summary
Fields Modifier and Type Field Description private Counter
readAccess
The read I/O-Access of this file.private Counter
writeAccess
The write I/O-Access of this file.
-
Constructor Summary
Constructors Constructor Description AbstractPageFile()
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this file.protected void
countRead()
Count a page read access.protected void
countWrite()
Count a page write access.protected abstract Logging
getLogger()
Get the class logger.void
logStatistics()
Log some statistics to the appropriate logger.protected abstract void
writePage(int pageid, P page)
Perform the actual page write operation.int
writePage(P page)
Writes a page into this file.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.persistent.PageFile
clear, deletePage, getNextPageID, getPageSize, initialize, readPage, setNextPageID, setPageID
-
-
-
-
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.
-
writePage
protected abstract void writePage(int pageid, P page)
Perform the actual page write operation.- Parameters:
pageid
- Page idpage
- Page to write
-
close
public void close()
Description copied from interface:PageFile
Closes this file.
-
logStatistics
public void logStatistics()
Description copied from interface:PageFile
Log some statistics to the appropriate logger.- Specified by:
logStatistics
in interfacePageFile<P extends Page>
-
countRead
protected void countRead()
Count a page read access.
-
countWrite
protected void countWrite()
Count a page write access.
-
-