<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><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.10 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</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="namespacemembers.html">Namespace Members</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_8h-source.html">file.h</a>></code> <p> <p>Inheritance diagram for ThreadFile:: <p><center><img src="class_thread_file.gif" usemap="#ThreadFile_map" border="0"></center> <map name="ThreadFile_map"> <area href="class_random_file.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_thread_file-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_thread_file.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>virtual </td><td valign=bottom><a class="el" href="class_thread_file.html#a1">~ThreadFile</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Close and finish a database file.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="file_8h.html#a54">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_thread_file.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_8h.html#a54">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_thread_file.html#a3">Fetch</a> (char *address=NULL, <a class="el" href="file_8h.html#a11">ccxx_size_t</a> 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_8h.html#a54">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_thread_file.html#a4">Update</a> (char *address=NULL, <a class="el" href="file_8h.html#a11">ccxx_size_t</a> 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_8h.html#a54">fileerror_t</a> </td><td valign=bottom><a class="el" href="class_thread_file.html#a5">Append</a> (char *address=NULL, <a class="el" href="file_8h.html#a11">ccxx_size_t</a> 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_thread_file.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>bool </td><td valign=bottom><a class="el" href="class_thread_file.html#a7">operator++</a> (void)</td></tr> <tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="class_thread_file.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: </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 class="md" nowrap valign="top"> ThreadFile::ThreadFile </td> <td class="md">( </td> <td class="md">const char *</td> <td class="mdname1"> <em>path</em> </td> <td class="md">) </td> <td class="md"></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 class="md" nowrap valign="top"> virtual ThreadFile::~ThreadFile </td> <td class="md">( </td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [virtual]</code></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 class="md" nowrap valign="top"> <a class="el" href="file_8h.html#a54">fileerror_t</a> ThreadFile::Append </td> <td class="md">( </td> <td class="md">char *</td> <td class="mdname"> <em>address</em> = NULL, </td> </tr> <tr> <td></td> <td></td> <td class="md"><a class="el" href="file_8h.html#a11">ccxx_size_t</a></td> <td class="mdname"> <em>length</em> = 0</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></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 class="md" nowrap valign="top"> <a class="el" href="file_8h.html#a54">fileerror_t</a> ThreadFile::Fetch </td> <td class="md">( </td> <td class="md">char *</td> <td class="mdname"> <em>address</em> = NULL, </td> </tr> <tr> <td></td> <td></td> <td class="md"><a class="el" href="file_8h.html#a11">ccxx_size_t</a></td> <td class="mdname"> <em>length</em> = 0, </td> </tr> <tr> <td></td> <td></td> <td class="md">off_t</td> <td class="mdname"> <em>position</em> = -1</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></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 class="md" nowrap valign="top"> <a class="el" href="file_8h.html#a54">fileerror_t</a> ThreadFile::Restart </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [inline, virtual]</code></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_random_file.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 class="md" nowrap valign="top"> <a class="el" href="file_8h.html#a54">fileerror_t</a> ThreadFile::Update </td> <td class="md">( </td> <td class="md">char *</td> <td class="mdname"> <em>address</em> = NULL, </td> </tr> <tr> <td></td> <td></td> <td class="md"><a class="el" href="file_8h.html#a11">ccxx_size_t</a></td> <td class="mdname"> <em>length</em> = 0, </td> </tr> <tr> <td></td> <td></td> <td class="md">off_t</td> <td class="mdname"> <em>position</em> = -1</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></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 class="md" nowrap valign="top"> off_t ThreadFile::getPosition </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"></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 class="md" nowrap valign="top"> bool ThreadFile::operator++ </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"></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 class="md" nowrap valign="top"> bool ThreadFile::operator-- </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"></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_8h-source.html">file.h</a></ul> <hr><address><small>Generated at Tue Nov 20 13:28:51 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.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>