public class UsageMap
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private class |
UsageMap.Handler |
private class |
UsageMap.InlineHandler
Usage map whose map is written inline in the same page.
|
class |
UsageMap.PageCursor
Utility class to traverse over the pages in the UsageMap.
|
private class |
UsageMap.ReferenceHandler
Usage map whose map is written across one or more entire separate pages
of page type USAGE_MAP.
|
| Modifier and Type | Field and Description |
|---|---|
private DatabaseImpl |
_database
owning database
|
private int |
_endPage
Last page that this usage map applies to
|
private UsageMap.Handler |
_handler
the current handler implementation for reading/writing the specific
usage map type.
|
private int |
_modCount
modification count on the usage map, used to keep the cursors in
sync
|
private java.util.BitSet |
_pageNumbers
bits representing page numbers used, offset from _startPage
|
private short |
_rowStart
Offset of the data page at which the usage map declaration starts
|
private int |
_startOffset
Offset of the data page at which the usage map data starts
|
private int |
_startPage
First page that this usage map applies to
|
private java.nio.ByteBuffer |
_tableBuffer
Buffer that contains the usage map table declaration page
|
private int |
_tablePageNum
Page number of the map table declaration
|
private static int |
INVALID_BIT_INDEX
bit index value for an invalid page number
|
static byte |
MAP_TYPE_INLINE
Inline map type
|
static byte |
MAP_TYPE_REFERENCE
Reference map type, for maps that are too large to fit inline
|
(package private) static java.lang.String |
MSG_PREFIX_UNRECOGNIZED_MAP
Error message prefix used when map type is unrecognized.
|
| Modifier | Constructor and Description |
|---|---|
private |
UsageMap(DatabaseImpl database,
java.nio.ByteBuffer tableBuffer,
int pageNum,
short rowStart) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPageNumber(int pageNumber)
Add a page number to this usage map
|
protected int |
bitIndexToPageNumber(int bitIndex,
int invalidPageNumber) |
protected void |
clearTableAndPages() |
boolean |
containsPageNumber(int pageNumber)
Determines if the given page number is contained in this map.
|
UsageMap.PageCursor |
cursor() |
DatabaseImpl |
getDatabase() |
protected int |
getEndPage() |
protected int |
getFirstPageNumber() |
JetFormat |
getFormat() |
protected int |
getLastPageNumber() |
protected int |
getNextBitIndex(int curIndex) |
protected int |
getNextPageNumber(int curPage) |
PageChannel |
getPageChannel() |
int |
getPageCount() |
protected java.util.BitSet |
getPageNumbers() |
protected int |
getPrevBitIndex(int curIndex) |
protected int |
getPrevPageNumber(int curPage) |
protected int |
getRowEnd() |
protected short |
getRowStart() |
protected int |
getStartOffset() |
protected int |
getStartPage() |
protected java.nio.ByteBuffer |
getTableBuffer() |
protected int |
getTablePageNumber() |
private void |
initHandler(byte mapType,
boolean assumeOutOfRangeBitsOn) |
protected boolean |
isPageWithinRange(int pageNumber) |
protected int |
pageNumberToBitIndex(int pageNumber) |
protected void |
processMap(java.nio.ByteBuffer buffer,
int bufferStartPage)
Read in the page numbers in this inline map
|
private void |
promoteInlineHandlerToReferenceHandler(int newPageNumber)
Promotes and inline usage map to a reference usage map.
|
private static void |
rangeToString(java.util.List<java.lang.String> ranges,
int rangeStart,
int rangeEnd) |
static UsageMap |
read(DatabaseImpl database,
java.nio.ByteBuffer buf,
boolean assumeOutOfRangeBitsOn) |
static UsageMap |
read(DatabaseImpl database,
int pageNum,
int rowNum,
boolean assumeOutOfRangeBitsOn) |
private void |
reAddPages(int oldStartPage,
java.util.BitSet oldPageNumbers,
int newPageNumber) |
protected void |
removePageNumber(int pageNumber,
boolean force)
Remove a page number from this usage map
|
protected void |
setPageRange(int newStartPage,
int newEndPage) |
protected void |
setStartOffset(int startOffset) |
java.lang.String |
toString() |
protected void |
updateMap(int absolutePageNumber,
int bufferRelativePageNumber,
java.nio.ByteBuffer buffer,
boolean add,
boolean force) |
protected void |
writeTable() |
public static final byte MAP_TYPE_INLINE
public static final byte MAP_TYPE_REFERENCE
private static final int INVALID_BIT_INDEX
private final DatabaseImpl _database
private final int _tablePageNum
private int _startOffset
private final short _rowStart
private int _startPage
private int _endPage
private java.util.BitSet _pageNumbers
private final java.nio.ByteBuffer _tableBuffer
private int _modCount
private UsageMap.Handler _handler
static final java.lang.String MSG_PREFIX_UNRECOGNIZED_MAP
private UsageMap(DatabaseImpl database, java.nio.ByteBuffer tableBuffer, int pageNum, short rowStart) throws java.io.IOException
database - database that contains this usage maptableBuffer - Buffer that contains this map's declarationpageNum - Page number that this usage map is contained inrowStart - Offset at which the declaration starts in the bufferjava.io.IOExceptionpublic DatabaseImpl getDatabase()
public JetFormat getFormat()
public PageChannel getPageChannel()
public static UsageMap read(DatabaseImpl database, java.nio.ByteBuffer buf, boolean assumeOutOfRangeBitsOn) throws java.io.IOException
database - database that contains this usage mapbuf - buffer which contains the usage map row infojava.io.IOExceptionpublic static UsageMap read(DatabaseImpl database, int pageNum, int rowNum, boolean assumeOutOfRangeBitsOn) throws java.io.IOException
database - database that contains this usage mappageNum - Page number that this usage map is contained inrowNum - Number of the row on the page that contains this usage mapjava.io.IOExceptionprivate void initHandler(byte mapType,
boolean assumeOutOfRangeBitsOn)
throws java.io.IOException
java.io.IOExceptionpublic UsageMap.PageCursor cursor()
public int getPageCount()
protected short getRowStart()
protected int getRowEnd()
protected void setStartOffset(int startOffset)
protected int getStartOffset()
protected java.nio.ByteBuffer getTableBuffer()
protected int getTablePageNumber()
protected int getStartPage()
protected int getEndPage()
protected java.util.BitSet getPageNumbers()
protected void setPageRange(int newStartPage,
int newEndPage)
protected boolean isPageWithinRange(int pageNumber)
protected int getFirstPageNumber()
protected int getNextPageNumber(int curPage)
protected int getNextBitIndex(int curIndex)
protected int getLastPageNumber()
protected int getPrevPageNumber(int curPage)
protected int getPrevBitIndex(int curIndex)
protected int bitIndexToPageNumber(int bitIndex,
int invalidPageNumber)
protected int pageNumberToBitIndex(int pageNumber)
protected void clearTableAndPages()
protected void writeTable()
throws java.io.IOException
java.io.IOExceptionprotected void processMap(java.nio.ByteBuffer buffer,
int bufferStartPage)
public boolean containsPageNumber(int pageNumber)
public void addPageNumber(int pageNumber)
throws java.io.IOException
java.io.IOExceptionprotected void removePageNumber(int pageNumber,
boolean force)
throws java.io.IOException
java.io.IOExceptionprotected void updateMap(int absolutePageNumber,
int bufferRelativePageNumber,
java.nio.ByteBuffer buffer,
boolean add,
boolean force)
throws java.io.IOException
java.io.IOExceptionprivate void promoteInlineHandlerToReferenceHandler(int newPageNumber)
throws java.io.IOException
java.io.IOExceptionprivate void reAddPages(int oldStartPage,
java.util.BitSet oldPageNumbers,
int newPageNumber)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectprivate static void rangeToString(java.util.List<java.lang.String> ranges,
int rangeStart,
int rangeEnd)