| java.lang.Object com.quadcap.sql.file.SubPageManager
SubPageManager | public class SubPageManager implements PageManager(Code) | | This class implements a sub-page manager which operates by allocating
pages as needed from the main file and chopping them up into smaller
pages of the appropriate size.
author: Stan Bailes |
Field Summary | |
static int[] | BLOCK_NUM | final static long | PAGE_FREE | static int[] | PAGE_NUM | static int[] | PAGE_SHIFT Sub-page numbers are encoded as follows:
sub_page {
pageShift bit4
pageNum bit16
blockNum bit44
}
This has the desirable property of being backward compatible with the
pre-sub-page block numbers, which will have pageShift and pageNum
equal to zero. | BlockFile | file | int | offset | int | pageShift | int | pageSize | int | pagesPerBlock | long | rootBlock rootBlock is the root block of the entire block file, and will
always be zero in this implementation. |
BLOCK_NUM | static int[] BLOCK_NUM(Code) | | |
PAGE_FREE | final static long PAGE_FREE(Code) | | |
PAGE_NUM | static int[] PAGE_NUM(Code) | | |
PAGE_SHIFT | static int[] PAGE_SHIFT(Code) | | Sub-page numbers are encoded as follows:
sub_page {
pageShift bit4
pageNum bit16
blockNum bit44
}
This has the desirable property of being backward compatible with the
pre-sub-page block numbers, which will have pageShift and pageNum
equal to zero.
|
offset | int offset(Code) | | The offset into the root block of our freelist head
|
pageShift | int pageShift(Code) | | The page shift (file.pageSize >> pageShift == pageSize)
|
pageSize | int pageSize(Code) | | The size of a subpage
|
pagesPerBlock | int pagesPerBlock(Code) | | (1 << pageShift)
|
rootBlock | long rootBlock(Code) | | rootBlock is the root block of the entire block file, and will
always be zero in this implementation.
|
SubPageManager | public SubPageManager(BlockFile file, int pageShift, long rootBlock) throws IOException(Code) | | Construct a new sub-page manager bound to the specified block file
|
fEnd | final static long fEnd(int[] f)(Code) | | |
fExt | final static long fExt(long v, int[] f)(Code) | | |
fIns | final static long fIns(long v, int[] f)(Code) | | |
fMask | final static long fMask(int[] f)(Code) | | |
freePage | public void freePage(long block) throws IOException(Code) | | Free a block.
Parameters: block - a previously allocated block |
freeStream | public void freeStream(long page) throws IOException(Code) | | Destroy the stream with the specified root page and free up the
storage it was using.
Parameters: page - the root page of the region exception: IOException - if the page number isn't valid, or if anothererror is detected trying to access the region. |
getInputStream | public RandomAccessInputStream getInputStream(long block) throws IOException(Code) | | Return a new input stream, reading from the region with the specified
root block.
Parameters: block - the root block of the region an InputStream bound to the region. exception: IOException - if the block number isn't valid, or if anothererror is detected trying to access the region. |
getOutputStream | public RandomAccessOutputStream getOutputStream(long block) throws IOException(Code) | | Return a new output stream, writing to the region with the specified
root block.
Parameters: block - the root block of the region an OutputStream bound to the region. exception: IOException - if the block number isn't valid, or if anothererror is detected trying to access the region. |
getPageSize | final public int getPageSize()(Code) | | Return this manager's block size
|
makePageNo | final long makePageNo(long blk, long page)(Code) | | |
pageBlock | final public static long pageBlock(long page)(Code) | | Return the number of the block that contains this page.
|
pageOffset | final public int pageOffset(long page)(Code) | | Return the byte offset of this page in the base block.
|
pageShift | final static int pageShift(long page)(Code) | | Return the page shift for this page.
|
toString | public String toString()(Code) | | Return a displayable representation for this object.
|
|
|