org.hsqldb.persist
Class DataFileCache
- java.lang.Object
-
- org.hsqldb.persist.DataFileCache
-
- Direct Known Subclasses:
- DataFileCacheSession, TextCache
public class DataFileCache extends java.lang.ObjectActs as a manager for CACHED table persistence.This contains the top level functionality. Provides file management services and access.
Rewritten for 1.8.0 and 2.x
- Since:
- 1.7.2
-
-
Field Summary
Fields Modifier and Type Field and Description static intFLAG_190static intFLAG_HXstatic intFLAG_ISSAVEDstatic intFLAG_ISSHADOWEDstatic intFLAG_ROWINFOlongmaxDataFileSizeRowOutputInterfacerowOutDataSpaceManagerspaceManager
-
Constructor Summary
Constructors Constructor and Description DataFileCache(Database db, java.lang.String baseFileName)DataFileCache(Database db, java.lang.String baseFileName, boolean defrag)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(CachedObject object)voidadjustStoreCount(int adjust)longbytesCapacity()intcapacity()voidclose()Writes out all cached rows that have been modified and the free position pointer for the *.data file and then closes the file.longenlargeFileSpace(long delta)Delta must always result in block multiplesCachedObjectget(CachedObject object, PersistentStore store, boolean keep)CachedObjectget(long pos, int size, PersistentStore store, boolean keep)CachedObjectget(long pos, PersistentStore store, boolean keep)intgetAccessCount()intgetCachedObjectCount()intgetDataFileScale()longgetFileFreePos()java.lang.StringgetFileName()intgetFlags()longgetLostBlockSize()RAShadowFilegetShadowFile()intgetStorageSize(long i)longgetTotalCachedBlockSize()booleanhasRowInfo()booleanisDataReadOnly()booleanisFileModified()booleanisFileOpen()booleanisModified()voidopen(boolean readonly)Opens the *.data file for this cache, setting the variables that allow access to the particular database version of the *.data file.voidrelease()Abandons changed rows and closes the .data file.CachedObjectrelease(long pos)voidreleaseRange(long start, long limit)voidremove(CachedObject object)Used when a row is deleted as a result of some DML or DDL statement.voidremovePersistence(CachedObject object)voidreopen()voidreplace(CachedObject object)voidreset()Commits all the changes to the filevoidsaveRow(CachedObject row)Writes out the specified Row.voidsaveRowOutput(long pos)
-
-
-
Field Detail
-
FLAG_ISSHADOWED
public static final int FLAG_ISSHADOWED
- See Also:
- Constant Field Values
-
FLAG_ISSAVED
public static final int FLAG_ISSAVED
- See Also:
- Constant Field Values
-
FLAG_ROWINFO
public static final int FLAG_ROWINFO
- See Also:
- Constant Field Values
-
FLAG_190
public static final int FLAG_190
- See Also:
- Constant Field Values
-
FLAG_HX
public static final int FLAG_HX
- See Also:
- Constant Field Values
-
spaceManager
public DataSpaceManager spaceManager
-
rowOut
public RowOutputInterface rowOut
-
maxDataFileSize
public long maxDataFileSize
-
-
Constructor Detail
-
DataFileCache
public DataFileCache(Database db, java.lang.String baseFileName)
-
DataFileCache
public DataFileCache(Database db, java.lang.String baseFileName, boolean defrag)
-
-
Method Detail
-
open
public void open(boolean readonly)
Opens the *.data file for this cache, setting the variables that allow access to the particular database version of the *.data file.
-
release
public void release()
Abandons changed rows and closes the .data file.
-
close
public void close()
Writes out all cached rows that have been modified and the free position pointer for the *.data file and then closes the file.
-
adjustStoreCount
public void adjustStoreCount(int adjust)
-
reopen
public void reopen()
-
reset
public void reset()
Commits all the changes to the file
-
remove
public void remove(CachedObject object)
Used when a row is deleted as a result of some DML or DDL statement. Removes the row from the cache data structures. Adds the file space for the row to the list of free positions.
-
removePersistence
public void removePersistence(CachedObject object)
-
add
public void add(CachedObject object)
-
getStorageSize
public int getStorageSize(long i)
-
replace
public void replace(CachedObject object)
-
get
public CachedObject get(CachedObject object, PersistentStore store, boolean keep)
-
get
public CachedObject get(long pos, int size, PersistentStore store, boolean keep)
-
get
public CachedObject get(long pos, PersistentStore store, boolean keep)
-
releaseRange
public void releaseRange(long start, long limit)
-
release
public CachedObject release(long pos)
-
saveRow
public void saveRow(CachedObject row)
Writes out the specified Row. Will write only the Nodes or both Nodes and table row data depending on what is not already persisted to disk.
-
saveRowOutput
public void saveRowOutput(long pos)
-
enlargeFileSpace
public long enlargeFileSpace(long delta)
Delta must always result in block multiples
-
capacity
public int capacity()
-
bytesCapacity
public long bytesCapacity()
-
getTotalCachedBlockSize
public long getTotalCachedBlockSize()
-
getLostBlockSize
public long getLostBlockSize()
-
getFileFreePos
public long getFileFreePos()
-
getCachedObjectCount
public int getCachedObjectCount()
-
getAccessCount
public int getAccessCount()
-
getFileName
public java.lang.String getFileName()
-
getDataFileScale
public int getDataFileScale()
-
hasRowInfo
public boolean hasRowInfo()
-
isFileModified
public boolean isFileModified()
-
isModified
public boolean isModified()
-
isFileOpen
public boolean isFileOpen()
-
getFlags
public int getFlags()
-
isDataReadOnly
public boolean isDataReadOnly()
-
getShadowFile
public RAShadowFile getShadowFile()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG