|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object O2Plib.db.CSD.CSDglb O2Plib.db.CSD.CSDcache
public class CSDcache
Class CSDcache supports multiple memory and multiple disk caches for supporting a single Composite Samples Database for Open2Dprot programs.
There are nMemCaches memory caches and nDiskCaches disk caches. They all point to chunks of the CSD database. The CSD database can be either filled from a binary random access file (initial design), an XML data file, and from a RDBMS (local or net-based).
The caches allow multiple access to different cross sections of the database to make it easier to do clustering and other methods where there is comparison of Rspot expression from disparate sections of the database.
This file is derived from GELLAB-II C code and MAExplorer code
This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The Open2Dprot Mozilla and Legal files are available on http://Open2Dprot.sourceforge.net/.
Field Summary | |
---|---|
java.io.RandomAccessFile[] |
diskCacheFD
[0:nDiskCaches-1] list of disk cache Random Access Files |
long[] |
diskCacheFilePtr
[0:nDiskCaches-1] list of disk cache file pointers in CSD database |
byte[][] |
diskCacheList
[0:nDiskCaches-1][0:diskCacheSize-1(variable)] list of CSD disk caches |
java.lang.String[] |
diskCacheName
[0:nDiskCaches-1] list of disk cache file names |
int[] |
diskCacheSize
[0:nDiskCaches-1] list of disk cache list sizes |
long[] |
diskCacheTimeStamp
[0:nDiskCaches-1] list of disk cache time stamps |
boolean[] |
diskCacheValid
[0:nDiskCaches-1] list of valid disk caches |
static int |
diskTimeStampCtr
disk cache time stamp for aging cache |
int |
maxDiskCaches
maximum number of CSD disk caches |
int |
maxDiskCachesSize
maximum number of CSD disk caches |
int |
maxMemCaches
maximum number of CSD memory caches |
int |
maxMemCachesSize
maximum number of CSD memory caches |
long[] |
memCacheFilePtr
[0:nMemCaches-1] list of cache file pointers in CSD database |
byte[][] |
memCacheList
[0:nMemCaches-1][0:memCacheSize-1(variable)] list of CSD memory caches |
int[] |
memCacheSize
[0:nMemCaches-1] list of memory cache list sizes |
long[] |
memCacheTimeStamp
[0:nMemCaches-1] list of memory cache time stamps |
boolean[] |
memCacheValid
[0:nMemCaches-1] list of valid memory caches |
static int |
memTimeStampCtr
memory cache time stamp for aging cache |
int |
nDiskCaches
number of CSD disk caches |
int |
nMemCaches
number of CSD memory caches |
static java.lang.String |
VERSION
Version for this module |
Constructor Summary | |
---|---|
CSDcache()
CSDcache() - Constructor for new CSDcache. |
|
CSDcache(int maxMemCachesSize,
int maxMemCaches,
int maxDiskCachesSize,
int maxDiskCaches)
CSDcache() - Constructor for new CSD. |
Method Summary | |
---|---|
boolean |
createNewEmptyCGLdbFile(java.lang.String fileName,
long maxFileSize)
createNewEmptyCGLdbFile() - Create a zeroed CSD cache database file called fileName. |
int |
findFreeDiskCache(int desiredSize)
findFreeDiskCache() - find first free disk cache. |
int |
findFreeMemCache(int desiredSize)
findFreeMemCache() - find first free memory cache.If no cache is free, then pick the oldest one and flush it to the CSD database if valid and reuse that cache. |
boolean |
flushAllCachesToCSDdbFile()
flushAllCachesToCSDdbFile() - flush the cache (memory and disk) to the CSD database file. |
boolean |
flushAllMemCacheToDiskCache()
flushAllMemCacheToDiskCache() - flush the memory cache to the disk cache. |
boolean |
flushMemCacheToDiskCache(int memCacheNbr)
flushMemCacheToDiskCache() - flush the memory cache to the disk cache. |
boolean |
getMemCacheFromDiskCache(int memCacheNbr,
int diskCacheNbr)
getMemCacheFromDiskCache() - get the memory cache from the disk cache up to the maximum memory cache size if needed. |
void |
initCacheLists()
initCacheLists() - init cache lists. |
Methods inherited from class O2Plib.db.CSD.CSDglb |
---|
initGlb |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
public static int memTimeStampCtr
public static int diskTimeStampCtr
public int maxMemCachesSize
public int maxMemCaches
public byte[][] memCacheList
public int[] memCacheSize
public boolean[] memCacheValid
public long[] memCacheTimeStamp
public long[] memCacheFilePtr
public int nMemCaches
public int maxDiskCachesSize
public int maxDiskCaches
public byte[][] diskCacheList
public int[] diskCacheSize
public java.lang.String[] diskCacheName
public java.io.RandomAccessFile[] diskCacheFD
public boolean[] diskCacheValid
public long[] diskCacheTimeStamp
public long[] diskCacheFilePtr
public int nDiskCaches
Constructor Detail |
---|
public CSDcache()
public CSDcache(int maxMemCachesSize, int maxMemCaches, int maxDiskCachesSize, int maxDiskCaches)
maxMemCachesSize
- is max size of memory cachesmaxMemCaches
- is max # of memory cachesmaxDiskCachesSize
- is max size of disk cachesmaxDiskCaches
- is max # of disk cachesMethod Detail |
---|
public void initCacheLists()
public boolean flushAllMemCacheToDiskCache()
public boolean flushMemCacheToDiskCache(int memCacheNbr)
public boolean getMemCacheFromDiskCache(int memCacheNbr, int diskCacheNbr)
public boolean flushAllCachesToCSDdbFile()
public int findFreeMemCache(int desiredSize)
desiredSize
- if not null, else use maxMemCachesSize
public int findFreeDiskCache(int desiredSize)
desiredSize
- if not null, else use maxMemCachesSizeforceFindFlag
- to flush a buffer if not used.
public boolean createNewEmptyCGLdbFile(java.lang.String fileName, long maxFileSize)
fileName
- of the database filemaxFileSize
- of the file to create
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |