<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ThreadFile class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Thu Oct 4 15:33:02 2001 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>ThreadFile Class Reference</h1>This class defines a database I/O file service that can be shared by multiple threads. This class defines a database I/O file service that can be shared by multiple threads. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="file_h-source.html">file.h</a>></code> <p> <p>Inheritance diagram for ThreadFile: <p><center><img src="class_threadfile.gif" usemap="#ThreadFile_map" border="0"></center> <map name="ThreadFile_map"> <area href="class_randomfile.html" alt="RandomFile" shape="rect" coords="0,56,78,80"> <area href="class_mutex.html" alt="Mutex" shape="rect" coords="0,0,78,24"> </map> <a href="class_threadfile-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td colspan=2><br><h2>Public Methods</h2></td></tr> <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="class_threadfile.html#a0">ThreadFile</a> (const char *path)</td></tr> <tr><td> </td><td><font size=-1><em>Open or create a new database file.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="class_threadfile.html#a1">~ThreadFile</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Close and finish a database file.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="file_h.html#a39">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_threadfile.html#a2">Restart</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>Restart an existing database; close and re-open.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="file_h.html#a39">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_threadfile.html#a3">Fetch</a> (caddr_t address=NULL, size_t length=0, off_t position=-1)</td></tr> <tr><td> </td><td><font size=-1><em>Fetch a portion of the file into physical memory.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="file_h.html#a39">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_threadfile.html#a4">Update</a> (caddr_t address=NULL, size_t length=0, off_t position=-1)</td></tr> <tr><td> </td><td><font size=-1><em>Update a portion of a file from physical memory.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="file_h.html#a39">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_threadfile.html#a5">Append</a> (caddr_t address=NULL, size_t length=0)</td></tr> <tr><td> </td><td><font size=-1><em>Add new data to the end of the file.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>off_t </td><td valign=bottom><a class="el" href="class_threadfile.html#a6">getPosition</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>Fetch the current file position marker for this thread.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="config_h.html#a17">bool</a> </td><td valign=bottom><a class="el" href="class_threadfile.html#a7">operator++</a> (void)</td></tr> <tr><td nowrap align=right valign=top><a class="el" href="config_h.html#a17">bool</a> </td><td valign=bottom><a class="el" href="class_threadfile.html#a8">operator--</a> (void)</td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> This class defines a database I/O file service that can be shared by multiple threads. This class defines a database I/O file service that can be shared by multiple threads. <p> All threads access a global copy of the database object, and mutex locks can be used to preserve transaction integrety. pread/pwrite calls can be used for optimized I/O when supported. <p> ThreadFile is meant for use by a threaded database server where multiple threads may each perform semi-independent operations on a given database table stored on disk. A special "fcb" structure is used to hold file "state", and pread/pwrite is used whenever possible for optimized I/O. On systems that do not offer pwread/pwrite, a <a class="el" href="class_mutex.html">Mutex</a> lock is used to protect concurrent lseek and read/write operations. ThreadFile managed databases are assumed to be used only by the local server and through a single file descriptor. <p> <dl compact><dt> <b>Author(s): </b><dd> David Sugar <<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>> </dl> <p> <hr><h2>Constructor & Destructor Documentation</h2> <a name="a0" doxytag="ThreadFile::ThreadFile"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> ThreadFile::ThreadFile ( </b></td> <td valign="bottom"><b> const char * <em>path</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Open or create a new database file. <p> You should also use Initial.<dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>pathname</em> </td><td> of database to open. </td></tr> </table> </dl> </td> </tr> </table> <a name="a1" doxytag="ThreadFile::~ThreadFile"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> ThreadFile::~ThreadFile ( </b></td> <td valign="bottom"><b> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Close and finish a database file. <p> </td> </tr> </table> <hr><h2>Member Function Documentation</h2> <a name="a5" doxytag="ThreadFile::Append"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="file_h.html#a39">fileerror_t</a> ThreadFile::Append ( </b></td> <td valign="bottom"><b> caddr_t <em>address</em> = NULL, </b></td> </tr> <tr> <td></td> <td><b> size_t <em>length</em> = 0 ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Add new data to the end of the file. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>address</em> </td><td> to use, or NULL if same as last I/O. </td></tr> <tr><td valign=top><em>length</em> </td><td> to use, or 0 if same as last I/O. </td></tr> </table> </dl> </td> </tr> </table> <a name="a3" doxytag="ThreadFile::Fetch"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="file_h.html#a39">fileerror_t</a> ThreadFile::Fetch ( </b></td> <td valign="bottom"><b> caddr_t <em>address</em> = NULL, </b></td> </tr> <tr> <td></td> <td><b> size_t <em>length</em> = 0, </b></td> </tr> <tr> <td></td> <td><b> off_t <em>position</em> = - 1 ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Fetch a portion of the file into physical memory. <p> This can use state information to fetch the current record multiple times. <p> <dl compact><dt> <b>Returns: </b><dd> FILE_SUCCESS on success. </dl><dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>address</em> </td><td> to use, or NULL if same as last I/O. </td></tr> <tr><td valign=top><em>length</em> </td><td> to use, or 0 if same as last I/O. </td></tr> <tr><td valign=top><em>file</em> </td><td> position to use -1 if same as last I/O. </td></tr> </table> </dl> </td> </tr> </table> <a name="a2" doxytag="ThreadFile::Restart"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="file_h.html#a39">fileerror_t</a> ThreadFile::Restart ( </b></td> <td valign="bottom"><b> void )<code> [inline, virtual]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Restart an existing database; close and re-open. <p> <dl compact><dt> <b>Returns: </b><dd> FILE_SUCCESS if successful. </dl> <p> Reimplemented from <a class="el" href="class_randomfile.html#a3">RandomFile</a>. </td> </tr> </table> <a name="a4" doxytag="ThreadFile::Update"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="file_h.html#a39">fileerror_t</a> ThreadFile::Update ( </b></td> <td valign="bottom"><b> caddr_t <em>address</em> = NULL, </b></td> </tr> <tr> <td></td> <td><b> size_t <em>length</em> = 0, </b></td> </tr> <tr> <td></td> <td><b> off_t <em>position</em> = -1 ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Update a portion of a file from physical memory. <p> This can use state information to commit the last read record. <p> <dl compact><dt> <b>Returns: </b><dd> FILE_SUCCESS on success. </dl><dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>address</em> </td><td> to use, or NULL if same as last I/O. </td></tr> <tr><td valign=top><em>length</em> </td><td> to use, or 0 if same as last I/O. </td></tr> <tr><td valign=top><em>file</em> </td><td> position to use or -1 if same as last I/O. </td></tr> </table> </dl> </td> </tr> </table> <a name="a6" doxytag="ThreadFile::getPosition"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> off_t ThreadFile::getPosition ( </b></td> <td valign="bottom"><b> void ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Fetch the current file position marker for this thread. <p> <dl compact><dt> <b>Returns: </b><dd> file position offset. </dl> </td> </tr> </table> <a name="a7" doxytag="ThreadFile::operator++"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="config_h.html#a17">bool</a> ThreadFile::operator++ ( </b></td> <td valign="bottom"><b> void ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> </td> </tr> </table> <a name="a8" doxytag="ThreadFile::operator--"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="config_h.html#a17">bool</a> ThreadFile::operator-- ( </b></td> <td valign="bottom"><b> void ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> </td> </tr> </table> <hr>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="file_h-source.html">file.h</a></ul> <hr><address><small>Generated at Thu Oct 4 15:33:02 2001 for CommonC++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.5 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>