Quadcap Embeddable Database

com.quadcap.sql.file.BlockFile Class Reference

Inheritance diagram for com.quadcap.sql.file.BlockFile:

com.quadcap.sql.file.PageManager com.quadcap.sql.file.SegmentManager List of all members.

Detailed Description

This class is used to create, modify, or read a blocked file.

The blocked file is accessed as a number of fixed size blocks, which are accessed through a cache of a size specified by the class user.

Author:
Stan Bailes

Definition at line 75 of file BlockFile.java.

Public Member Functions

 BlockFile (String filename, String mode, Properties props, int blocksize, int cacheSize) throws IOException
 Create a new BlockFile, attached to the specified file.

String signature () throws IOException
long getUserBlock (int stream) throws IOException
void close () throws IOException
 Flush the cache and close the underlying file.

final void flush (boolean fastSync) throws IOException
String getName ()
void setLog (Log log)
Page getPage (long i) throws IOException
 Locate the specified block and return the cache entry associated with that block.

Block getBlock (long i) throws IOException
void restoreBlock (long b, byte[] buf, int off) throws IOException
final int getPageSize ()
 Return the block size used in this file.

RandomAccess getStream (long blockRef) throws IOException
 Return a RandomAccess object which references the specified block.

long newPage () throws IOException
 Return the head of the free list, or grow the tail of the file.

void freePage (long ref) throws IOException
 Add this block to the free list.

long putBytes (byte[] buf) throws IOException
 Create a new segment with the specified bytes value and return its reference.

byte[] getBytes (long seg) throws IOException
 Return the segment as a byte array.

void updateBytes (long seg, byte[] buf) throws IOException
 Update a segment with new value bytes.

void freeStream (long page) throws IOException
 Destroy the stream with the specified root page and free up the storage it was using.

void freeSegment (long seg) throws IOException
 Destroy the stream with the specified root segment and free up the 7 * storage it was using.

RandomAccessInputStream getInputStream (long block) throws IOException
 Return a new input stream, reading from the region with the specified root block.

RandomAccessOutputStream getOutputStream (long block) throws IOException
 Return a new output stream, writing to the region with the specified root block.

PageManager getPageManager (int i) throws IOException
 Return the specified sub-page manager.

PageManager getPageManagerForPage (long page) throws IOException
PageManager getPageManagerForLen (long len) throws IOException
void revert () throws IOException
void showCache (PrintWriter os)
String toString ()
void clearModified () throws IOException
long getSize ()
Object getLock ()
 Return the file lock.

int getBlockSize ()
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.

void dump () throws IOException

Static Public Member Functions

void main (String[] args)

Protected Member Functions

BlockStore makeStore (Properties props, String filename, int blockSize, String mode) throws IOException

Package Functions

Log getLog ()
final void ensureLastBlock (long i) throws IOException

Static Package Functions

int getPageOffset (PageManager pm, long ref)
long getPageBlock (long ref)

Package Attributes

BlockStore store
 The underlying store used by the cache to access the file.

BlockCache cache
 The cache of file blocks.

LongMap memoryObjects = null
 For main-memory mode, our objects.

long memObjectCount = 100000
boolean inMemory
int maxPageShift = 0
int blockSize
long lastBlock = 0
 Cached copy of largest allocated block number.

boolean readOnly
PageManager[] pageManagers = new PageManager[MAX_PAGESHIFT]
Object fileLock = new Object()
MutableByteArrayInputStream mbis = new MutableByteArrayInputStream()
ObjectInputStream ois = new ObjectInputStream(mbis)
ByteArrayOutputStream bos = new ByteArrayOutputStream()
ObjectOutputStream oos
BlockAccess ba = new BlockAccess()

Static Package Attributes

