📄 dbbuffer.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>
DBBuffer
</TITLE>
<META NAME="keywords" CONTENT="neustore.base.DBBuffer class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="DBBuffer";
}
</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/DBBuffer.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/ByteArray.html" title="class in neustore.base"><B>PREV CLASS</B></A>
<A HREF="../../neustore/base/DBBufferReturnElement.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="DBBuffer.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 | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <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 DBBuffer</H2>
<PRE>
java.lang.Object
<IMG SRC="../../resources/inherit.gif" ALT="extended by"><B>neustore.base.DBBuffer</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../neustore/base/LRUBuffer.html" title="class in neustore.base">LRUBuffer</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract class <B>DBBuffer</B><DT>extends java.lang.Object</DL>
<P>
Abstract base class for a buffer manager. It helps index structures (derived from <A HREF="../../neustore/base/DBIndex.html" title="class in neustore.base"><CODE>DBIndex</CODE></A>) manage disk pages. <p> <b>Usage:</b><br> <ul> <li> An application can choose to use a provided sub-class like LRUBuffer. <li> If the user chooses to define their own buffer management, they should derive a class from <code>DBBuffer</code> by providing methods <code>add</code>, <code>find</code> and <code>flush</code>. <li> The user typically calls <A HREF="../../neustore/base/DBBuffer.html#readPage(java.io.RandomAccessFile, int)"><CODE>readPage(java.io.RandomAccessFile, int)</CODE></A> and <A HREF="../../neustore/base/DBBuffer.html#writePage(java.io.RandomAccessFile, int, neustore.base.DBPage)"><CODE>writePage(java.io.RandomAccessFile, int, neustore.base.DBPage)</CODE></A> to read/write a disk page. Here <code>readPage</code> returns an object of class <code>DBBufferReturnedElement</code>. Besides the page itself, the returned element also specifies the nodeType and whether the node was parsed. If parsed, the returned object is of class DBPage. Otherwise, the returned object is a byte array and it's up to the application to generate a DBPage object. Moreover, nodeType=-1 and 0 are reserved (for DBByteArrayPage and DBEmptyPage). The application can explain the other values. For example, a B+-tree may cast a nodeType=1 node to an index node. <li> The user can <A HREF="../../neustore/base/DBBuffer.html#pin(java.io.RandomAccessFile, int)"><CODE>pin(java.io.RandomAccessFile, int)</CODE></A> or <A HREF="../../neustore/base/DBBuffer.html#unpin(java.io.RandomAccessFile, int)"><CODE>unpin(java.io.RandomAccessFile, int)</CODE></A> a page. <li> The user can call <A HREF="../../neustore/base/DBBuffer.html#getIOs()"><CODE>getIOs()</CODE></A> to get statistics, or call <A HREF="../../neustore/base/DBBuffer.html#clearIOs()"><CODE>clearIOs()</CODE></A> to initialize the counters. </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/DBIndex.html" title="class in neustore.base"><CODE>DBIndex</CODE></A>, <A HREF="../../neustore/base/DBPage.html" title="class in neustore.base"><CODE>DBPage</CODE></A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== 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/DBBuffer.html#DBBuffer(int, int)">DBBuffer</A></B>(int bufferSize, int pageSize)</CODE>
<BR>
Opens an existing Database 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>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBBuffer.html#clearIOs()">clearIOs</A></B>()</CODE>
<BR>
Resets the four counters <code>bufferReadIO</code>, etc.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBBuffer.html#getIOs()">getIOs</A></B>()</CODE>
<BR>
Reports the disk/buffer I/Os. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBBuffer.html#pin(java.io.RandomAccessFile, int)">pin</A></B>(java.io.RandomAccessFile file, int pageID)</CODE>
<BR>
Pins a page. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../neustore/base/DBBufferReturnElement.html" title="class in neustore.base">DBBufferReturnElement</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBBuffer.html#readPage(java.io.RandomAccessFile, int)">readPage</A></B>(java.io.RandomAccessFile file, int pageID)</CODE>
<BR>
Returns a buffered page. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBBuffer.html#unpin(java.io.RandomAccessFile, int)">unpin</A></B>(java.io.RandomAccessFile file, int pageID)</CODE>
<BR>
Unpins a page. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../neustore/base/DBBuffer.html#writePage(java.io.RandomAccessFile, int, neustore.base.DBPage)">writePage</A></B>(java.io.RandomAccessFile file,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -