Class TableDataConglomerate
- Author:
- Tobias Downer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TableName
static final TableName
static final TableName
static final TableName
static final TableName
static final TableName
static final TableName
The schema info table.static final String
The postfix on the name of the state file for the database store name.static final TableName
static final TableName
static final String
The name of the system schema where persistant conglomerate state is stored.static final TableName
static final TableName
-
Constructor Summary
ConstructorsConstructorDescriptionTableDataConglomerate
(TransactionSystem system, com.mckoi.database.StoreSystem store_system) Constructs the conglomerate. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTransactionModificationListener
(TableName table_name, TransactionModificationListener listener) Adds a listener for transactional modification events that occur on the given table in this conglomerate.void
checkVisibleTables
(UserTerminal terminal) Checks the list of committed tables in this conglomerate.void
close()
Closes this conglomerate.void
Creates a new conglomerate at the given path in the file system.Starts a new transaction.final DebugLogger
Debug()
Returns the DebugLogger object that we use to log debug messages to.void
delete()
Deletes and closes the conglomerate.boolean
Returns true if the conglomerate exists in the file system and can be opened.void
finalize()
void
fix
(String name, UserTerminal terminal) Checks the conglomerate state file.String[]
Returns the list of file names for all tables in this conglomerate.getDiagnosticTable
(String table_file_name) Returns a RawDiagnosticTable object that is used for diagnostics of the table with the given file name.final TransactionSystem
Returns the TransactionSystem that this conglomerate is part of.boolean
isClosed()
Returns true if the conglomerate is closed.void
liveCopyTo
(TableDataConglomerate dest_conglomerate) Makes a complete copy of this database to the position represented by the given TableDataConglomerate object.void
Opens a conglomerate.void
removeTransactionModificationListener
(TableName table_name, TransactionModificationListener listener) Removes a listener for transaction modification events on the given table in this conglomerate as previously set by the 'addTransactionModificationListener' method.final com.mckoi.database.StoreSystem
Returns the StoreSystem used by this conglomerate to manage the persistent state of the database.
-
Field Details
-
STATE_POST
The postfix on the name of the state file for the database store name.- See Also:
-
SYSTEM_SCHEMA
The name of the system schema where persistant conglomerate state is stored.- See Also:
-
SCHEMA_INFO_TABLE
The schema info table. -
PERSISTENT_VAR_TABLE
-
FOREIGN_COLS_TABLE
-
UNIQUE_COLS_TABLE
-
PRIMARY_COLS_TABLE
-
CHECK_INFO_TABLE
-
UNIQUE_INFO_TABLE
-
FOREIGN_INFO_TABLE
-
PRIMARY_INFO_TABLE
-
SYS_SEQUENCE_INFO
-
SYS_SEQUENCE
-
-
Constructor Details
-
TableDataConglomerate
Constructs the conglomerate.
-
-
Method Details
-
getSystem
Returns the TransactionSystem that this conglomerate is part of. -
storeSystem
public final com.mckoi.database.StoreSystem storeSystem()Returns the StoreSystem used by this conglomerate to manage the persistent state of the database. -
Debug
Returns the DebugLogger object that we use to log debug messages to. -
checkVisibleTables
Checks the list of committed tables in this conglomerate. This should only be called during an 'check' like method. This method fills the 'committed_tables' and 'table_list' lists with the tables in this conglomerate.- Throws:
IOException
-
create
Creates a new conglomerate at the given path in the file system. This must be an empty directory where files can be stored. This will create the conglomerate and exit in an open (read/write) state.- Throws:
IOException
-
open
Opens a conglomerate. If the conglomerate does not exist then an IOException is generated. Once a conglomerate is open, we may start opening transactions and altering the data within it.- Throws:
IOException
-
close
Closes this conglomerate. The conglomerate must be open for it to be closed. When closed, any use of this object is undefined.- Throws:
IOException
-
delete
Deletes and closes the conglomerate. This will delete all the files in the file system associated with this conglomerate, so this method should be used with care.WARNING: Will result in total loss of all data stored in the conglomerate.
- Throws:
IOException
-
isClosed
public boolean isClosed()Returns true if the conglomerate is closed. -
exists
Returns true if the conglomerate exists in the file system and can be opened.- Throws:
IOException
-
liveCopyTo
Makes a complete copy of this database to the position represented by the given TableDataConglomerate object. The given TableDataConglomerate object must NOT be being used by another database running in the JVM. This may take a while to complete. The backup operation occurs within its own transaction and the copy transaction is read-only meaning there is no way for the copy process to interfere with other transactions running concurrently.The conglomerate must be open before this method is called.
- Throws:
IOException
-
getDiagnosticTable
Returns a RawDiagnosticTable object that is used for diagnostics of the table with the given file name. -
getAllTableFileNames
Returns the list of file names for all tables in this conglomerate. -
addTransactionModificationListener
public void addTransactionModificationListener(TableName table_name, TransactionModificationListener listener) Adds a listener for transactional modification events that occur on the given table in this conglomerate. A transactional modification event is an event fired immediately upon the modification of a table by a transaction, either immediately before the modification or immediately after. Also an event is fired when a modification to a table is successfully committed.The BEFORE_* type triggers are given the opportunity to modify the contents of the RowData before the update or insert occurs. All triggers may generate an exception which will cause the transaction to rollback.
The event carries with it the event type, the transaction that the event occurred in, and any information regarding the modification itself.
This event/listener mechanism is intended to be used to implement higher layer database triggering systems. Note that care must be taken with the commit level events because they occur inside a commit lock on this conglomerate and so synchronization and deadlock issues need to be carefully considered.
NOTE: A listener on the given table will be notified of ALL table modification events by all transactions at the time they happen.
- Parameters:
table_name
- the name of the table in the conglomerate to listen for events from.listener
- the listener to be notified of events.
-
removeTransactionModificationListener
public void removeTransactionModificationListener(TableName table_name, TransactionModificationListener listener) Removes a listener for transaction modification events on the given table in this conglomerate as previously set by the 'addTransactionModificationListener' method.- Parameters:
table_name
- the name of the table in the conglomerate to remove from the listener list.listener
- the listener to be removed.
-
createTransaction
Starts a new transaction. The Transaction object returned by this method is used to read the contents of the database at the time the transaction was started. It is also used if any modifications are required to be made. -
fix
Checks the conglomerate state file. The returned ErrorState object contains information about any error generated. -
finalize
public void finalize()
-