final int REF_SIZE = 8
final int MIN_SUBPAGE = 64
final int MAX_PAGESHIFT = 16
final int oBLOCKSIZE = 4
final int oFREELIST = 8
final int oLASTBLOCK = 16
final int oSTREAM_START = 24
final int MAX_STREAM = 4
final int oHASH_PASSWD_start = oSTREAM_START + (REF_SIZE * MAX_STREAM)
final int oHASH_PASSWD_len = 20
final int oSUBPAGE_ROOT = oHASH_PASSWD_start + oHASH_PASSWD_len
final int oHEADER_SIZE
final boolean quick = true

Private Member Functions

boolean isEncrypted (File f) throws IOException


Constructor & Destructor Documentation

com.quadcap.sql.file.BlockFile.BlockFile String  filename,
String  mode,
Properties  props,
int  blocksize,
int  cacheSize
throws IOException
 

Create a new BlockFile, attached to the specified file.

For an existing BlockFile, use the blocksize with which the file was created -- for a new file, use the specified blocksize.

Parameters:
filename the file to operate on.
blockSize the block size to use if we're creating a new file.
mode "r" (read only) or "rw" (read-write) access.

Definition at line 147 of file BlockFile.java.

References com.quadcap.sql.file.BlockStore.blockSize, com.quadcap.sql.file.BlockFile.bos, com.quadcap.sql.file.BlockFile.cache, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.getBlock(), com.quadcap.sql.file.Cache.init(), com.quadcap.sql.file.BlockFile.inMemory, com.quadcap.sql.file.BlockFile.makeStore(), com.quadcap.sql.file.BlockFile.maxPageShift, com.quadcap.sql.file.BlockFile.MIN_SUBPAGE, com.quadcap.sql.file.BlockFile.oLASTBLOCK, com.quadcap.sql.file.BlockFile.pageManagers, com.quadcap.sql.file.Block.readLong(), com.quadcap.sql.file.BlockFile.readOnly, com.quadcap.sql.file.Cache.setLock(), com.quadcap.sql.file.Cache.setReadOnly(), and com.quadcap.sql.file.BlockFile.store.


Member Function Documentation

void com.quadcap.sql.file.BlockFile.clearModified  )  throws IOException
 

Definition at line 699 of file BlockFile.java.

References com.quadcap.sql.file.BlockStore.clearModified(), and com.quadcap.sql.file.BlockFile.store.

Referenced by com.quadcap.sql.file.Log1.reallyCheckpoint().

void com.quadcap.sql.file.BlockFile.close  )  throws IOException
 

Flush the cache and close the underlying file.

Definition at line 301 of file BlockFile.java.

References com.quadcap.sql.file.BlockStore.close(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.flush(), and com.quadcap.sql.file.BlockFile.store.

Referenced by com.quadcap.sql.file.Datafile.clearTempFile(), and com.quadcap.sql.file.Datafile.close().

void com.quadcap.sql.file.BlockFile.dump  )  throws IOException
 

Definition at line 807 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.blockSize, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.MAX_STREAM, com.quadcap.sql.file.BlockFile.oBLOCKSIZE, com.quadcap.sql.file.BlockFile.oFREELIST, com.quadcap.sql.file.BlockFile.oHASH_PASSWD_len, com.quadcap.sql.file.BlockFile.oHASH_PASSWD_start, com.quadcap.sql.file.BlockFile.oLASTBLOCK, com.quadcap.sql.file.BlockFile.oSTREAM_START, com.quadcap.sql.file.BlockFile.oSUBPAGE_ROOT, com.quadcap.sql.file.Block.read(), com.quadcap.sql.file.Block.readByte(), com.quadcap.sql.file.Block.readInt(), com.quadcap.sql.file.Block.readLong(), com.quadcap.sql.file.Block.readShort(), and com.quadcap.sql.file.BlockFile.REF_SIZE.

Referenced by com.quadcap.sql.file.BlockFile.main().

final void com.quadcap.sql.file.BlockFile.ensureLastBlock long  i  )  throws IOException [package]
 

Definition at line 368 of file BlockFile.java.

References com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.ensureLastBlock(), com.quadcap.sql.file.BlockFile.lastBlock, com.quadcap.sql.file.BlockFile.oLASTBLOCK, and com.quadcap.sql.file.Block.writeLong().

