Package com.mckoi.database
Class V1MasterTableDataSource
java.lang.Object
com.mckoi.database.V1MasterTableDataSource
A MasterTableDataSource that uses IndexStore and VariableSizeDataStore as
its backing mechanism for representing the table structure in a file on
disk.
The MasterTableDataSource is basically backed by a VariableSizeDataStore for data and an IndexStore for storing indexing information.
- Author:
- Tobias Downer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BlobStoreInterface
An abstracted reference to a BlobStore for managing blob references and blob data.protected final com.mckoi.database.DataCellCache
A reference to the DataCellCache object.protected int
The number of columns in this table.protected com.mckoi.database.RIDList[]
The list of RIDList objects for each column in this table.protected boolean
Set to false to disable cell caching.protected String
protected String
protected com.mckoi.database.MasterTableGarbageCollector
Manages scanning and deleting of rows marked as deleted within this data source.protected DataIndexSetDef
A DataIndexSetDef object that describes the indexes on the table.protected String
protected boolean
True if this table source is closed.protected String
The keys we use for Database.stats() for information for this table.protected DataTableDef
A DataTableDef object that describes the table topology.protected int
An integer that uniquely identifies this data source within the conglomerate.protected com.mckoi.database.MultiVersionTableIndices
A multi-version representation of the table indices kept for this table including the row list and the scheme indices.protected String
-
Constructor Summary
ConstructorsConstructorDescriptionV1MasterTableDataSource
(TransactionSystem system, com.mckoi.database.StoreSystem store_system, com.mckoi.database.OpenTransactionList open_transactions) The Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkAndRepair
(String file_name, UserTerminal terminal) Performs a complete check and repair of the table.void
protected void
Clears all root locks on the table.final DebugLogger
Debug()
Returns the DebugLogger object that can be used to log debug messages.protected void
This is called by the 'open' method.getName()
Returns the name of this table source.Returns the schema name of this table source.final TransactionSystem
Returns the TransactionSystem for this table.Returns the TableName of this table source.protected void
Loads the internal variables.protected static String
makeTableFileName
(TransactionSystem system, int table_id, TableName table_name) Creates a unique table name to give a file.protected TableDataSource
minimalTableDataSource
(IntegerListInterface master_index) Creates a minimal TableDataSource object that represents this MasterTableDataSource.protected void
Sets up the DataIndexSetDef object from the information set in this object.protected void
setupDataTableDef
(DataTableDef table_def) Sets up the DataTableDef.protected com.mckoi.database.StoreSystem
Returns the StoreSystem object used to manage stores in the persistence system.toString()
For diagnostic.
-
Field Details
-
table_id
protected int table_idAn integer that uniquely identifies this data source within the conglomerate. -
is_closed
protected boolean is_closedTrue if this table source is closed. -
table_def
A DataTableDef object that describes the table topology. This includes the name and columns of the table. -
index_def
A DataIndexSetDef object that describes the indexes on the table. -
table_indices
protected com.mckoi.database.MultiVersionTableIndices table_indicesA multi-version representation of the table indices kept for this table including the row list and the scheme indices. This contains the transaction journals. -
column_rid_list
protected com.mckoi.database.RIDList[] column_rid_listThe list of RIDList objects for each column in this table. This is a sorting optimization. -
DATA_CELL_CACHING
protected boolean DATA_CELL_CACHINGSet to false to disable cell caching. -
cache
protected final com.mckoi.database.DataCellCache cacheA reference to the DataCellCache object. -
column_count
protected int column_countThe number of columns in this table. This is a cached optimization. -
garbage_collector
protected com.mckoi.database.MasterTableGarbageCollector garbage_collectorManages scanning and deleting of rows marked as deleted within this data source. -
blob_store_interface
An abstracted reference to a BlobStore for managing blob references and blob data. -
root_lock_key
The keys we use for Database.stats() for information for this table. -
total_hits_key
-
file_hits_key
-
delete_hits_key
-
insert_hits_key
-
-
Constructor Details
-
V1MasterTableDataSource
public V1MasterTableDataSource(TransactionSystem system, com.mckoi.database.StoreSystem store_system, com.mckoi.database.OpenTransactionList open_transactions) The Constructor.
-
-
Method Details
-
checkAndRepair
Performs a complete check and repair of the table. The table must not have been opened before this method is called. The given UserTerminal parameter is an implementation of a user interface that is used to ask any questions and output the results of the check.- Throws:
IOException
-
checkForCleanup
public void checkForCleanup() -
toString
For diagnostic. -
getSystem
Returns the TransactionSystem for this table. -
Debug
Returns the DebugLogger object that can be used to log debug messages. -
getTableName
Returns the TableName of this table source. -
getName
Returns the name of this table source. -
getSchema
Returns the schema name of this table source. -
makeTableFileName
protected static String makeTableFileName(TransactionSystem system, int table_id, TableName table_name) Creates a unique table name to give a file. This could be changed to suit a particular OS's style of filesystem namespace. Or it could return some arbitarily unique number. However, for debugging purposes it's often a good idea to return a name that a user can recognise.The 'table_id' is a guarenteed unique number between all tables.
-
minimalTableDataSource
Creates a minimal TableDataSource object that represents this MasterTableDataSource. It does not implement the 'getColumnScheme' method. -
setupDataIndexSetDef
protected void setupDataIndexSetDef()Sets up the DataIndexSetDef object from the information set in this object. This will only setup a default IndexSetDef on the information in the DataTableDef. -
setupDataTableDef
Sets up the DataTableDef. This would typically only ever be called from the 'create' method. -
loadInternal
protected void loadInternal()Loads the internal variables. -
storeSystem
protected com.mckoi.database.StoreSystem storeSystem()Returns the StoreSystem object used to manage stores in the persistence system. -
doOpeningScan
This is called by the 'open' method. It performs a scan of the records and marks any rows that are uncommitted as deleted. It also checks that the row is not within the master index.- Throws:
IOException
-
clearAllRootLocks
protected void clearAllRootLocks()Clears all root locks on the table. Should only be used during cleanup of the table and will by definition invalidate the table.
-