File: ThreadFile.3cc

package info (click to toggle)
libcommoncpp2 1.0.13-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,740 kB
  • ctags: 2,860
  • sloc: cpp: 18,857; sh: 8,451; ansic: 1,546; makefile: 299; xml: 5
file content (159 lines) | stat: -rw-r--r-- 4,681 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
.TH "ThreadFile" 3 "19 Jul 2003" "CommonC++" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ThreadFile \- 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. 
.SH SYNOPSIS
.br
.PP
\fC#include <file.h>\fP
.PP
Inherits \fBRandomFile\fP.
.PP
.SS "Public Methods"

.in +1c
.ti -1c
.RI "\fBThreadFile\fP (const char *path)"
.br
.RI "\fIOpen or create a new database file.\fP"
.ti -1c
.RI "virtual \fB~ThreadFile\fP ()"
.br
.RI "\fIClose and finish a database file.\fP"
.ti -1c
.RI "\fBError\fP \fBrestart\fP (void)"
.br
.RI "\fIRestart an existing database; close and re-open.\fP"
.ti -1c
.RI "\fBError\fP \fBfetch\fP (char *address=NULL, \fBccxx_size_t\fP length=0, off_t position=-1)"
.br
.RI "\fIFetch a portion of the file into physical memory.\fP"
.ti -1c
.RI "\fBError\fP \fBupdate\fP (char *address=NULL, \fBccxx_size_t\fP length=0, off_t position=-1)"
.br
.RI "\fIUpdate a portion of a file from physical memory.\fP"
.ti -1c
.RI "\fBError\fP \fBappend\fP (char *address=NULL, \fBccxx_size_t\fP length=0)"
.br
.RI "\fIAdd new data to the end of the file.\fP"
.ti -1c
.RI "off_t \fBgetPosition\fP (void)"
.br
.RI "\fIFetch the current file position marker for this thread.\fP"
.ti -1c
.RI "bool \fBoperator++\fP (void)"
.br
.ti -1c
.RI "bool \fBoperator--\fP (void)"
.br
.in -1c
.SH "DETAILED DESCRIPTION"
.PP 
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.
.PP
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
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 \fBMutex\fP 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.
.PP
\fBAuthor: \fP
.in +1c
David Sugar <dyfet@ostel.com> 
.PP
.SH "CONSTRUCTOR & DESTRUCTOR DOCUMENTATION"
.PP 
.SS "ThreadFile::ThreadFile (const char * path)"
.PP
Open or create a new database file.
.PP
You should also use Initial.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIpath\fP\fP
pathname of database to open. 
.SS "virtual ThreadFile::~ThreadFile ()\fC [virtual]\fP"
.PP
Close and finish a database file.
.PP
.SH "MEMBER FUNCTION DOCUMENTATION"
.PP 
.SS "\fBError\fP ThreadFile::append (char * address = NULL, \fBccxx_size_t\fP length = 0)"
.PP
Add new data to the end of the file.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIaddress\fP\fP
address to use, or NULL if same as last I/O. 
.TP
\fB\fIlength\fP\fP
length to use, or 0 if same as last I/O. 
.SS "\fBError\fP ThreadFile::fetch (char * address = NULL, \fBccxx_size_t\fP length = 0, off_t position = -1)"
.PP
Fetch a portion of the file into physical memory.
.PP
This can use state information to fetch the current record multiple times.
.PP
\fBReturns: \fP
.in +1c
errSuccess on success. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIaddress\fP\fP
address to use, or NULL if same as last I/O. 
.TP
\fB\fIlength\fP\fP
length to use, or 0 if same as last I/O. 
.TP
\fB\fIposition\fP\fP
file position to use -1 if same as last I/O. 
.SS "off_t ThreadFile::getPosition (void)"
.PP
Fetch the current file position marker for this thread.
.PP
\fBReturns: \fP
.in +1c
file position offset. 
.SS "bool ThreadFile::operator++ (void)"
.PP
.SS "bool ThreadFile::operator-- (void)"
.PP
.SS "\fBError\fP ThreadFile::restart (void)\fC [inline, virtual]\fP"
.PP
Restart an existing database; close and re-open.
.PP
\fBReturns: \fP
.in +1c
errSuccess if successful. 
.PP
Reimplemented from \fBRandomFile\fP.
.SS "\fBError\fP ThreadFile::update (char * address = NULL, \fBccxx_size_t\fP length = 0, off_t position = -1)"
.PP
Update a portion of a file from physical memory.
.PP
This can use state information to commit the last read record.
.PP
\fBReturns: \fP
.in +1c
errSuccess on success. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIaddress\fP\fP
address to use, or NULL if same as last I/O. 
.TP
\fB\fIlength\fP\fP
length to use, or 0 if same as last I/O. 
.TP
\fB\fIposition\fP\fP
file position to use or -1 if same as last I/O. 

.SH "AUTHOR"
.PP 
Generated automatically by Doxygen for CommonC++ from the source code.