Referenced by com.quadcap.sql.file.BlockFile.ensureLastBlock(), and com.quadcap.sql.file.BlockFile.restoreBlock().

final void com.quadcap.sql.file.BlockFile.flush boolean  fastSync  )  throws IOException
 

Definition at line 308 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.cache, com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockStore.flush(), com.quadcap.sql.file.Cache.flush(), com.quadcap.sql.file.BlockFile.flush(), com.quadcap.sql.file.BlockFile.readOnly, com.quadcap.sql.file.BlockFile.store, and com.quadcap.sql.file.BlockFile.toString().

Referenced by com.quadcap.sql.file.Datafile.checkpoint(), com.quadcap.sql.file.BlockFile.close(), com.quadcap.sql.file.BlockFile.flush(), com.quadcap.sql.file.Log1.reallyCheckpoint(), and com.quadcap.sql.file.Log1.reallyFlush().

void com.quadcap.sql.file.BlockFile.freePage long  ref  )  throws IOException
 

Add this block to the free list.

Parameters:
ref the number of the now free block.

Implements com.quadcap.sql.file.PageManager.

Definition at line 448 of file BlockFile.java.

References com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.PageManager.freePage(), com.quadcap.sql.file.BlockFile.freePage(), com.quadcap.sql.file.Block.getDataAndReset(), com.quadcap.sql.file.BlockFile.getPageManagerForPage(), com.quadcap.sql.file.BlockFile.lastBlock, com.quadcap.sql.file.BlockFile.oFREELIST, com.quadcap.sql.file.Block.readLong(), com.quadcap.sql.file.BlockFile.toString(), and com.quadcap.sql.file.Block.writeLong().

Referenced by com.quadcap.sql.DeletedRows.finish(), and com.quadcap.sql.file.BlockFile.freePage().

void com.quadcap.sql.file.BlockFile.freeSegment long  seg  )  throws IOException
 

Destroy the stream with the specified root segment and free up the 7 * storage it was using.

Parameters:
segment the root segment of the region
Exceptions:
IOException if the segment number isn't valid, or if another error is detected trying to access the region.

Implements com.quadcap.sql.file.SegmentManager.

Definition at line 615 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.freeSegment().

Referenced by com.quadcap.sql.file.BlockFile.freeSegment().

void com.quadcap.sql.file.BlockFile.freeStream long  page  )  throws IOException
 

Destroy the stream with the specified root page and free up the storage it was using.

Parameters:
page the root page of the region
Exceptions:
IOException if the page number isn't valid, or if another error is detected trying to access the region.

Definition at line 609 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.freeStream(), and com.quadcap.sql.file.RandomAccess.resize().

Referenced by com.quadcap.sql.file.BlockFile.freeStream(), and com.quadcap.sql.InsertBlob.undo().

Block com.quadcap.sql.file.BlockFile.getBlock long  i  )  throws IOException
 

Definition at line 359 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getBlock().

Referenced by com.quadcap.sql.file.SubPageManager.allocateNewBlock(), com.quadcap.sql.file.BlockFile.BlockFile(), com.quadcap.sql.file.SubPageManager.freePage(), com.quadcap.sql.file.BlockFile.getBlock(), com.quadcap.sql.file.BlockFile.getUserBlock(), com.quadcap.sql.file.SubPageManager.newPage(), com.quadcap.sql.file.Log1.reallyCheckpoint(), com.quadcap.sql.file.Log1.restoreBlocks(), com.quadcap.sql.file.BlockFile.signature(), and com.quadcap.sql.file.SubPage.SubPage().

int com.quadcap.sql.file.BlockFile.getBlockSize  ) 
 

Definition at line 711 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.blockSize.

Referenced by com.quadcap.sql.file.Log1.init(), com.quadcap.sql.file.Log1.reallyCheckpoint(), and com.quadcap.sql.file.Log1.restoreBlocks().

byte [] com.quadcap.sql.file.BlockFile.getBytes long  seg  )  throws IOException
 

Return the segment as a byte array.

