Top Inners Fields Constructors Methods
org.hsqldb.persist

public Class DataSpaceManagerBlocks

extends Object
implements DataSpaceManager
Class Inheritance
All Implemented Interfaces
org.hsqldb.persist.DataSpaceManager
Imports
java.util.concurrent.atomic.AtomicInteger, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.DoubleIntIndex, .IntIndex, .IntKeyHashMap, .Iterator, .LongLookup, .OrderedIntHashSet

Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
2.3.0
Version
2.7.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
pack-priv DataSpaceManagerBlocks.BlockAccessor
pack-priv final int
pack-priv final int
pack-priv final BlockObjectStore
pack-priv final DataFileCache
pack-priv final int
pack-priv final TableSpaceManagerBlocks
public static final int
pack-priv final TableSpaceManagerBlocks
pack-priv final BlockObjectStore
pack-priv final IntIndex
pack-priv final int
public static final int
pack-priv final int
public static final int
pack-priv DoubleIntArrayCachedObject
pack-priv final BlockObjectStore
pack-priv int
pack-priv IntArrayCachedObject
pack-priv final BlockObjectStore
pack-priv final AtomicInteger
pack-priv final IntKeyHashMap<TableSpaceManager>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv DoubleIntIndex
checkDirectoryBitmaps(DirectoryBlockCachedObject mismatch)

return keys are file block indexes, values are space ids

pack-priv DoubleIntIndex
checkDirectorySpaces()

return keys are file block indexes, values are bad (off) space ids or tableIdDirectory when two bitmpas have the same pointer

private void
createDirectory(int fileBlockIndex)

private void
createFileBlockInDirectory(int fileBlockIndex, int tableId)

private void
createFileBlocksInDirectory(int fileBlockIndex, int blockCount, int tableId)

private void
ensureDirectorySpaceAvailable(int blockCount)

The space for a new directory block must be added to the directorySpaceManager before createFileBlocksInDirectory is called, otherwise there is no space to create the bit-map

private int
findLargestFreeSpace(int spaceId)

private int
findLastFreeSpace(int spaceId)

pack-priv int
findTableSpace(long position)

Returns space id returns - 1 if pointer is beyond the last allocated block

public void
public void
freeTableSpace(int spaceId, LongLookup spaceList, long offset, long limit)

Implements org.hsqldb.persist.DataSpaceManager.freeTableSpace.

private void
freeTableSpacePart(long position, int units)

pack-priv BlockObjectStore
private int
public TableSpaceManager
private DirectoryBlockCachedObject
getDirectory(int fileBlockIndex, boolean keep)

private DirectoryBlockCachedObject
getDirectoryByIndex(int indexInRoot, boolean keep)

private int
getDirectoryIndexLimit(int indexInRoot)

public DirectoryBlockCachedObject[]
pack-priv BlockObjectStore
private int
getExistingBlockIndex(int tableId, int blockCount)

public int
pack-priv int
public long
getFileBlocks(int tableId, int blockCount)

Implements org.hsqldb.persist.DataSpaceManager.getFileBlocks.

try available blocks first, then get fresh block

public int
pack-priv BlockObjectStore
public long
private long
getNewFileBlocks(int tableId, int blockCount)

private long
getNewFileBlocksNoCheck(int tableId, int blockCount)

public int
pack-priv long
getPositionFromFileBlock(int fixedBlockPos)

input is in units of fixedBlockSizeUnit output is in units of dataFileScale

pack-priv BlockObjectStore
public TableSpaceManager
private boolean
hasFreeSpace(int spaceId, int blockIndex)

private void
private void
public void
public void
private void
initialiseTableSpace(TableSpaceManagerBlocks tableSpace, int blockIndex)

public boolean
public boolean
public void
pack-priv void
private void
setDirectoryBlocksAsTable(int tableId, int blockIndex, int blockCount)

