public class PageAllocator extends Object implements Iterable<Page>, Closeable
| Constructor and Description | 
|---|
PageAllocator(String fName,
             boolean wipe)
Create a new PageAllocator that writes its bytes into a file named fName. 
 | 
PageAllocator(String fName,
             boolean wipe,
             boolean durable)  | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
allocPage()
Allocates a new page in the file. 
 | 
void | 
close()
Close this PageAllocator. 
 | 
Page | 
fetchPage(int pageNum)
Fetches the page corresponding to virtual page number pageNum. 
 | 
boolean | 
freePage(int pageNum)
Frees the page to be returned back to the system. 
 | 
boolean | 
freePage(Page p)
Frees the page to be returned back to the system. 
 | 
static long | 
getNumCacheMisses()  | 
static long | 
getNumIOs()  | 
int | 
getNumPages()  | 
Iterator<Page> | 
iterator()  | 
public PageAllocator(String fName, boolean wipe)
fName - the name of the file for this PageAllocatorwipe - a boolean specifying whether to wipe the filepublic PageAllocator(String fName, boolean wipe, boolean durable)
public int allocPage()
public Page fetchPage(int pageNum)
pageNum - the virtual page numberpublic boolean freePage(Page p)
p - the page to freepublic boolean freePage(int pageNum)
pageNum - the virtual page number to be flushedpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic int getNumPages()
public static long getNumIOs()
public static long getNumCacheMisses()
Copyright © 2017. All rights reserved.