Parameters:
seg the segment id
Returns:
the value of the segment's bytes

Implements com.quadcap.sql.file.SegmentManager.

Definition at line 534 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.ba, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.getBytes(), com.quadcap.sql.file.BlockFile.getPageManagerForPage(), com.quadcap.sql.file.PageManager.getPageSize(), com.quadcap.sql.file.BlockAccess.init(), com.quadcap.sql.file.BlockFile.quick, com.quadcap.sql.file.BlockAccess.read(), com.quadcap.sql.file.Block.read(), com.quadcap.sql.file.Block.readLong(), and com.quadcap.sql.file.BlockAccess.size.

Referenced by com.quadcap.sql.file.BlockFile.getBytes(), com.quadcap.sql.Database.getRow(), and com.quadcap.sql.DeleteRow.prepare().

RandomAccessInputStream com.quadcap.sql.file.BlockFile.getInputStream long  block  )  throws IOException
 

Return a new input stream, reading from the region with the specified root block.

Parameters:
block the root block of the region
Returns:
an InputStream bound to the region.
Exceptions:
IOException if the block number isn't valid, or if another error is detected trying to access the region.

Implements com.quadcap.sql.file.SegmentManager.

Definition at line 628 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getInputStream().

Referenced by com.quadcap.sql.file.BlockFile.getInputStream(), and com.quadcap.sql.InsertBlob.redo().

Object com.quadcap.sql.file.BlockFile.getLock  ) 
 

Return the file lock.

Implements com.quadcap.sql.file.PageManager.

Definition at line 707 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.fileLock.

Referenced by com.quadcap.sql.file.SubPageManager.getLock().

Log com.quadcap.sql.file.BlockFile.getLog  )  [package]
 

Definition at line 332 of file BlockFile.java.

References com.quadcap.sql.file.BlockStore.getLog(), and com.quadcap.sql.file.BlockFile.store.

String com.quadcap.sql.file.BlockFile.getName  ) 
 

Definition at line 324 of file BlockFile.java.

References com.quadcap.sql.file.BlockStore.getName(), and com.quadcap.sql.file.BlockFile.store.

Referenced by com.quadcap.sql.index.BtreeCursor.id().

Object com.quadcap.sql.file.BlockFile.getObject long  ref  )  throws IOException
 

Return the specified persistent object from the store.

Parameters:
ref the block number of the object's root
Returns:
the object
Exceptions:
IOException may be thrown

Definition at line 723 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.getObject(), com.quadcap.sql.file.BlockFile.inMemory, com.quadcap.sql.file.BlockFile.mbis, com.quadcap.sql.file.BlockFile.memoryObjects, and com.quadcap.sql.file.BlockFile.ois.

Referenced by com.quadcap.sql.file.Datafile.getObject(), com.quadcap.sql.file.BlockFile.getObject(), and com.quadcap.sql.Database.getRow().

RandomAccessOutputStream com.quadcap.sql.file.BlockFile.getOutputStream long  block  )  throws IOException
 

Return a new output stream, writing to the region with the specified root block.

Parameters:
block the root block of the region
Returns:
an OutputStream bound to the region.
Exceptions:
IOException if the block number isn't valid, or if another error is detected trying to access the region.

Implements com.quadcap.sql.file.SegmentManager.

Definition at line 643 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getOutputStream().

Referenced by com.quadcap.sql.file.BlockFile.getOutputStream(), com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.types.ValueBlob.passivate(), and com.quadcap.sql.InsertBlob.redo().

Page com.quadcap.sql.file.BlockFile.getPage long  i  )  throws IOException
 

Locate the specified block and return the cache entry associated with that block.

It needs to be the case that the cache entry is "locked" while this returned object is active, so maybe the Block class needs a finalize() routine.

Parameters:
i the block number
Returns:
the cache-handle of the block.

Implements com.quadcap.sql.file.PageManager.

Definition at line 344 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.cache, com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.Cache.getCacheable(), com.quadcap.sql.file.BlockFile.getPage(), com.quadcap.sql.file.BlockFile.lastBlock, com.quadcap.sql.file.BlockFile.store, com.quadcap.sql.file.BlockStore.toString(), and com.quadcap.sql.file.BlockFile.toString().