index and blockCount always valid

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baback to summary
pack-priv DataSpaceManagerBlocks.BlockAccessor ba
bitmapIntSizeback to summary
pack-priv final int bitmapIntSize
bitmapStorageSizeback to summary
pack-priv final int bitmapStorageSize
bitMapStoreback to summary
pack-priv final BlockObjectStore bitMapStore
cacheback to summary
pack-priv final DataFileCache cache
dataFileScaleback to summary
pack-priv final int dataFileScale
defaultSpaceManagerback to summary
pack-priv final TableSpaceManagerBlocks defaultSpaceManager
dirBlockSizeback to summary
public static final int dirBlockSize
directorySpaceManagerback to summary
pack-priv final TableSpaceManagerBlocks directorySpaceManager
directoryStoreback to summary
pack-priv final BlockObjectStore directoryStore
emptySpaceListback to summary
pack-priv final IntIndex emptySpaceList
fileBlockItemCountback to summary
pack-priv final int fileBlockItemCount
fileBlockItemCountLimitback to summary
public static final int fileBlockItemCountLimit
fileBlockSizeback to summary
pack-priv final int fileBlockSize
lastBlockListSizeback to summary
public static final int lastBlockListSize
lastBlocksback to summary
pack-priv DoubleIntArrayCachedObject lastBlocks
lastBlockStoreback to summary
pack-priv final BlockObjectStore lastBlockStore
releasedback to summary
pack-priv int released
rootBlockback to summary
pack-priv IntArrayCachedObject rootBlock
rootStoreback to summary
pack-priv final BlockObjectStore rootStore
spaceIdSequenceback to summary
pack-priv final AtomicInteger spaceIdSequence
spaceManagerListback to summary
pack-priv final IntKeyHashMap<TableSpaceManager> spaceManagerList

Constructor Detail

DataSpaceManagerBlocksback to summary
public DataSpaceManagerBlocks(DataFileCache dataFileCache)

Method Detail

checkDirectoryBitmapsback to summary
pack-priv DoubleIntIndex checkDirectoryBitmaps(DirectoryBlockCachedObject mismatch)

return keys are file block indexes, values are space ids

checkDirectorySpacesback to summary
pack-priv DoubleIntIndex checkDirectorySpaces()

return keys are file block indexes, values are bad (off) space ids or tableIdDirectory when two bitmpas have the same pointer

createDirectoryback to summary
private void createDirectory(int fileBlockIndex)
createFileBlockInDirectoryback to summary
private void createFileBlockInDirectory(int fileBlockIndex, int tableId)
createFileBlocksInDirectoryback to summary
private void createFileBlocksInDirectory(int fileBlockIndex, int blockCount, int tableId)
ensureDirectorySpaceAvailableback to summary
private void ensureDirectorySpaceAvailable(int blockCount)

The space for a new directory block must be added to the directorySpaceManager before createFileBlocksInDirectory is called, otherwise there is no space to create the bit-map

findLargestFreeSpaceback to summary
private int findLargestFreeSpace(int spaceId)
findLastFreeSpaceback to summary
private int findLastFreeSpace(int spaceId)
findTableSpaceback to summary
pack-priv int findTableSpace(long position)

Returns space id returns - 1 if pointer is beyond the last allocated block

freeTableSpaceback to summary
public void freeTableSpace(int spaceId)

Implements org.hsqldb.persist.DataSpaceManager.freeTableSpace.

freeTableSpaceback to summary
public void freeTableSpace(int spaceId, LongLookup spaceList, long offset, long limit)

Implements org.hsqldb.persist.DataSpaceManager.freeTableSpace.

freeTableSpacePartback to summary
private void freeTableSpacePart(long position, int units)
getBitMapStoreback to summary
pack-priv BlockObjectStore getBitMapStore()
getBlockIndexLimitback to summary
private int getBlockIndexLimit()
getDefaultTableSpaceback to summary
public TableSpaceManager getDefaultTableSpace()

Implements org.hsqldb.persist.DataSpaceManager.getDefaultTableSpace.

getDirectoryback to summary
private DirectoryBlockCachedObject getDirectory(int fileBlockIndex, boolean keep)
getDirectoryByIndexback to summary
private DirectoryBlockCachedObject getDirectoryByIndex(int indexInRoot, boolean keep)
getDirectoryIndexLimitback to summary
private int getDirectoryIndexLimit(int indexInRoot)
getDirectoryListback to summary
public DirectoryBlockCachedObject[] getDirectoryList()

Implements org.hsqldb.persist.DataSpaceManager.getDirectoryList.

getDirectoryStoreback to summary
pack-priv BlockObjectStore getDirectoryStore()
getExistingBlockIndexback to summary
private int getExistingBlockIndex(int tableId, int blockCount)
getFileBlockItemCountback to summary
public int getFileBlockItemCount()

Implements org.hsqldb.persist.DataSpaceManager.getFileBlockItemCount.

getFileBlockPosFromPositionback to summary
pack-priv int getFileBlockPosFromPosition(long position)
getFileBlocksback to summary
public long getFileBlocks(int tableId, int blockCount)

Implements org.hsqldb.persist.DataSpaceManager.getFileBlocks.

try available blocks first, then get fresh block

getFileBlockSizeback to summary
public int getFileBlockSize()

Implements org.hsqldb.persist.DataSpaceManager.getFileBlockSize.

