| java.lang.Object com.quadcap.sql.file.BlockStore
All known Subclasses: com.quadcap.sql.file.MemoryBlockStore, com.quadcap.sql.file.EncryptedBlockStore, com.quadcap.sql.file.NullStore,
BlockStore | public class BlockStore (Code) | | Below the cache, this class handles the actual I/O to the underlying file.
Block write operations are logged by this class.
author: Stan Bailes |
Constructor Summary | |
public | BlockStore() Create a new BlockStore object using the specified file and
blocksize. |
Method Summary | |
public int | blockSize() Return the block size of this store. | public void | clearModified() | public void | close() | public void | flush() | public File | getFile() | public Log | getLog() | public String | getName() | public void | init(File file, String mode, int blockSize, Object lock) | public boolean | isEncrypted() | final protected byte[] | newHeader(int blockSize, long lastBlock) | public void | read(long blockNum, byte[] buf) Read a block into a buffer. | public void | read(long blockNum, byte[] buf, int off) | public void | restore(long blockNum, byte[] buf, int off) | public static String | rw() | public void | setKey(com.quadcap.crypto.SymmetricKey key) | public void | setLength(long length) | public void | setLog(Log log) Specify the log used for recovery operations. | public String | toString() | public void | write(long blockNum, byte[] buf) Write a block from a buffer into the file. |
encrypted | boolean encrypted(Code) | | |
isTempFile | boolean isTempFile(Code) | | |
readCount | public static int readCount(Code) | | |
readOnly | boolean readOnly(Code) | | |
writeCount | public static int writeCount(Code) | | |
BlockStore | public BlockStore()(Code) | | Create a new BlockStore object using the specified file and
blocksize.
Parameters: file - the underlying file. Parameters: mode - "r" for readonly access, otherwise "rw" Parameters: blocksize - the block size to use when creating the file. Parameters: the - synchronization object |
blockSize | public int blockSize()(Code) | | Return the block size of this store.
|
getFile | public File getFile()(Code) | | Return the underlying file
|
getLog | public Log getLog()(Code) | | Return the logger
|
isEncrypted | public boolean isEncrypted()(Code) | | |
newHeader | final protected byte[] newHeader(int blockSize, long lastBlock)(Code) | | |
read | public void read(long blockNum, byte[] buf) throws IOException(Code) | | Read a block into a buffer. If the specified block is beyond the
current end of file, then grow the file
Parameters: blockNum - the number of the block to read. Parameters: buf - the buffer into which the data is read. |
restore | public void restore(long blockNum, byte[] buf, int off) throws IOException(Code) | | Restore a block image
|
setLog | public void setLog(Log log)(Code) | | Specify the log used for recovery operations.
|
write | public void write(long blockNum, byte[] buf) throws IOException(Code) | | Write a block from a buffer into the file.
Parameters: blockNum - the number of the block to write. Parameters: buf - the buffer from which the data is written. exception: IOException - if an I/O error occurs. |
|
|