Referenced by com.quadcap.sql.file.BlockFile.getPage().

long com.quadcap.sql.file.BlockFile.getPageBlock long  ref  )  [static, package]
 

Definition at line 485 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getPageBlock().

Referenced by com.quadcap.sql.file.BlockFile.getPageBlock().

PageManager com.quadcap.sql.file.BlockFile.getPageManager int  i  )  throws IOException
 

Return the specified sub-page manager.

Definition at line 652 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getPageManager(), com.quadcap.sql.file.BlockFile.maxPageShift, and com.quadcap.sql.file.BlockFile.pageManagers.

Referenced by com.quadcap.sql.file.BlockFile.getPageManager().

PageManager com.quadcap.sql.file.BlockFile.getPageManagerForLen long  len  )  throws IOException
 

Definition at line 667 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.blockSize, com.quadcap.sql.file.BlockFile.getPageManagerForLen(), and com.quadcap.sql.file.BlockFile.maxPageShift.

Referenced by com.quadcap.sql.file.BlockFile.getPageManagerForLen(), and com.quadcap.sql.file.BlockFile.putBytes().

PageManager com.quadcap.sql.file.BlockFile.getPageManagerForPage long  page  )  throws IOException
 

Definition at line 663 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getPageManagerForPage().

Referenced by com.quadcap.sql.file.BlockFile.freePage(), com.quadcap.sql.file.BlockFile.getBytes(), com.quadcap.sql.file.BlockFile.getPageManagerForPage(), com.quadcap.sql.file.BlockFile.getStream(), and com.quadcap.sql.file.BlockFile.updateBytes().

int com.quadcap.sql.file.BlockFile.getPageOffset PageManager  pm,
long  ref
[static, package]
 

Definition at line 479 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getPageOffset(), and com.quadcap.sql.file.PageManager.getPageSize().

Referenced by com.quadcap.sql.file.BlockFile.getPageOffset().

final int com.quadcap.sql.file.BlockFile.getPageSize  ) 
 

Return the block size used in this file.

Implements com.quadcap.sql.file.PageManager.

Definition at line 384 of file BlockFile.java.

Referenced by com.quadcap.sql.file.SubPageManager.SubPageManager().

long com.quadcap.sql.file.BlockFile.getSize  ) 
 

Definition at line 703 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.blockSize, and com.quadcap.sql.file.BlockFile.lastBlock.

Referenced by com.quadcap.sql.file.Datafile.getSize(), com.quadcap.sql.file.Log1.reallyCheckpoint(), com.quadcap.sql.file.Log1.resetBlocks(), and com.quadcap.sql.file.Log1.restoreBlocks().

RandomAccess com.quadcap.sql.file.BlockFile.getStream long  blockRef  )  throws IOException
 

Return a RandomAccess object which references the specified block.

Implements com.quadcap.sql.file.SegmentManager.

Definition at line 391 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.getPageManagerForPage(), and com.quadcap.sql.file.BlockFile.getStream().

Referenced by com.quadcap.sql.DeletedRows.addEntry(), com.quadcap.sql.types.ValueBlob.getRandomAccess(), and com.quadcap.sql.file.BlockFile.getStream().

long com.quadcap.sql.file.BlockFile.getUserBlock int  stream  )  throws IOException
 

Definition at line 277 of file BlockFile.java.

References com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.getBlock(), com.quadcap.sql.file.BlockFile.getUserBlock(), com.quadcap.sql.file.BlockFile.MAX_STREAM, com.quadcap.sql.file.BlockFile.newPage(), com.quadcap.sql.file.BlockFile.oSTREAM_START, com.quadcap.sql.file.Block.readLong(), com.quadcap.sql.file.BlockFile.REF_SIZE, and com.quadcap.sql.file.Block.writeLong().

Referenced by com.quadcap.sql.file.BlockFile.getUserBlock().

