![]() |
Quadcap Embeddable Database |
Definition at line 81 of file Datafile.java.
Public Member Functions | |
| abstract void | maybeBackup () throws IOException |
| abstract void | readRoot () throws IOException |
| abstract void | createRoot (String fileName, Properties props) throws IOException |
| abstract void | flushRoot () throws IOException |
| abstract long | getNextTransId () throws IOException |
| abstract void | bootFromRoot (boolean restart) throws IOException |
| Datafile () | |
| Construct a new Datafile object, from the specified filename and mode. | |
| void | init (String url, String fileName, Properties props) throws IOException |
| void | initMemoryDatabase (String url, String fileName, Properties props) throws IOException |
| void | initFileDatabase (String url, String fileName, Properties props) throws IOException |
| BlockFile | getFile () |
| Accessor for my underlying file. | |
| String | getURL () |
| Return the JDBC URL used to connect to this database. | |
| LockManager | getLockManager () |
| Accessor for the datbase's lock manager. | |
| Object | getFileLock () |
| Accessor for file lock. | |
| boolean | isReadOnly () |
| Is db read only? | |
| Object | getObject (long ref) throws IOException |
| Return the specified persistent object from the store. | |
| long | putObject (Object obj) throws IOException |
| Write a new object to the store and return its reference. | |
| void | updateObject (long seg, Object obj) throws IOException |
| Write a new version of a persistent object to the store. | |
| void | removeObject (long ref) throws IOException |
| Remove an object from the store. | |
| BlockFile | getTempFile () throws IOException |
| The temporary file can be used for storage of non-transactionally-secure data. | |
| BlockFile | getTempFile (boolean incr) throws IOException |
| void | releaseTempFile () |
| void | close () |
| Close the database. | |
| final Transaction | makeTransaction (boolean writeLog) throws IOException |
| Helper to create a new transaction, and optionally to write the BEGIN_TRANSACTION log entry. | |
| void | commitTransaction (Transaction trans) throws IOException |
| Commit the transaction. | |
| void | rollbackTransaction (Transaction trans) throws IOException |
| Rollback the transaction. | |
| void | rollbackStatement (Transaction trans, int stmtId) throws IOException |
| Rollback the specified statement. | |
| void | releaseLocks (Transaction trans) |
| Remove the transaction for the given connection from the 'active transactions' table. | |
| Transaction | findTransaction (long transId) throws IOException |
| Find the specified transaction. | |
| final Log | getLog () |
| Return the log for this database. | |
| void | finalize () throws Throwable |
| If we get finalized, and haven't closed yet, then we should try. | |
| long | getSize () |
| Return the total size of the datafile, in bytes. | |
| void | checkpoint (boolean truncate, boolean fastSync) throws IOException |
| Reset the temp file (on checkpoint). | |
| void | checkpointHandler (LongMap activeTransactions) throws IOException |
| String | toString () |
| Return a displayable representation for debugging purposes. | |
| void | doStep (Transaction t, LogEntry e) throws IOException, DatafileException |
| boolean | inRecovery () throws IOException |
Static Public Attributes | |
| boolean | isCaseSensitive |
Protected Attributes | |
| boolean | inMemory = false |
| DatafileRoot | root |
| String | origFileName |
| BlockFile | file |
| BlockFile | tempFile |
| boolean | readOnly = false |
| byte[] | temp = new byte[256] |
| Object | fileLock = new Object() |
Package Functions | |
| File | getDbRootDir () |
| Return a File representing the database root directory. | |
| File | getScratchDir () |
| Return a File representing the database scratch/temp root directory. | |
| final void | makeTempDirectory (Properties props) throws IOException |
| Hook which allows the scratch files to be written to a separate directory. | |
| void | clearTempFile () |
| When nothing is happening, get rid of this guy. | |
Static Package Functions | |
| [static initializer] | |
Package Attributes | |
| String | fileName |
| File | dbRootDir |
| File | tempDir |
| String | url |
| Log | log |
| LockManager | locks = null |
| Properties | props |
| int | blockSize = BLOCK_SIZE |
| final ConfigNumber | cacheSize |
| int | CACHE_SIZE |
| final ConfigNumber | scratchCacheSize |
| int | SCRATCH_CACHE_SIZE |
| final ConfigString | defaultMode = ConfigString.find("qed.defaultMode", "rw") |
Static Package Attributes | |
| final int | MIN_CACHE = 32 |
| Minimum cache size: 256K, with 8K blocks. | |
| final int | GOOD_CACHE = 256 |
| Reasonable cache size: 4MB (8K blocks). | |
| final int | SCRATCH_CACHE_DEFAULT = 64 |
| Reasonable scratch cache default. | |
| final int | BLOCK_SIZE = ConfigNumber.find("qed.blockSize", Integer.toString(8192)).intValue() |
| final ConfigString | caseSensitive = ConfigString.find("qed.isCaseSensitive", "true") |
Private Member Functions | |
| final void | deleteHalfBakedDir () |
Private Attributes | |
| FileChannel | lockChannel = null |
| True if we've locked the lockfile. | |
| FileLock | lockLock = null |
| int | tempFileRefCount = 0 |
|
|
Construct a new Datafile object, from the specified filename and mode.
Definition at line 239 of file Datafile.java. |
|
|
|
|
|
Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.initMemoryDatabase(). |
|
||||||||||||
|
Reset the temp file (on checkpoint).
Definition at line 845 of file Datafile.java. References com.quadcap.sql.file.Datafile.checkpoint(), com.quadcap.sql.file.Datafile.fileLock, com.quadcap.sql.file.BlockFile.flush(), and com.quadcap.sql.file.Datafile.tempFile. Referenced by com.quadcap.sql.file.Datafile.checkpoint(), and com.quadcap.sql.file.Log1.reallyCheckpoint(). |
|
|
Definition at line 855 of file Datafile.java. References com.quadcap.sql.file.Datafile.checkpointHandler(). Referenced by com.quadcap.sql.file.Datafile.checkpointHandler(), and com.quadcap.sql.file.Log1.reallyCheckpoint(). |
|
|
When nothing is happening, get rid of this guy. Who needs him, eh? Definition at line 686 of file Datafile.java. References com.quadcap.sql.file.BlockFile.close(), com.quadcap.sql.file.Datafile.dbRootDir, com.quadcap.sql.file.Datafile.inMemory, and com.quadcap.sql.file.Datafile.tempFile. Referenced by com.quadcap.sql.file.Datafile.close(), and com.quadcap.sql.file.Datafile.releaseTempFile(). |
|
|
Close the database. Sync and close the physical file(s), delete the tempfile(s) and lockfile. Kill the database reference monitor thread. Definition at line 711 of file Datafile.java. References com.quadcap.sql.file.Log.checkpoint(), com.quadcap.sql.file.Datafile.clearTempFile(), com.quadcap.sql.file.BlockFile.close(), com.quadcap.sql.file.Log.close(), com.quadcap.sql.file.Datafile.dbRootDir, com.quadcap.sql.file.Datafile.file, com.quadcap.sql.file.Datafile.lockChannel, com.quadcap.sql.file.Datafile.lockLock, com.quadcap.sql.file.Datafile.log, com.quadcap.sql.file.Log.remove(), and com.quadcap.sql.file.Log.sync(). Referenced by com.quadcap.sql.file.Datafile.finalize(). |
|
|
Commit the transaction.
Definition at line 780 of file Datafile.java. References com.quadcap.sql.file.Log.addEntry(), com.quadcap.sql.file.Datafile.commitTransaction(), com.quadcap.sql.file.Log.flushLog(), com.quadcap.sql.lock.Transaction.getTransactionId(), com.quadcap.sql.file.Datafile.log, and com.quadcap.sql.file.Datafile.releaseLocks(). Referenced by com.quadcap.sql.file.Datafile.commitTransaction(). |
|
||||||||||||
|
Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.initMemoryDatabase(). |
|
|
Definition at line 528 of file Datafile.java. References com.quadcap.sql.file.Datafile.dbRootDir. Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(). |
|
||||||||||||
|
Definition at line 873 of file Datafile.java. References com.quadcap.sql.file.Log.addEntry(), com.quadcap.sql.file.Datafile.doStep(), and com.quadcap.sql.file.Datafile.log. Referenced by com.quadcap.sql.file.Datafile.doStep(). |
|
|
If we get finalized, and haven't closed yet, then we should try.
Definition at line 830 of file Datafile.java. References com.quadcap.sql.file.Datafile.close(). |
|
|
Find the specified transaction.
Definition at line 817 of file Datafile.java. References com.quadcap.sql.file.Datafile.findTransaction(), and com.quadcap.sql.file.Datafile.locks. Referenced by com.quadcap.sql.file.Log1.abortOldestTransaction(), and com.quadcap.sql.file.Datafile.findTransaction(). |
|
|
Referenced by com.quadcap.sql.file.Log1.reallyCheckpoint(). |
|
|
Return a File representing the database root directory.
Definition at line 546 of file Datafile.java. References com.quadcap.sql.file.Datafile.dbRootDir. Referenced by com.quadcap.sql.file.Log0.getDbRootDir(), and com.quadcap.sql.file.Logger1.init(). |
|
|
Accessor for my underlying file.
Definition at line 536 of file Datafile.java. References com.quadcap.sql.file.Datafile.file. Referenced by com.quadcap.sql.types.ValueBlob.getRandomAccess(), com.quadcap.sql.types.ValueBlob.init(), and com.quadcap.sql.types.ValueBlob.passivate(). |
|
|
Accessor for file lock.
Definition at line 561 of file Datafile.java. References com.quadcap.sql.file.Datafile.fileLock. Referenced by com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.file.Log1.init(), and com.quadcap.sql.types.ValueBlob.passivate(). |
|
|
Accessor for the datbase's lock manager.
Definition at line 556 of file Datafile.java. References com.quadcap.sql.file.Datafile.locks. |
|
|
Return the log for this database.
Definition at line 825 of file Datafile.java. References com.quadcap.sql.file.Datafile.log. |
|
|
Referenced by com.quadcap.sql.file.Datafile.makeTransaction(). |
|
|
Return the specified persistent object from the store.
Definition at line 574 of file Datafile.java. References com.quadcap.sql.file.Datafile.file, com.quadcap.sql.file.BlockFile.getObject(), and com.quadcap.sql.file.Datafile.getObject(). Referenced by com.quadcap.sql.file.Datafile.getObject(). |
|
|
Return a File representing the database scratch/temp root directory.
Definition at line 551 of file Datafile.java. References com.quadcap.sql.file.Datafile.tempDir. Referenced by com.quadcap.sql.file.Log1.resetBlocks(), and com.quadcap.sql.file.Log1.restoreBlocks(). |
|
|
Return the total size of the datafile, in bytes.
Definition at line 838 of file Datafile.java. References com.quadcap.sql.file.Datafile.file, and com.quadcap.sql.file.BlockFile.getSize(). |
|
|
|
The temporary file can be used for storage of non-transactionally-secure data.
Definition at line 645 of file Datafile.java. Referenced by com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.passivate(), and com.quadcap.sql.file.Log1.reallyRestart(). |
|
|
Return the JDBC URL used to connect to this database.
Definition at line 541 of file Datafile.java. References com.quadcap.sql.file.Datafile.url. |
|
||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
|
Definition at line 880 of file Datafile.java. References com.quadcap.sql.file.Log.inRecovery(), and com.quadcap.sql.file.Datafile.log. |
|
|
Is db read only?
Definition at line 566 of file Datafile.java. References com.quadcap.sql.file.Datafile.readOnly. |
|
|
Hook which allows the scratch files to be written to a separate directory. Useful when you want to mount the data files read only Definition at line 615 of file Datafile.java. References com.quadcap.sql.file.Datafile.dbRootDir, com.quadcap.sql.file.Datafile.inMemory, com.quadcap.sql.file.Datafile.makeTempDirectory(), com.quadcap.sql.file.Datafile.props, and com.quadcap.sql.file.Datafile.tempDir. Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.makeTempDirectory(). |
|
|
Helper to create a new transaction, and optionally to write the BEGIN_TRANSACTION log entry.
Definition at line 761 of file Datafile.java. References com.quadcap.sql.file.Log.addEntry(), com.quadcap.sql.file.Datafile.fileLock, com.quadcap.sql.file.Datafile.getNextTransId(), com.quadcap.sql.file.Datafile.locks, com.quadcap.sql.file.Datafile.log, and com.quadcap.sql.file.Datafile.makeTransaction(). Referenced by com.quadcap.sql.file.Datafile.makeTransaction(), and com.quadcap.sql.file.Log1.reallyRestart(). |
|
|
|
|
|
Write a new object to the store and return its reference.
Definition at line 585 of file Datafile.java. References com.quadcap.sql.file.Datafile.file, com.quadcap.sql.file.BlockFile.putObject(), and com.quadcap.sql.file.Datafile.putObject(). Referenced by com.quadcap.sql.file.Datafile.putObject(). |
|
|
Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(). |
|
|
Remove the transaction for the given connection from the 'active transactions' table. Flush the log? Definition at line 810 of file Datafile.java. References com.quadcap.sql.file.Datafile.locks, and com.quadcap.sql.file.Datafile.releaseLocks(). Referenced by com.quadcap.sql.file.Datafile.commitTransaction(), and com.quadcap.sql.file.Datafile.releaseLocks(). |
|
|
Definition at line 672 of file Datafile.java. References com.quadcap.sql.file.Datafile.clearTempFile(), com.quadcap.sql.file.Datafile.fileLock, and com.quadcap.sql.file.Datafile.tempFileRefCount. |
|
|
Remove an object from the store.
Definition at line 606 of file Datafile.java. References com.quadcap.sql.file.Datafile.file, com.quadcap.sql.file.BlockFile.removeObject(), and com.quadcap.sql.file.Datafile.removeObject(). Referenced by com.quadcap.sql.file.Datafile.removeObject(). |
|
||||||||||||
|
Rollback the specified statement.
Definition at line 800 of file Datafile.java. References com.quadcap.sql.file.Datafile.log, com.quadcap.sql.file.Log.rollbackStatement(), and com.quadcap.sql.file.Datafile.rollbackStatement(). Referenced by com.quadcap.sql.file.Datafile.rollbackStatement(). |
|
|
Rollback the transaction.
Definition at line 790 of file Datafile.java. References com.quadcap.sql.file.Datafile.log, com.quadcap.sql.file.Log.rollbackTransaction(), and com.quadcap.sql.file.Datafile.rollbackTransaction(). Referenced by com.quadcap.sql.file.Datafile.rollbackTransaction(). |
|
|
Return a displayable representation for debugging purposes.
Definition at line 864 of file Datafile.java. References com.quadcap.sql.file.Datafile.url. Referenced by com.quadcap.sql.file.Log1.resetBlocks(), and com.quadcap.sql.file.Log1.restoreBlocks(). |
|
||||||||||||
|
Write a new version of a persistent object to the store.
Definition at line 596 of file Datafile.java. References com.quadcap.sql.file.Datafile.file, com.quadcap.sql.file.BlockFile.updateObject(), and com.quadcap.sql.file.Datafile.updateObject(). Referenced by com.quadcap.sql.file.Datafile.updateObject(). |
|
|
Definition at line 161 of file Datafile.java. |
|
|
Definition at line 162 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.getTempFile(), com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.initMemoryDatabase(). |
|
|
Initial value:
Definition at line 178 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.initMemoryDatabase(). |
|
|
Initial value:
Definition at line 176 of file Datafile.java. |
|
|
Definition at line 219 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.initMemoryDatabase(). |
|
|
|
Definition at line 207 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(). |
|
|
|
|
Definition at line 83 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.getTempFile(), com.quadcap.sql.file.Datafile.init(), com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.initMemoryDatabase(). |
|
|
Reasonable cache size: 4MB (8K blocks). This cache size should support a moderate load; 8-10 busy threads... Definition at line 146 of file Datafile.java. |
|
|
Definition at line 82 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.clearTempFile(), com.quadcap.sql.file.Datafile.getTempFile(), com.quadcap.sql.file.Datafile.init(), and com.quadcap.sql.file.Datafile.makeTempDirectory(). |
|
|
Initial value:
Definition at line 222 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(), and com.quadcap.sql.file.Datafile.initMemoryDatabase(). |
|
|
True if we've locked the lockfile.
Definition at line 114 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.close(), and com.quadcap.sql.file.Datafile.initFileDatabase(). |
|
|
Definition at line 115 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.close(), and com.quadcap.sql.file.Datafile.initFileDatabase(). |
|
|
Definition at line 102 of file Datafile.java. Referenced by com.quadcap.sql.file.Datafile.findTransaction(), com.quadcap.sql.file.Datafile.getLockManager(), com.quadcap.sql.file.Datafile.makeTransaction(), and com.quadcap.sql.file.Datafile.releaseLocks(). |
|
|
|
Minimum cache size: 256K, with 8K blocks. The minimum is dependent on various factors, including query type (joins need more cache, for example) and concurrency level. Simple applications which are primarily single threaded will be able to get by with 32 blocks or so. Definition at line 140 of file Datafile.java. |
|
|
Definition at line 89 of file Datafile.java. |
|