public final class RecordFile
extends java.lang.Object
The set of dirty records on the in-use list constitutes a transaction. Later on, we will send these records to some recovery thingy.
Modifier and Type | Field and Description |
---|---|
static int |
BLOCK_SIZE
The length of a single block.
|
(package private) static byte[] |
cleanData
A block of clean data to wipe clean pages.
|
(package private) static java.lang.String |
extension
The extension of a record file
|
(package private) TransactionManager |
txnMgr |
Constructor and Description |
---|
RecordFile(java.lang.String fileName)
Creates a new object on the indicated filename.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
close()
Commits and closes file.
|
(package private) void |
commit()
Commits the current transaction by flushing all dirty buffers
to disk.
|
(package private) void |
disableTransactions()
Disables transactions: doesn't sync and doesn't use the
transaction manager.
|
(package private) void |
discard(BlockIo block)
Discards a block (will not write the block even if it's dirty)
|
(package private) void |
forceClose()
Force closing the file and underlying transaction manager.
|
(package private) BlockIo |
get(long blockid)
Gets a block from the file.
|
(package private) java.lang.String |
getFileName()
Returns the file name.
|
(package private) void |
release(BlockIo block)
Releases a block.
|
(package private) void |
release(long blockid,
boolean isDirty)
Releases a block.
|
(package private) void |
releaseFromTransaction(BlockIo node,
boolean recycle)
Releases a node from the transaction list, if it was sitting
there.
|
(package private) void |
rollback()
Rollback the current transaction by discarding all dirty buffers
|
(package private) void |
sync()
Synchronizes the file.
|
(package private) void |
synch(BlockIo node)
Synchs a node to disk.
|
final TransactionManager txnMgr
public static final int BLOCK_SIZE
static final java.lang.String extension
static final byte[] cleanData
RecordFile(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the file to open or create, without
an extension.java.io.IOException
- whenever the creation of the underlying
RandomAccessFile throws it.java.lang.String getFileName()
void disableTransactions()
BlockIo get(long blockid) throws java.io.IOException
blockid
- The record number to retrieve.java.io.IOException
void release(long blockid, boolean isDirty) throws java.io.IOException
blockid
- The record number to release.isDirty
- If true, the block was modified since the get().java.io.IOException
void release(BlockIo block)
block
- The block to release.void discard(BlockIo block)
block
- The block to discard.void commit() throws java.io.IOException
java.io.IOException
void rollback() throws java.io.IOException
java.io.IOException
void close() throws java.io.IOException
java.io.IOException
void forceClose() throws java.io.IOException
java.io.IOException
void synch(BlockIo node) throws java.io.IOException
java.io.IOException
void releaseFromTransaction(BlockIo node, boolean recycle) throws java.io.IOException
recycle
- true if block data can be reusedjava.io.IOException
void sync() throws java.io.IOException
java.io.IOException
Cees de Groot (C) 2000-2001. All rights reserved http://jdbm.sourceforge.net