boolean com.quadcap.sql.file.BlockFile.isEncrypted File  f  )  throws IOException [private]
 

Definition at line 268 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.isEncrypted().

Referenced by com.quadcap.sql.file.BlockFile.isEncrypted(), and com.quadcap.sql.file.BlockFile.makeStore().

void com.quadcap.sql.file.BlockFile.main String[]  args  )  [static]
 

Definition at line 872 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.dump(), and com.quadcap.sql.file.BlockFile.main().

Referenced by com.quadcap.sql.file.BlockFile.main().

BlockStore com.quadcap.sql.file.BlockFile.makeStore Properties  props,
String  filename,
int  blockSize,
String  mode
throws IOException [protected]
 

Definition at line 205 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.blockSize, com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockStore.init(), com.quadcap.sql.file.BlockFile.inMemory, com.quadcap.sql.file.BlockFile.isEncrypted(), com.quadcap.sql.file.BlockFile.makeStore(), com.quadcap.sql.file.BlockFile.readOnly, and com.quadcap.sql.file.BlockStore.setKey().

Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), and com.quadcap.sql.file.BlockFile.makeStore().

long com.quadcap.sql.file.BlockFile.newPage  )  throws IOException
 

Return the head of the free list, or grow the tail of the file.

Returns:
the number of an available block.

Implements com.quadcap.sql.file.PageManager.

Definition at line 400 of file BlockFile.java.

References com.quadcap.sql.file.Block.clear(), com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.lastBlock, com.quadcap.sql.file.BlockFile.oFREELIST, com.quadcap.sql.file.BlockFile.oLASTBLOCK, com.quadcap.sql.file.Block.readLong(), com.quadcap.sql.file.BlockFile.toString(), and com.quadcap.sql.file.Block.writeLong().

Referenced by com.quadcap.sql.ImportedKeyConstraint.add(), com.quadcap.sql.DeletedRows.addEntry(), com.quadcap.sql.file.SubPageManager.allocateNewBlock(), com.quadcap.sql.IndexConstraint.getIndex(), com.quadcap.sql.file.BlockFile.getUserBlock(), com.quadcap.sql.types.ValueBlob.init(), com.quadcap.sql.index.BtreeCursor.main(), com.quadcap.sql.types.ValueBlob.passivate(), and com.quadcap.sql.InsertBlob.redo().

long com.quadcap.sql.file.BlockFile.putBytes byte[]  buf  )  throws IOException
 

Create a new segment with the specified bytes value and return its reference.

Parameters:
buf the value to write to the new segment
Returns:
the segment id

Implements com.quadcap.sql.file.SegmentManager.

Definition at line 498 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.ba, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.getPageManagerForLen(), com.quadcap.sql.file.PageManager.getPageSize(), com.quadcap.sql.file.BlockAccess.init(), com.quadcap.sql.file.PageManager.newPage(), com.quadcap.sql.file.BlockFile.putBytes(), com.quadcap.sql.file.BlockFile.quick, com.quadcap.sql.file.BlockAccess.resize(), com.quadcap.sql.file.BlockAccess.write(), com.quadcap.sql.file.Block.write(), and com.quadcap.sql.file.Block.writeLong().

Referenced by com.quadcap.sql.InsertRow.prepare(), com.quadcap.sql.file.BlockFile.putBytes(), com.quadcap.sql.InsertRow.redo(), and com.quadcap.sql.DeleteRow.undo().

long com.quadcap.sql.file.BlockFile.putObject Object  obj  )  throws IOException
 

Write a new object to the store and return its reference.

Parameters:
obj the object
Returns:
the block number of the object's root
Exceptions:
IOException may be thrown

Definition at line 749 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.bos, com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.inMemory, com.quadcap.sql.file.BlockFile.memObjectCount, com.quadcap.sql.file.BlockFile.memoryObjects, com.quadcap.sql.file.BlockFile.oos, and com.quadcap.sql.file.BlockFile.putObject().

Referenced by com.quadcap.sql.file.Datafile.putObject(), and com.quadcap.sql.file.BlockFile.putObject().

