org.hsqldb
Class RowAVLDisk
- java.lang.Object
-
- org.hsqldb.Row
-
- org.hsqldb.RowAVL
-
- org.hsqldb.RowAVLDisk
-
- All Implemented Interfaces:
- CachedObject
- Direct Known Subclasses:
- RowAVLDiskLarge, RowDiskDataChange
public class RowAVLDisk extends RowAVL
In-memory representation of a disk-based database row object with methods for serialization and de-serialization.New class derived from Hypersonic SQL code and enhanced in HSQLDB.
- Since:
- Hypersonic SQL
-
-
Field Summary
Fields Modifier and Type Field and Description static intNO_POS-
Fields inherited from class org.hsqldb.RowAVL
nPrimaryNode
-
Fields inherited from interface org.hsqldb.persist.CachedObject
emptyArray
-
-
Constructor Summary
Constructors Constructor and Description RowAVLDisk(TableBase t, java.lang.Object[] o, PersistentStore store)Constructor for new Rows.RowAVLDisk(TableBase t, RowInputInterface in)Constructor when read from the disk into the Cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddelete(PersistentStore store)Only unlinks nodes.voiddestroy()Helps GC, removing secondary node links.intgetAccessCount()intgetRealSize(RowOutputInterface out)intgetStorageSize()TableBasegetTable()Returns the Table to which this Row belongs.booleanhasChanged()Returns true if Node data has changed.NodeAVLinsertNode(int index)booleanisInMemory()booleanisKeepInMemory()Returns true if any of the Nodes for this row is a root node.booleanisMemory()booleanisNew()booleankeepInMemory(boolean keep)voidsetChanged(boolean changed)Sets flag for row data change.voidsetInMemory(boolean in)voidsetNewNodes(PersistentStore store)voidsetNodesChanged()Sets flag for Node data change.voidsetPos(long pos)Sets the file position for the rowvoidsetStorageSize(int size)voidupdateAccessCount(int count)voidwrite(RowOutputInterface out)Used exclusively by Cache to save the row to disk.voidwrite(RowOutputInterface out, LongLookup lookup)-
Methods inherited from class org.hsqldb.RowAVL
clearNonPrimaryNodes, getNode, restore
-
-
-
-
Field Detail
-
NO_POS
public static final int NO_POS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RowAVLDisk
public RowAVLDisk(TableBase t, java.lang.Object[] o, PersistentStore store)
Constructor for new Rows. Variable hasDataChanged is set to true in order to indicate the data needs saving.- Parameters:
t- tableo- row data
-
RowAVLDisk
public RowAVLDisk(TableBase t, RowInputInterface in) throws java.io.IOException
Constructor when read from the disk into the Cache.- Parameters:
t- tablein- data source- Throws:
java.io.IOException
-
-
Method Detail
-
insertNode
public NodeAVL insertNode(int index)
- Overrides:
insertNodein classRowAVL
-
setNodesChanged
public void setNodesChanged()
Sets flag for Node data change.
-
updateAccessCount
public void updateAccessCount(int count)
- Specified by:
updateAccessCountin interfaceCachedObject- Overrides:
updateAccessCountin classRow
-
getAccessCount
public int getAccessCount()
- Specified by:
getAccessCountin interfaceCachedObject- Overrides:
getAccessCountin classRow
-
getStorageSize
public int getStorageSize()
- Specified by:
getStorageSizein interfaceCachedObject- Overrides:
getStorageSizein classRow
-
isMemory
public boolean isMemory()
- Specified by:
isMemoryin interfaceCachedObject- Overrides:
isMemoryin classRow
-
setPos
public void setPos(long pos)
Sets the file position for the row- Specified by:
setPosin interfaceCachedObject- Overrides:
setPosin classRow- Parameters:
pos- position in data file
-
setChanged
public void setChanged(boolean changed)
Sets flag for row data change.- Overrides:
setChangedin classRow
-
isNew
public boolean isNew()
- Specified by:
isNewin interfaceCachedObject- Overrides:
isNewin classRow
-
hasChanged
public boolean hasChanged()
Returns true if Node data has changed.- Specified by:
hasChangedin interfaceCachedObject- Overrides:
hasChangedin classRow- Returns:
- boolean
-
getTable
public TableBase getTable()
Returns the Table to which this Row belongs.
-
setStorageSize
public void setStorageSize(int size)
- Specified by:
setStorageSizein interfaceCachedObject- Overrides:
setStorageSizein classRow
-
isKeepInMemory
public boolean isKeepInMemory()
Returns true if any of the Nodes for this row is a root node. Used only in Cache.java to avoid removing the row from the cache.- Specified by:
isKeepInMemoryin interfaceCachedObject- Overrides:
isKeepInMemoryin classRow- Returns:
- boolean
-
delete
public void delete(PersistentStore store)
Only unlinks nodes. Is not a destroy() method
-
destroy
public void destroy()
Description copied from class:RowAVLHelps GC, removing secondary node links. Keeps primary index links to allow iteration.- Specified by:
destroyin interfaceCachedObject- Overrides:
destroyin classRowAVL
-
keepInMemory
public boolean keepInMemory(boolean keep)
- Specified by:
keepInMemoryin interfaceCachedObject- Overrides:
keepInMemoryin classRow
-
isInMemory
public boolean isInMemory()
- Specified by:
isInMemoryin interfaceCachedObject- Overrides:
isInMemoryin classRow
-
setInMemory
public void setInMemory(boolean in)
- Specified by:
setInMemoryin interfaceCachedObject- Overrides:
setInMemoryin classRow
-
setNewNodes
public void setNewNodes(PersistentStore store)
- Overrides:
setNewNodesin classRowAVL
-
getRealSize
public int getRealSize(RowOutputInterface out)
- Specified by:
getRealSizein interfaceCachedObject- Overrides:
getRealSizein classRow
-
write
public void write(RowOutputInterface out)
Used exclusively by Cache to save the row to disk. New implementation in 1.7.2 writes out only the Node data if the table row data has not changed. This situation accounts for the majority of invocations as for each row deleted or inserted, the Nodes for several other rows will change.- Specified by:
writein interfaceCachedObject- Overrides:
writein classRow
-
write
public void write(RowOutputInterface out, LongLookup lookup)
- Specified by:
writein interfaceCachedObject- Overrides:
writein classRow
-
-
DataMelt 3.0 © DataMelt by jWork.ORG