File: classPassenger_1_1FileChangeChecker.html

package info (click to toggle)
passenger 2.2.11debian-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,576 kB
  • ctags: 28,138
  • sloc: cpp: 66,323; ruby: 9,646; ansic: 2,425; python: 141; sh: 56; makefile: 29
file content (166 lines) | stat: -rw-r--r-- 10,593 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
160
161
162
163
164
165
166
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Passenger: Passenger::FileChangeChecker Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespacePassenger.html">Passenger</a>::<a class="el" href="classPassenger_1_1FileChangeChecker.html">FileChangeChecker</a>
  </div>
</div>
<div class="contents">
<h1>Passenger::FileChangeChecker Class Reference</h1><!-- doxytag: class="Passenger::FileChangeChecker" -->A utility class for checking for file changes.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="FileChangeChecker_8h-source.html">FileChangeChecker.h</a>&gt;</code>
<p>

<p>
<a href="classPassenger_1_1FileChangeChecker-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileChangeChecker.html#cedaa0a0ed0be509dbbd79abaec25f26">FileChangeChecker</a> (unsigned int maxSize=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a <a class="el" href="classPassenger_1_1FileChangeChecker.html" title="A utility class for checking for file changes.">FileChangeChecker</a> object.  <a href="#cedaa0a0ed0be509dbbd79abaec25f26"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileChangeChecker.html#52837a877522fb64d70ee1ba965e9135">changed</a> (const string &amp;filename, unsigned int throttleRate=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Checks whether, since the last call to <a class="el" href="classPassenger_1_1FileChangeChecker.html#52837a877522fb64d70ee1ba965e9135" title="Checks whether, since the last call to changed() with this filename, the file&#39;s...">changed()</a> with this filename, the file's timestamp has changed or whether the file has been created or removed.  <a href="#52837a877522fb64d70ee1ba965e9135"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileChangeChecker.html#5055aae067b41fc5fe11747a04b0a1dd">setMaxSize</a> (unsigned int maxSize)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Change the maximum size of the internal file list.  <a href="#5055aae067b41fc5fe11747a04b0a1dd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3fb03c747d95f49bddec9e2ca8e8694f"></a><!-- doxytag: member="Passenger::FileChangeChecker::knows" ref="3fb03c747d95f49bddec9e2ca8e8694f" args="(const string &amp;filename) const " -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1FileChangeChecker.html#3fb03c747d95f49bddec9e2ca8e8694f">knows</a> (const string &amp;filename) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether <code>filename</code> is in the internal file list. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A utility class for checking for file changes. 
<p>
Example:<p>
<div class="fragment"><pre class="fragment"> <a class="code" href="classPassenger_1_1FileChangeChecker.html#cedaa0a0ed0be509dbbd79abaec25f26" title="Create a FileChangeChecker object.">FileChangeChecker</a> checker;
 checker.changed(<span class="stringliteral">"foo.txt"</span>);   <span class="comment">// false</span>
 writeToFile(<span class="stringliteral">"foo.txt"</span>);
 checker.changed(<span class="stringliteral">"foo.txt"</span>);   <span class="comment">// true</span>
 checker.changed(<span class="stringliteral">"foo.txt"</span>);   <span class="comment">// false</span>
</pre></div><p>
<a class="el" href="classPassenger_1_1FileChangeChecker.html" title="A utility class for checking for file changes.">FileChangeChecker</a> uses stat() to retrieve file information. It also supports throttling in order to limit the number of actual stat() calls. This can improve performance on systems where disk I/O is a problem. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="cedaa0a0ed0be509dbbd79abaec25f26"></a><!-- doxytag: member="Passenger::FileChangeChecker::FileChangeChecker" ref="cedaa0a0ed0be509dbbd79abaec25f26" args="(unsigned int maxSize=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Passenger::FileChangeChecker::FileChangeChecker           </td>
          <td>(</td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>maxSize</em> = <code>0</code>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create a <a class="el" href="classPassenger_1_1FileChangeChecker.html" title="A utility class for checking for file changes.">FileChangeChecker</a> object. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>maxSize</em>&nbsp;</td><td>The maximum size of the internal file list. A size of 0 means unlimited. </td></tr>
  </table>
</dl>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="52837a877522fb64d70ee1ba965e9135"></a><!-- doxytag: member="Passenger::FileChangeChecker::changed" ref="52837a877522fb64d70ee1ba965e9135" args="(const string &amp;filename, unsigned int throttleRate=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Passenger::FileChangeChecker::changed           </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&nbsp;</td>
          <td class="paramname"> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>throttleRate</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Checks whether, since the last call to <a class="el" href="classPassenger_1_1FileChangeChecker.html#52837a877522fb64d70ee1ba965e9135" title="Checks whether, since the last call to changed() with this filename, the file&#39;s...">changed()</a> with this filename, the file's timestamp has changed or whether the file has been created or removed. 
<p>
If the stat() call fails for any other reason (e.g. the directory is not readable) then this method will return false.<p>
If this method was called with this filename for the first time, or if information about this file has since been removed from the internal file list, then this method will return whether the file is stat()-able. That is, if the file doesn't exist then it will return false, but if the directory is not readable then it will also return false.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>The file to check. Note that two different filename strings are treated as two different files, so you should use absolute filenames if you change working directory often. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>throttleRate</em>&nbsp;</td><td>When set to a non-zero value, throttling will be enabled. stat() will be called at most once per throttleRate seconds. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1TimeRetrievalException.html" title="Unable to retrieve the system time using time().">TimeRetrievalException</a></em>&nbsp;</td><td>Something went wrong while retrieving the system time. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em>&nbsp;</td><td></td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="5055aae067b41fc5fe11747a04b0a1dd"></a><!-- doxytag: member="Passenger::FileChangeChecker::setMaxSize" ref="5055aae067b41fc5fe11747a04b0a1dd" args="(unsigned int maxSize)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Passenger::FileChangeChecker::setMaxSize           </td>
          <td>(</td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>maxSize</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Change the maximum size of the internal file list. 
<p>
A size of 0 means unlimited. 
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="FileChangeChecker_8h-source.html">FileChangeChecker.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Feb 8 22:53:23 2010 for Passenger by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>