📄 dbindex.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2) on Fri Jan 06 00:26:33 EST 2006 -->
<TITLE>
DBIndex
</TITLE>
<META NAME="keywords" CONTENT="neustore.base.DBIndex class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="DBIndex";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DBIndex.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../neustore/base/DBBufferReturnElement.html" title="class in neustore.base"><B>PREV CLASS</B></A>
<A HREF="../../neustore/base/DBPage.html" title="class in neustore.base"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="DBIndex.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
neustore.base</FONT>
<BR>
Class DBIndex</H2>
<PRE>
java.lang.Object
<IMG SRC="../../resources/inherit.gif" ALT="extended by"><B>neustore.base.DBIndex</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../neustore/heapfile/HeapFile.html" title="class in neustore.heapfile">HeapFile</A>, <A HREF="../../test/naiveheapfile/NaiveHeapFile.html" title="class in test.naiveheapfile">NaiveHeapFile</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract class <B>DBIndex</B><DT>extends java.lang.Object</DL>
<P>
Abstract base class for a disk-based, paginated and buffered index. The index reads and writes <A HREF="../../neustore/base/DBPage.html" title="class in neustore.base"><CODE>DBPage</CODE></A> using a <A HREF="../../neustore/base/DBBuffer.html" title="class in neustore.base"><CODE>DBBuffer</CODE></A>. <p> <b>Usage:</b><br> <ul> <li>The constructor of DBIndex takes a DBBuffer object. That means the caller who wishes to generate a DBIndex object should generate a DBBuffer object first. <li>An application should define a derived class like <code>HeapFile</code>, by implementing the three abstract functions that manage the <i>head information</i> (to be explained). <li>The file can be viewed as a consecutive list of disk pages, each of size pageSize. See the figure below:<br> <pre> +------+-------+-------+-------+-------+-------+-------+ | head | page1 | page2 | page3 | page4 | page5 | page6 | +------+-------+-------+-------+-------+-------+-------+ </pre> <li> The head page (having pageID=0) uses the first OVERHEAD=16 bytes to store four integers:<br> <ul> <li><b>-1</b> <li><b>pagesize</b> <li><b>numOfPages</b>: number of non-empty pages <li><b>free</b>: pageID of the first empty page </ul> The rest pageSize - OVERHEAD bytes stores the user-specified head information. For instance, a tree index may store the pageID for the root page here. To manage the head information, a derived class needs to implement the three abstract functions <ul> <li><code>initIndexHead</code>: called when the index is built; <li><code>readIndexHead</code>: called when the index is opened; <li><code>writeIndexHead</code>: called right before the index is closed. </ul> <li> Besides the constructor and the <code>close()</code> function, typical usages of the <code>DBIndex</code> are: <ul> <li><code>allocate</code>: to get a new pageID; <li><code>freePage</code>: to declare a pageID to be empty; <li>The public functions in the buffer, e.g. <code>buffer.readPage</code>, <code>buffer.writePage</code>. </ul> <li> One implementation detail is that all the empty pages in the file are linked together in a linked list. An empty page contains two integers: 0 and pageID for the next empty page. If it is the last empty page in the file, the next pointer is set to -1. A class called DBEmptyPage is defined for this purpose. But all these are hidden from the user. </ul>
<P>
<P>
<DL>
<DT><B>Author:</B></DT> <DD>Tian Xia <tianxia@ccs.neu.edu><br>Donghui Zhang <donghui@ccs.neu.edu></DD><DT><B>See Also:</B><DD><A HREF="../../neustore/base/DBPage.html" title="class in neustore.base"><CODE>DBPage</CODE></A>, <A HREF="../../neustore/base/DBBuffer.html" title="class in neustore.base"><CODE>DBBuffer</CODE></A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../neustore/base/DBBuffer.html" title="class in neustore.base">DBBuffer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBIndex.html#buffer">buffer</A></B></CODE>
<BR>
The buffer manager.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBIndex.html#CREATE">CREATE</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBIndex.html#OPEN">OPEN</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../neustore/base/DBIndex.html#DBIndex(neustore.base.DBBuffer, java.lang.String, boolean)">DBIndex</A></B>(<A HREF="../../neustore/base/DBBuffer.html" title="class in neustore.base">DBBuffer</A> buffer, java.lang.String filename, boolean isCreate)</CODE>
<BR>
Creates or Opens an index file.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -