PageFreeList

The list of free pages of a page store. The format of a free list trunk page is:
  • page type: byte (0)
  • checksum: short (1-2)
  • data (3-)


Methods
static PageFreeList create(PageStore store, int pageId)
Create a new free-list page.
static PageFreeList create(PageStore store, int pageId)
Create a new free-list page.
Parameters:
store - the page store
pageId - the page id
Returns:
the page
static int getPagesAddressed(int pageSize)
Get the number of pages that can fit in a free list.
static int getPagesAddressed(int pageSize)
Get the number of pages that can fit in a free list.
Parameters:
pageSize - the page size
Returns:
the number of pages
static PageFreeList read(PageStore store, Data data, int pageId)
Read a free-list page.
static PageFreeList read(PageStore store, Data data, int pageId)
Read a free-list page.
Parameters:
store - the page store
data - the data
pageId - the page id
Returns:
the page
int allocate(BitField exclude, int first)
Allocate a page from the free list.
int allocate(BitField exclude, int first)
Allocate a page from the free list.
Parameters:
exclude - the exclude list or null
first - the first page to look for
Returns:
the page, or -1 if all pages are used
void allocate(int pageId)
Mark a page as used.
void allocate(int pageId)
Mark a page as used.
Parameters:
pageId - the page id
boolean canMove()
boolean canMove()
boolean canRemove()
boolean canRemove()
void free(int pageId)
Add a page to the free list.
void free(int pageId)
Add a page to the free list.
Parameters:
pageId - the page id to add
int getFirstFree(int first)
Get the first free page starting at the given offset.
int getFirstFree(int first)
Get the first free page starting at the given offset.
Parameters:
first - the page number to start the search
Returns:
the page number, or -1
int getLastUsed()
int getLastUsed()
int getMemory()
Get the estimated memory size.
int getMemory()
Get the estimated memory size.
Returns:
number of double words (4 bytes)
boolean isUsed(int pageId)
Check if a page is already in use.
boolean isUsed(int pageId)
Check if a page is already in use.
Parameters:
pageId - the page to check
Returns:
true if it is in use
void moveTo(Session session, int newPos)
void moveTo(Session session, int newPos)
String toString()
String toString()
void write()
void write()