org.gillius.realdb.model
Interface DataBlockManager

All Superinterfaces:
DataBlockSummaryReader
All Known Implementing Classes:
DefaultDataBlockManager

public interface DataBlockManager
extends DataBlockSummaryReader

DataBlockManager is a source for allocating and reading blocks in the system.

Author:
Jason Winnebeck

Method Summary
 void closeBlock()
          Closes the block returned by getNextBlock(int), which schedules it to be written to disk and marks the intention that no more data will be added to it.
 DataBlock getNextBlock(int recordSize)
          Returns the next block from this allocator.
 DataBlock readBlock(int blockNum, int recordSize)
          Reads a block directly from the underlying storage (DataSection).
 
Methods inherited from interface org.gillius.realdb.model.DataBlockSummaryReader
readBlockRange
 

Method Detail

getNextBlock

DataBlock getNextBlock(int recordSize)
                       throws java.io.IOException,
                              BadFileException
Returns the next block from this allocator. There should always be another block, as typically an allocator will free up space to find a new one if necessary. The block returned from this method must be closed before another can be retrieved.

Returns:
non-null empty DataBlock ready to write records of the given size
Throws:
java.io.IOException
BadFileException

closeBlock

void closeBlock()
                throws java.io.IOException
Closes the block returned by getNextBlock(int), which schedules it to be written to disk and marks the intention that no more data will be added to it.

Throws:
java.io.IOException

readBlock

DataBlock readBlock(int blockNum,
                    int recordSize)
                    throws java.io.IOException,
                           BadFileException
Reads a block directly from the underlying storage (DataSection).

Throws:
java.io.IOException - if the block could not be read
BadFileException - if the block loaded was corrupted


Copyright © 2008-2010 Jason Winnebeck. All Rights Reserved.