|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.xindice.core.filer.Paged
public abstract class Paged
Paged is a paged file implementation that is foundation for both the BTree class and the HashFiler. It provides flexible paged I/O and page caching functionality.
Page has folowing configuration attributes:
Nested Class Summary | |
---|---|
class |
Paged.FileHeader
Paged file's header |
class |
Paged.Page
Paged file's page |
class |
Paged.PageHeader
PageHeader |
Field Summary | |
---|---|
protected static byte |
DELETED
Deleted page status |
protected static int |
NO_PAGE
Page ID of non-existent page |
protected static byte |
OVERFLOW
Overflow page status |
protected boolean |
sync
flag whether to sync DB on every write or not. |
protected static byte |
UNUSED
Unused page status |
Constructor Summary | |
---|---|
Paged()
|
|
Paged(File file)
|
Method Summary | |
---|---|
(package private) void |
addDirty(Paged.Page page)
|
protected void |
checkOpened()
|
boolean |
close()
|
protected void |
closeDescriptor(RandomAccessFile raf)
Closes a RandomAccessFile ('descriptor') and removes it from the pool. |
boolean |
create()
|
abstract Paged.FileHeader |
createFileHeader()
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
abstract Paged.FileHeader |
createFileHeader(boolean read)
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
abstract Paged.FileHeader |
createFileHeader(long pageCount)
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
abstract Paged.FileHeader |
createFileHeader(long pageCount,
int pageSize)
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
abstract Paged.PageHeader |
createPageHeader()
createPageHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a PageHeader. |
static int[] |
deleteArrayInt(int[] vals,
int idx)
|
static long[] |
deleteArrayLong(long[] vals,
int idx)
|
static short[] |
deleteArrayShort(short[] vals,
int idx)
|
static Value[] |
deleteArrayValue(Value[] vals,
int idx)
|
boolean |
drop()
|
boolean |
exists()
|
void |
flush()
|
protected RandomAccessFile |
getDescriptor()
Obtain RandomAccessFile ('descriptor') object out of the pool. |
protected File |
getFile()
getFile returns the file object for this Paged. |
Paged.FileHeader |
getFileHeader()
getFileHeader returns the FileHeader |
protected Paged.Page |
getFreePage()
getFreePage returns the first free Page from secondary storage. |
protected Paged.Page |
getPage(long pageNum)
getPage returns the page specified by pageNum. |
static int[] |
insertArrayInt(int[] vals,
int val,
int idx)
|
static long[] |
insertArrayLong(long[] vals,
long val,
int idx)
|
static short[] |
insertArrayShort(short[] vals,
short val,
int idx)
|
static Value[] |
insertArrayValue(Value[] vals,
Value val,
int idx)
|
boolean |
isOpened()
|
boolean |
open()
|
protected void |
putDescriptor(RandomAccessFile raf)
Puts a RandomAccessFile ('descriptor') back into the descriptor pool. |
protected Value |
readValue(long page)
readValue reads the multi-Paged Value starting at the specified page number. |
protected Value |
readValue(Paged.Page page)
readValue reads the multi-Paged Value starting at the specified Page. |
protected void |
setFile(File file)
setFile sets the file object for this Paged. |
protected void |
unlinkPages(long pageNum)
unlinkPages unlinks a set of pages starting at the specified page number. |
protected void |
unlinkPages(Paged.Page page)
unlinkPages unlinks a set of pages starting at the specified Page. |
protected void |
writeValue(long page,
Value value)
writeValue writes the multi-Paged Value starting at the specified page number. |
protected void |
writeValue(Paged.Page page,
Value value)
writeValue writes the multi-Paged Value starting at the specified Page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final byte UNUSED
protected static final byte OVERFLOW
protected static final byte DELETED
protected static final int NO_PAGE
protected boolean sync
Constructor Detail |
---|
public Paged()
public Paged(File file)
Method Detail |
---|
protected final void setFile(File file)
file
- The Fileprotected final File getFile()
protected final RandomAccessFile getDescriptor() throws IOException
IOException
- if an io error occursprotected final void putDescriptor(RandomAccessFile raf)
raf
- the file to addprotected final void closeDescriptor(RandomAccessFile raf)
raf
- the file to closeprotected final Paged.Page getPage(long pageNum) throws IOException
pageNum
- The Page number
IOException
- if an Exception occursprotected final Value readValue(Paged.Page page) throws IOException
page
- The starting Page
IOException
- if an Exception occursprotected final Value readValue(long page) throws IOException
page
- The starting page number
IOException
- if an Exception occursprotected final void writeValue(Paged.Page page, Value value) throws IOException
page
- The starting Pagevalue
- The Value to write
IOException
- if an Exception occursprotected final void writeValue(long page, Value value) throws IOException
page
- The starting page numbervalue
- The Value to write
IOException
- if an Exception occursprotected final void unlinkPages(Paged.Page page) throws IOException
page
- The starting Page to unlink
IOException
- if an Exception occursprotected final void unlinkPages(long pageNum) throws IOException
pageNum
- The starting page number to unlink
IOException
- if an Exception occursprotected final Paged.Page getFreePage() throws IOException
IOException
- if an Exception occursprotected final void checkOpened() throws DBException
DBException
- COL_COLLECTION_CLOSED if paged file is closedpublic Paged.FileHeader getFileHeader()
public boolean exists()
public boolean create() throws DBException
DBException
public boolean open() throws DBException
DBException
public boolean close() throws DBException
DBException
public boolean isOpened()
public boolean drop() throws DBException
DBException
void addDirty(Paged.Page page) throws IOException
IOException
public void flush() throws DBException
DBException
public abstract Paged.FileHeader createFileHeader()
public abstract Paged.FileHeader createFileHeader(boolean read) throws IOException
read
- If true, reads the FileHeader from disk
IOException
- if an exception occurspublic abstract Paged.FileHeader createFileHeader(long pageCount)
pageCount
- The number of pages to allocate for primary storage
public abstract Paged.FileHeader createFileHeader(long pageCount, int pageSize)
pageCount
- The number of pages to allocate for primary storagepageSize
- The size of a Page (should be a multiple of a FS block)
public abstract Paged.PageHeader createPageHeader()
public static Value[] insertArrayValue(Value[] vals, Value val, int idx)
public static Value[] deleteArrayValue(Value[] vals, int idx)
public static long[] insertArrayLong(long[] vals, long val, int idx)
public static long[] deleteArrayLong(long[] vals, int idx)
public static int[] insertArrayInt(int[] vals, int val, int idx)
public static int[] deleteArrayInt(int[] vals, int idx)
public static short[] insertArrayShort(short[] vals, short val, int idx)
public static short[] deleteArrayShort(short[] vals, int idx)
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |