|
|
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.
ThreadFile (const char *path) |
Open or create a new database file. You should also use Initial.
Parameters:
pathname | of database to open. |
~ThreadFile () |
Close and finish a database file.
fileerror_t Restart (void) |
Restart an existing database; close and re-open.
Returns: FILE_SUCCESS if successful.
Reimplemented from RandomFile
fileerror_t Fetch (void *address = NULL, size_t length = 0, off_t position = - 1) |
Fetch a portion of the file into physical memory. This can use state information to fetch the current record multiple times.
Parameters:
address | to use, or NULL if same as last I/O. |
length | to use, or 0 if same as last I/O. |
file | position to use -1 if same as last I/O. |
Returns: FILE_SUCCESS on success.
fileerror_t Update (void *address = NULL, size_t length = 0, off_t position = -1) |
Update a portion of a file from physical memory. This can use state information to commit the last read record.
Parameters:
address | to use, or NULL if same as last I/O. |
length | to use, or 0 if same as last I/O. |
file | position to use or -1 if same as last I/O. |
Returns: FILE_SUCCESS on success.
fileerror_t Append (void *address = NULL, size_t length = 0) |
Add new data to the end of the file.
Parameters:
address | to use, or NULL if same as last I/O. |
length | to use, or 0 if same as last I/O. |
off_t getPosition (void) |
Fetch the current file position marker for this thread.
Returns: file position offset.
Generated by: dyfet@home.sys on Tue Apr 18 21:24:04 200. |