.TH "ost::ThreadFile" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::ThreadFile \- This class defines a database I/O file service that can be shared by multiple threads\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBost::RandomFile\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBThreadFile\fP (const char *path)" .br .RI "Open or create a new database file\&. " .ti -1c .RI "virtual \fB~ThreadFile\fP ()" .br .RI "Close and finish a database file\&. " .ti -1c .RI "\fBError\fP \fBrestart\fP (void)" .br .RI "Restart an existing database; close and re-open\&. " .ti -1c .RI "\fBError\fP \fBfetch\fP (caddr_t address=NULL, \fBccxx_size_t\fP length=0, off_t position=\-1)" .br .RI "Fetch a portion of the file into physical memory\&. " .ti -1c .RI "\fBError\fP \fBupdate\fP (caddr_t address=NULL, \fBccxx_size_t\fP length=0, off_t position=\-1)" .br .RI "Update a portion of a file from physical memory\&. " .ti -1c .RI "\fBError\fP \fBappend\fP (caddr_t address=NULL, \fBccxx_size_t\fP length=0)" .br .RI "Add new data to the end of the file\&. " .ti -1c .RI "off_t \fBgetPosition\fP (void)" .br .RI "Fetch the current file position marker for this thread\&. " .ti -1c .RI "bool \fBoperator++\fP (void)" .br .ti -1c .RI "bool \fBoperator\-\-\fP (void)" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP This class defines a database I/O file service that can be shared by multiple threads\&. 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\&. .PP \fBThreadFile\fP 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 \fBMutex\fP lock is used to protect concurrent lseek and read/write operations\&. \fBThreadFile\fP managed databases are assumed to be used only by the local server and through a single file descriptor\&. .PP \fBAuthor\fP .RS 4 David Sugar dyfet@ostel.com .RE .PP This class defines a database I/O file service that can be shared by multiple threads\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::ThreadFile::ThreadFile (const char * path)" .PP Open or create a new database file\&. You should also use Initial\&. .PP \fBParameters\fP .RS 4 \fIpath\fP pathname of database to open\&. .RE .PP .SS "virtual ost::ThreadFile::~ThreadFile ()\fC [virtual]\fP" .PP Close and finish a database file\&. .SH "Member Function Documentation" .PP .SS "\fBError\fP ost::ThreadFile::append (caddr_t address = \fCNULL\fP, \fBccxx_size_t\fP length = \fC0\fP)" .PP Add new data to the end of the file\&. .PP \fBParameters\fP .RS 4 \fIaddress\fP address to use, or NULL if same as last I/O\&. .br \fIlength\fP length to use, or 0 if same as last I/O\&. .RE .PP .SS "\fBError\fP ost::ThreadFile::fetch (caddr_t address = \fCNULL\fP, \fBccxx_size_t\fP length = \fC0\fP, off_t position = \fC\-1\fP)" .PP Fetch a portion of the file into physical memory\&. This can use state information to fetch the current record multiple times\&. .PP \fBReturns\fP .RS 4 errSuccess on success\&. .RE .PP \fBParameters\fP .RS 4 \fIaddress\fP address to use, or NULL if same as last I/O\&. .br \fIlength\fP length to use, or 0 if same as last I/O\&. .br \fIposition\fP file position to use -1 if same as last I/O\&. .RE .PP .SS "off_t ost::ThreadFile::getPosition (void)" .PP Fetch the current file position marker for this thread\&. .PP \fBReturns\fP .RS 4 file position offset\&. .RE .PP .SS "bool ost::ThreadFile::operator++ (void)" .SS "bool ost::ThreadFile::operator\-\- (void)" .SS "\fBError\fP ost::ThreadFile::restart (void)\fC [virtual]\fP" .PP Restart an existing database; close and re-open\&. .PP \fBReturns\fP .RS 4 errSuccess if successful\&. .RE .PP .PP Reimplemented from \fBost::RandomFile\fP\&. .SS "\fBError\fP ost::ThreadFile::update (caddr_t address = \fCNULL\fP, \fBccxx_size_t\fP length = \fC0\fP, off_t position = \fC\-1\fP)" .PP Update a portion of a file from physical memory\&. This can use state information to commit the last read record\&. .PP \fBReturns\fP .RS 4 errSuccess on success\&. .RE .PP \fBParameters\fP .RS 4 \fIaddress\fP address to use, or NULL if same as last I/O\&. .br \fIlength\fP length to use, or 0 if same as last I/O\&. .br \fIposition\fP file position to use or -1 if same as last I/O\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.