getLastBlockStoreback to summary
pack-priv BlockObjectStore getLastBlockStore()
getLostBlocksSizeback to summary
public long getLostBlocksSize()

Implements org.hsqldb.persist.DataSpaceManager.getLostBlocksSize.

getNewFileBlocksback to summary
private long getNewFileBlocks(int tableId, int blockCount)
getNewFileBlocksNoCheckback to summary
private long getNewFileBlocksNoCheck(int tableId, int blockCount)
getNewTableSpaceIDback to summary
public int getNewTableSpaceID()

Implements org.hsqldb.persist.DataSpaceManager.getNewTableSpaceID.

getPositionFromFileBlockback to summary
pack-priv long getPositionFromFileBlock(int fixedBlockPos)

input is in units of fixedBlockSizeUnit output is in units of dataFileScale

getRootStoreback to summary
pack-priv BlockObjectStore getRootStore()
getTableSpaceback to summary
public TableSpaceManager getTableSpace(int spaceId)

Implements org.hsqldb.persist.DataSpaceManager.getTableSpace.

hasFreeSpaceback to summary
private boolean hasFreeSpace(int spaceId, int blockIndex)
initialiseNewSpaceDirectoryback to summary
private void initialiseNewSpaceDirectory()
initialiseSpaceListback to summary
private void initialiseSpaceList()
initialiseSpacesback to summary
public void initialiseSpaces()

Implements org.hsqldb.persist.DataSpaceManager.initialiseSpaces.

initialiseTableSpaceback to summary
public void initialiseTableSpace(TableSpaceManagerBlocks tableSpace)

Implements org.hsqldb.persist.DataSpaceManager.initialiseTableSpace.

initialiseTableSpaceback to summary
private void initialiseTableSpace(TableSpaceManagerBlocks tableSpace, int blockIndex)
isModifiedback to summary
public boolean isModified()

Implements org.hsqldb.persist.DataSpaceManager.isModified.

isMultiSpaceback to summary
public boolean isMultiSpace()

Implements org.hsqldb.persist.DataSpaceManager.isMultiSpace.

resetback to summary
public void reset()

Implements org.hsqldb.persist.DataSpaceManager.reset.

setAsideBlocksback to summary
pack-priv void setAsideBlocks(OrderedIntHashSet blocks)
setDirectoryBlocksAsTableback to summary
private void setDirectoryBlocksAsTable(int tableId, int blockIndex, int blockCount)

index and blockCount always valid

org.hsqldb.persist back to summary

private Class DataSpaceManagerBlocks.BlockAccessor

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv BitMapCachedObject
pack-priv int
pack-priv int
pack-priv DirectoryBlockCachedObject
pack-priv int
pack-priv boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
pack-priv char
pack-priv char
pack-priv int
pack-priv void
initialise(boolean forUpdate)

pack-priv boolean
moveToBlock(int fileBlockIndex)

pack-priv boolean
pack-priv boolean
nextBlockForTable(int tableId)

pack-priv void
private void
pack-priv int
setRange(int offset, int currentUnits)

pack-priv void
setTable(int tableId)

pack-priv int
unsetRange(int offset, int currentUnits)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentBitMapback to summary
pack-priv BitMapCachedObject currentBitMap
currentBlockIndexback to summary
pack-priv int currentBlockIndex
currentBlockOffsetback to summary
pack-priv int currentBlockOffset
currentDirback to summary
pack-priv DirectoryBlockCachedObject currentDir
currentDirIndexback to summary
pack-priv int currentDirIndex
currentKeepback to summary
pack-priv boolean currentKeep

Constructor Detail

BlockAccessorback to summary
private BlockAccessor()

Method Detail

endBlockUpdateback to summary
private void endBlockUpdate()
getFreeBlockValueback to summary
pack-priv char getFreeBlockValue()
getFreeSpaceValueback to summary
pack-priv char getFreeSpaceValue()
getTableIdback to summary
pack-priv int getTableId()
initialiseback to summary
pack-priv void initialise(boolean forUpdate)
moveToBlockback to summary
pack-priv boolean moveToBlock(int fileBlockIndex)
nextBlockback to summary
pack-priv boolean nextBlock()
nextBlockForTableback to summary
pack-priv boolean nextBlockForTable(int tableId)
resetback to summary
pack-priv void reset()
resetVarsback to summary
private void resetVars()
setRangeback to summary
pack-priv int setRange(int offset, int currentUnits)
setTableback to summary
pack-priv void setTable(int tableId)
unsetRangeback to summary
pack-priv int unsetRange(int offset, int currentUnits)