void com.quadcap.sql.file.BlockFile.removeObject long  ref  )  throws IOException
 

Remove an object from the store.

Parameters:
ref the block number of the object's root
Exceptions:
IOException may be thrown

Definition at line 793 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.inMemory, com.quadcap.sql.file.BlockFile.memoryObjects, and com.quadcap.sql.file.BlockFile.removeObject().

Referenced by com.quadcap.sql.file.Datafile.removeObject(), and com.quadcap.sql.file.BlockFile.removeObject().

void com.quadcap.sql.file.BlockFile.restoreBlock long  b,
byte[]  buf,
int  off
throws IOException
 

Definition at line 363 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.ensureLastBlock(), com.quadcap.sql.file.BlockStore.restore(), com.quadcap.sql.file.BlockFile.restoreBlock(), and com.quadcap.sql.file.BlockFile.store.

Referenced by com.quadcap.sql.file.BlockFile.restoreBlock(), and com.quadcap.sql.file.Log1.restoreBlocks().

void com.quadcap.sql.file.BlockFile.revert  )  throws IOException
 

Definition at line 680 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.blockSize, com.quadcap.sql.file.BlockFile.cache, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.lastBlock, com.quadcap.sql.file.BlockFile.oLASTBLOCK, com.quadcap.sql.file.Block.readLong(), com.quadcap.sql.file.Cache.revert(), com.quadcap.sql.file.BlockStore.setLength(), and com.quadcap.sql.file.BlockFile.store.

Referenced by com.quadcap.sql.file.Datafile.initFileDatabase().

void com.quadcap.sql.file.BlockFile.setLog Log  log  ) 
 

Definition at line 328 of file BlockFile.java.

References com.quadcap.sql.file.BlockStore.setLog(), com.quadcap.sql.file.BlockFile.setLog(), and com.quadcap.sql.file.BlockFile.store.

Referenced by com.quadcap.sql.file.Datafile.initFileDatabase(), com.quadcap.sql.file.Datafile.initMemoryDatabase(), and com.quadcap.sql.file.BlockFile.setLog().

void com.quadcap.sql.file.BlockFile.showCache PrintWriter  os  ) 
 

Definition at line 691 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.cache, com.quadcap.sql.file.Cache.show(), and com.quadcap.sql.file.BlockFile.showCache().

Referenced by com.quadcap.sql.file.BlockFile.showCache().

String com.quadcap.sql.file.BlockFile.signature  )  throws IOException
 

Definition at line 189 of file BlockFile.java.

References com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.getBlock(), com.quadcap.sql.file.BlockFile.lastBlock, and com.quadcap.sql.file.Block.signature().

String com.quadcap.sql.file.BlockFile.toString  ) 
 

Definition at line 695 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.store.

Referenced by com.quadcap.sql.file.BlockFile.flush(), com.quadcap.sql.file.BlockFile.freePage(), com.quadcap.sql.file.BlockFile.getPage(), and com.quadcap.sql.file.BlockFile.newPage().

void com.quadcap.sql.file.BlockFile.updateBytes long  seg,
byte[]  buf
throws IOException
 

Update a segment with new value bytes.

Parameters:
buf the value to write to the segment
seg the segment id

Implements com.quadcap.sql.file.SegmentManager.

Definition at line 571 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.ba, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.getPageManagerForPage(), com.quadcap.sql.file.PageManager.getPageSize(), com.quadcap.sql.file.BlockAccess.init(), com.quadcap.sql.file.BlockFile.quick, com.quadcap.sql.file.Block.readLong(), com.quadcap.sql.file.BlockAccess.resize(), com.quadcap.sql.file.BlockAccess.size, com.quadcap.sql.file.BlockFile.updateBytes(), com.quadcap.sql.file.BlockAccess.write(), com.quadcap.sql.file.Block.write(), and com.quadcap.sql.file.Block.writeLong().

Referenced by com.quadcap.sql.UpdateRow.redo(), com.quadcap.sql.UpdateRow.undo(), and com.quadcap.sql.file.BlockFile.updateBytes().

