PageStreamTrunk

A trunk page of a stream. It contains the page numbers of the stream, and the page number of the next trunk. The format is:
  • page type: byte (0)
  • checksum: short (1-2)
  • previous trunk page, or 0 if none: int (3-6)
  • log key: int (7-10)
  • next trunk page: int (11-14)
  • number of pages: short (15-16)
  • page ids (17-)


Methods
static PageStreamTrunk create(PageStore store, int parent, int pageId, int next, int logKey, int[] pageIds)
Create a new stream trunk page.
static PageStreamTrunk create(PageStore store, int parent, int pageId, int next, int logKey, int[] pageIds)
Create a new stream trunk page.
Parameters:
store - the page store
parent - the parent page
pageId - the page id
next - the next trunk page
logKey - the log key
pageIds - the stream data page ids
Returns:
the page
static int getPagesAddressed(int pageSize)
Get the number of pages that can be addressed in a stream trunk page.
static int getPagesAddressed(int pageSize)
Get the number of pages that can be addressed in a stream trunk page.
Parameters:
pageSize - the page size
Returns:
the number of pages
static PageStreamTrunk read(PageStore store, Data data, int pageId)
Read a stream trunk page.
static PageStreamTrunk read(PageStore store, Data data, int pageId)
Read a stream trunk page.
Parameters:
store - the page store
data - the data
pageId - the page id
Returns:
the page
boolean canMove()
boolean canMove()
boolean canRemove()
boolean canRemove()
boolean contains(int dataPageId)
Check if the given data page is in this trunk page.
boolean contains(int dataPageId)
Check if the given data page is in this trunk page.
Parameters:
dataPageId - the page id
Returns:
true if it is
int free(int lastUsedPage)
Free this page and all data pages.
int free(int lastUsedPage)
Free this page and all data pages. Pages after the last used data page (if within this list) are empty and therefore not just freed, but marked as not used.
Parameters:
lastUsedPage - the last used data page
Returns:
the number of pages freed
int getLogKey()
int getLogKey()
int getMemory()
Get the estimated memory size.
int getMemory()
Get the estimated memory size.
Returns:
number of double words (4 bytes)
int getNextTrunk()
int getNextTrunk()
int getPageData(int index)
Get the data page id at the given position.
int getPageData(int index)
Get the data page id at the given position.
Parameters:
index - the index (0, 1, ...)
Returns:
the value, or -1 if the index is too large
void moveTo(Session session, int newPos)
void moveTo(Session session, int newPos)
String toString()
String toString()
void write()
void write()

Fields
static int nextTrunk
static int parent

nextTrunk

The next stream trunk.

parent

The previous stream trunk.