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
Column to 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
Row s 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, writeConstraints
checkConstraints, checkConstraints, checkConstraints, getMatchingRows, hasDeferredConstraint, isDeferAll, migrate
addTableModificationListener, getTableModificationListeners, publishEvent, removeTableModificationListener, setDeferAllConstraints
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addIndex, 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, updateRow
protected 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
AxionException
public void addColumn(Column col) throws AxionException
BaseTable
Column
to this table. This implementation throws an
AxionException
if rows have already been added to the table.addColumn
in interface Table
addColumn
in class BaseTable
AxionException
public void addColumn(Column col, boolean metaUpdateNeeded) throws AxionException
AxionException
public void addConstraint(Constraint constraint) throws AxionException
addConstraint
in interface Table
addConstraint
in class BaseTable
AxionException
public void applyDeletes(org.apache.commons.collections.primitives.IntCollection rowIds) throws AxionException
Table
applyDeletes
in interface Table
applyDeletes
in class BaseTable
AxionException
public void applyInserts(RowCollection rows) throws AxionException
Table
applyInserts
in interface Table
applyInserts
in class BaseTable
rows
- a collection of RowsAxionException
public void applyUpdates(RowCollection rows) throws AxionException
Table
applyUpdates
in interface Table
applyUpdates
in class BaseTable
AxionException
public void checkpoint() throws AxionException
checkpoint
in interface Table
checkpoint
in class BaseTable
AxionException
public void drop() throws AxionException
Table
drop
in interface Table
drop
in class BaseTable
AxionException
public void freeRowId(int id)
Table
public int getNextRowId()
Table
getNextRowId
in interface Table
getNextRowId
in class BaseTable
public Row getRow(int id) throws AxionException
getRow
in interface RowSource
getRow
in class BaseTable
AxionException
public void migrate(Database db) throws AxionException
AxionException
public int getRowCount()
Table
Row
s I contain.getRowCount
in interface Table
getRowCount
in class BaseTable
public void populateIndex(Index index) throws AxionException
Table
populateIndex
in interface Table
populateIndex
in class BaseTable
AxionException
Table.addIndex(org.axiondb.Index)
public void remount(java.io.File newdir, boolean datafilesonly) throws AxionException
Table
remount
in interface Table
remount
in class BaseTable
AxionException
public void removeIndex(Index index) throws AxionException
Table
removeIndex
in interface Table
removeIndex
in class BaseTable
AxionException
public void rename(java.lang.String oldName, java.lang.String newName) throws AxionException
rename
in interface Table
rename
in class BaseTable
AxionException
public void setSequence(Sequence seq) throws AxionException
setSequence
in interface Table
setSequence
in class BaseTable
AxionException
public void shutdown() throws AxionException
Table
shutdown
in interface Table
shutdown
in class BaseTable
AxionException
public void truncate() throws AxionException
Table
truncate
in interface Table
AxionException
protected void clearDataFileReference()
protected void closeFiles()
protected void createOrLoadDataFile() throws AxionException
AxionException
protected void createOrLoadFreeIdsFile() throws AxionException
AxionException
protected void loadOrMigrateMetaFile(Database db) throws AxionException
AxionException
protected abstract java.io.File getDataFile()
protected java.lang.String getDefaultDataFileExtension()
protected BufferedDataInputStream getInputStream() throws AxionException
AxionException
protected abstract java.io.File getLobDir()
protected BufferedDataOutputStream getOutputStream() throws AxionException
AxionException
protected AxionFileSystem.PidxList getPidxList()
protected java.io.File getRootDir()
protected RowIterator getRowIterator() throws AxionException
getRowIterator
in class BaseTable
AxionException
protected abstract Row getRowByOffset(int idToAssign, long ptr) throws AxionException
AxionException
protected java.io.File getTableFile(java.lang.String extension)
protected boolean isReadOnly()
protected void initFiles(java.io.File basedir, boolean datafilesonly) throws AxionException
AxionException
protected void initializeRowCount() throws AxionException
AxionException
protected AxionFileSystem.PidxList parsePidxFile(java.io.File pidxFile) throws AxionException
AxionException
protected void parseTableProperties(java.io.ObjectInputStream in) throws AxionException
AxionException
protected abstract void reloadFilesAfterTruncate() throws AxionException
AxionException
protected void renameTableFiles(java.lang.String oldName, java.lang.String name)
protected void saveIndicesAfterTruncate() throws AxionException
AxionException
protected void tryToRemove(RowIterator iter) throws AxionException
AxionException
protected final void writeFridFile() throws AxionException
AxionException
protected void writeMetaFile() throws AxionException
AxionException
protected void writeNameToFile(java.io.File file, java.lang.Object obj) throws AxionException
AxionException
protected abstract void writeRow(BufferedDataOutputStream buffer, Row row) throws AxionException
AxionException
protected void writeTableProperties(java.io.ObjectOutputStream out) throws AxionException
AxionException
protected void resetLobColumns() throws AxionException
AxionException