void com.quadcap.sql.file.BlockFile.updateObject long  seg,
Object  obj
throws IOException
 

Write a new version of a persistent object to the store.

Parameters:
blockNum the address of the object's root page in the store
obj the new object value
Exceptions:
IOException may be thrown

Definition at line 772 of file BlockFile.java.

References com.quadcap.sql.file.BlockFile.bos, com.quadcap.sql.file.BlockFile.fileLock, com.quadcap.sql.file.BlockFile.inMemory, com.quadcap.sql.file.BlockFile.memoryObjects, com.quadcap.sql.file.BlockFile.oos, and com.quadcap.sql.file.BlockFile.updateObject().

Referenced by com.quadcap.sql.file.Datafile.updateObject(), and com.quadcap.sql.file.BlockFile.updateObject().


Member Data Documentation

BlockAccess com.quadcap.sql.file.BlockFile.ba = new BlockAccess() [package]
 

Definition at line 526 of file BlockFile.java.

Referenced by com.quadcap.sql.file.BlockFile.getBytes(), com.quadcap.sql.file.BlockFile.putBytes(), and com.quadcap.sql.file.BlockFile.updateBytes().

int com.quadcap.sql.file.BlockFile.blockSize [package]
 

Definition at line 123 of file BlockFile.java.

Referenced by com.quadcap.sql.file.BlockFile.dump(), com.quadcap.sql.file.BlockFile.getBlockSize(), com.quadcap.sql.file.BlockFile.getPageManagerForLen(), com.quadcap.sql.file.BlockFile.getSize(), com.quadcap.sql.file.Log1.init(), com.quadcap.sql.file.BlockFile.makeStore(), and com.quadcap.sql.file.BlockFile.revert().

ByteArrayOutputStream com.quadcap.sql.file.BlockFile.bos = new ByteArrayOutputStream() [package]
 

Definition at line 135 of file BlockFile.java.

Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), com.quadcap.sql.file.BlockFile.putObject(), and com.quadcap.sql.file.BlockFile.updateObject().

BlockCache com.quadcap.sql.file.BlockFile.cache [package]
 

The cache of file blocks.

Definition at line 80 of file BlockFile.java.

Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), com.quadcap.sql.file.BlockFile.flush(), com.quadcap.sql.file.BlockFile.getPage(), com.quadcap.sql.file.BlockFile.revert(), and com.quadcap.sql.file.BlockFile.showCache().

Object com.quadcap.sql.file.BlockFile.fileLock = new Object() [package]
 

Definition at line 131 of file BlockFile.java.

Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), com.quadcap.sql.file.BlockFile.close(), com.quadcap.sql.file.BlockFile.flush(), com.quadcap.sql.file.SubPageManager.freePage(), com.quadcap.sql.file.BlockFile.freePage(), com.quadcap.sql.file.SubPageManager.freeStream(), com.quadcap.sql.file.BlockFile.freeStream(), com.quadcap.sql.file.BlockFile.getBytes(), com.quadcap.sql.file.BlockFile.getLock(), com.quadcap.sql.file.BlockFile.getObject(), com.quadcap.sql.file.BlockFile.getPage(), com.quadcap.sql.file.BlockFile.getUserBlock(), com.quadcap.sql.file.BlockFile.makeStore(), com.quadcap.sql.file.SubPageManager.newPage(), com.quadcap.sql.file.BlockFile.newPage(), com.quadcap.sql.file.BlockFile.putBytes(), com.quadcap.sql.file.BlockFile.putObject(), com.quadcap.sql.file.BlockFile.removeObject(), com.quadcap.sql.file.BlockFile.updateBytes(), and com.quadcap.sql.file.BlockFile.updateObject().

boolean com.quadcap.sql.file.BlockFile.inMemory [package]
 

Definition at line 85 of file BlockFile.java.

Referenced by com.quadcap.sql.file.BlockFile.BlockFile(), com.quadcap.sql.file.BlockFile.getObject(),