public abstract class BaseDiskTable extends BaseTable implements Table
Table.
BaseDiskTable manages the column meta-data for a disk-based table.| Modifier and Type | Field and Description |
|---|---|
protected java.io.File |
_dataFile
The name of my ".data" file.
|
protected java.io.File |
_dbdir |
protected org.apache.commons.collections.primitives.IntList |
_freeIds
List of free ids.
|
protected boolean |
_readOnly |
protected int |
_rowCount |
protected static int |
CURRENT_META_VERSION |
protected static java.lang.String |
FRID_FILE_EXT |
protected static AxionFileSystem |
FS |
protected static java.lang.String |
INDICES_DIR_NAME |
protected static long |
INVALID_OFFSET |
protected static java.lang.String |
META_FILE_EXT |
protected static java.lang.String |
PIDX_FILE_EXT |
protected static java.lang.String |
SEQ_FILE_EXT |
protected static java.lang.String |
TYPE_FILE_EXT |
REGULAR_TABLE_TYPE, SYSTEM_TABLE_TYPE| Constructor and Description |
|---|
BaseDiskTable(java.lang.String name,
Database db,
TableFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(Column col)
Add the given
Columnto this table. |
void |
addColumn(Column col,
boolean metaUpdateNeeded) |
void |
addConstraint(Constraint constraint) |
void |
applyDeletes(org.apache.commons.collections.primitives.IntCollection rowIds)
Remove the specified rows from this table and any associated indices.
|
void |
applyInserts(RowCollection rows)
Insert the given rows into this table and any associated indices.
|
void |
applyUpdates(RowCollection rows)
Update the given rows in this table and any associated indices.
|
void |
checkpoint() |
protected void |
clearDataFileReference() |
protected void |
closeFiles() |
protected void |
createOrLoadDataFile() |
protected void |
createOrLoadFreeIdsFile() |
void |
drop()
Drop this table from the database.
|
void |
freeRowId(int id)
Un-reserve a row id.
|
protected abstract java.io.File |
getDataFile() |
protected java.lang.String |
getDefaultDataFileExtension() |
protected BufferedDataInputStream |
getInputStream() |
protected abstract java.io.File |
getLobDir() |
int |
getNextRowId()
Reserve a row id.
|
protected BufferedDataOutputStream |
getOutputStream() |
protected AxionFileSystem.PidxList |
getPidxList() |
protected java.io.File |
getRootDir() |
Row |
getRow(int id) |
protected abstract Row |
getRowByOffset(int idToAssign,
long ptr) |
int |
getRowCount()
Return the number of
Rows I contain. |
protected RowIterator |
getRowIterator() |
protected java.io.File |
getTableFile(java.lang.String extension) |
protected void |
initFiles(java.io.File basedir,
boolean datafilesonly) |
protected void |
initializeRowCount() |
protected boolean |
isReadOnly() |
protected void |
loadOrMigrateMetaFile(Database db) |
void |
migrate(Database db)
Migrate from older version to newer version for this table
|
protected AxionFileSystem.PidxList |
parsePidxFile(java.io.File pidxFile) |
protected void |
parseTableProperties(java.io.ObjectInputStream in) |
void |
populateIndex(Index index)
Populate an
Index, adding my current rows to it. |
protected abstract void |
reloadFilesAfterTruncate() |
void |
remount(java.io.File newdir,
boolean datafilesonly)
Notify this table that its disk-location has moved.
|
void |
removeIndex(Index index)
Remove an index, both from the indices and as a TableModificationListener
|
void |
rename(java.lang.String oldName,
java.lang.String newName) |
protected void |
renameTableFiles(java.lang.String oldName,
java.lang.String name) |
protected void |
resetLobColumns() |
protected void |
saveIndicesAfterTruncate() |
void |
setSequence(Sequence seq) |
void |
shutdown()
The database is shutting down, shutdown this table also.
|
void |
truncate()
Unconditionally delete all rows in this table.
|
protected void |
tryToRemove(RowIterator iter) |
protected void |
writeFridFile() |
protected void |
writeMetaFile() |
protected void |
writeNameToFile(java.io.File file,
java.lang.Object obj) |
protected abstract void |
writeRow(BufferedDataOutputStream buffer,
Row row) |
protected void |
writeTableProperties(java.io.ObjectOutputStream out) |
addIndex, addRow, applyDeletesToIndices, applyInsertsToIndices, applyUpdatesToIndices, clearCache, deleteRow, getColumn, getColumn, getColumnCount, getColumnIdentifiers, getColumnIndex, getConstraint, getConstraints, getIndexedRows, getIndexedRows, getIndexForColumn, getIndices, getName, getRowIterator, getSequence, getType, hasColumn, hasIndex, isColumnIndexed, isPrimaryKeyConstraintExists, isUniqueConstraintExists, makeRowDecorator, makeTransactableTable, notifyColumnsOfNewLobDir, readColumns, readConstraints, recreateIndices, removeConstraint, setName, setType, toString, truncateIndices, updateRow, writeColumns, writeConstraintscheckConstraints, checkConstraints, checkConstraints, getMatchingRows, hasDeferredConstraint, isDeferAll, migrateaddTableModificationListener, getTableModificationListeners, publishEvent, removeTableModificationListener, setDeferAllConstraintsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddIndex, addRow, addTableModificationListener, deleteRow, getColumn, getColumn, getColumnCount, getColumnIdentifiers, getColumnIndex, getConstraint, getConstraints, getIndexedRows, getIndexedRows, getIndexForColumn, getIndices, getMatchingRows, getName, getRowIterator, getSequence, getTableModificationListeners, getType, hasColumn, hasIndex, isColumnIndexed, isPrimaryKeyConstraintExists, isUniqueConstraintExists, makeRowDecorator, makeTransactableTable, migrate, removeConstraint, removeTableModificationListener, setDeferAllConstraints, updateRowprotected static AxionFileSystem FS
protected static final long INVALID_OFFSET
protected static final int CURRENT_META_VERSION
protected static final java.lang.String FRID_FILE_EXT
protected static final java.lang.String INDICES_DIR_NAME
protected static final java.lang.String META_FILE_EXT
protected static final java.lang.String PIDX_FILE_EXT
protected static final java.lang.String SEQ_FILE_EXT
protected static final java.lang.String TYPE_FILE_EXT
protected java.io.File _dataFile
protected java.io.File _dbdir
protected org.apache.commons.collections.primitives.IntList _freeIds
protected boolean _readOnly
protected int _rowCount
public BaseDiskTable(java.lang.String name,
Database db,
TableFactory factory)
throws AxionException
AxionExceptionpublic void addColumn(Column col) throws AxionException
BaseTableColumnto this table. This implementation throws an
AxionExceptionif rows have already been added to the table.addColumn in interface TableaddColumn in class BaseTableAxionExceptionpublic void addColumn(Column col, boolean metaUpdateNeeded) throws AxionException
AxionExceptionpublic void addConstraint(Constraint constraint) throws AxionException
addConstraint in interface TableaddConstraint in class BaseTableAxionExceptionpublic void applyDeletes(org.apache.commons.collections.primitives.IntCollection rowIds)
throws AxionException
TableapplyDeletes in interface TableapplyDeletes in class BaseTableAxionExceptionpublic void applyInserts(RowCollection rows) throws AxionException
TableapplyInserts in interface TableapplyInserts in class BaseTablerows - a collection of RowsAxionExceptionpublic void applyUpdates(RowCollection rows) throws AxionException
TableapplyUpdates in interface TableapplyUpdates in class BaseTableAxionExceptionpublic void checkpoint()
throws AxionException
checkpoint in interface Tablecheckpoint in class BaseTableAxionExceptionpublic void drop()
throws AxionException
Tabledrop in interface Tabledrop in class BaseTableAxionExceptionpublic void freeRowId(int id)
Tablepublic int getNextRowId()
TablegetNextRowId in interface TablegetNextRowId in class BaseTablepublic Row getRow(int id) throws AxionException
getRow in interface RowSourcegetRow in class BaseTableAxionExceptionpublic void migrate(Database db) throws AxionException
AxionExceptionpublic int getRowCount()
TableRows I contain.getRowCount in interface TablegetRowCount in class BaseTablepublic void populateIndex(Index index) throws AxionException
TablepopulateIndex in interface TablepopulateIndex in class BaseTableAxionExceptionTable.addIndex(org.axiondb.Index)public void remount(java.io.File newdir,
boolean datafilesonly)
throws AxionException
Tableremount in interface Tableremount in class BaseTableAxionExceptionpublic void removeIndex(Index index) throws AxionException
TableremoveIndex in interface TableremoveIndex in class BaseTableAxionExceptionpublic void rename(java.lang.String oldName,
java.lang.String newName)
throws AxionException
rename in interface Tablerename in class BaseTableAxionExceptionpublic void setSequence(Sequence seq) throws AxionException
setSequence in interface TablesetSequence in class BaseTableAxionExceptionpublic void shutdown()
throws AxionException
Tableshutdown in interface Tableshutdown in class BaseTableAxionExceptionpublic void truncate()
throws AxionException
Tabletruncate in interface TableAxionExceptionprotected void clearDataFileReference()
protected void closeFiles()
protected void createOrLoadDataFile()
throws AxionException
AxionExceptionprotected void createOrLoadFreeIdsFile()
throws AxionException
AxionExceptionprotected void loadOrMigrateMetaFile(Database db) throws AxionException
AxionExceptionprotected abstract java.io.File getDataFile()
protected java.lang.String getDefaultDataFileExtension()
protected BufferedDataInputStream getInputStream() throws AxionException
AxionExceptionprotected abstract java.io.File getLobDir()
protected BufferedDataOutputStream getOutputStream() throws AxionException
AxionExceptionprotected AxionFileSystem.PidxList getPidxList()
protected java.io.File getRootDir()
protected RowIterator getRowIterator() throws AxionException
getRowIterator in class BaseTableAxionExceptionprotected abstract Row getRowByOffset(int idToAssign, long ptr) throws AxionException
AxionExceptionprotected java.io.File getTableFile(java.lang.String extension)
protected boolean isReadOnly()
protected void initFiles(java.io.File basedir,
boolean datafilesonly)
throws AxionException
AxionExceptionprotected void initializeRowCount()
throws AxionException
AxionExceptionprotected AxionFileSystem.PidxList parsePidxFile(java.io.File pidxFile) throws AxionException
AxionExceptionprotected void parseTableProperties(java.io.ObjectInputStream in)
throws AxionException
AxionExceptionprotected abstract void reloadFilesAfterTruncate()
throws AxionException
AxionExceptionprotected void renameTableFiles(java.lang.String oldName,
java.lang.String name)
protected void saveIndicesAfterTruncate()
throws AxionException
AxionExceptionprotected void tryToRemove(RowIterator iter) throws AxionException
AxionExceptionprotected final void writeFridFile()
throws AxionException
AxionExceptionprotected void writeMetaFile()
throws AxionException
AxionExceptionprotected void writeNameToFile(java.io.File file,
java.lang.Object obj)
throws AxionException
AxionExceptionprotected abstract void writeRow(BufferedDataOutputStream buffer, Row row) throws AxionException
AxionExceptionprotected void writeTableProperties(java.io.ObjectOutputStream out)
throws AxionException
AxionExceptionprotected void resetLobColumns()
throws AxionException
AxionException