Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins nedprod CI <foo@nowhere>2018-06-18 23:28:54 +0300
committerJenkins nedprod CI <foo@nowhere>2018-06-18 23:28:54 +0300
commit6bce60ea3a3e6e8f1e1ffad250422669a3da20ac (patch)
tree0ba19e6877d91bd5f6326e25cb5718724ccafce7
parente059050ed4da7c58ab05a7c71a5a6077a4abcba0 (diff)
Travis CI updates documentation
-rw-r--r--classafio__v2__xxx_1_1algorithm_1_1shared__fs__mutex_1_1memory__map.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/classafio__v2__xxx_1_1algorithm_1_1shared__fs__mutex_1_1memory__map.html b/classafio__v2__xxx_1_1algorithm_1_1shared__fs__mutex_1_1memory__map.html
index c60f7d90..921a3562 100644
--- a/classafio__v2__xxx_1_1algorithm_1_1shared__fs__mutex_1_1memory__map.html
+++ b/classafio__v2__xxx_1_1algorithm_1_1shared__fs__mutex_1_1memory__map.html
@@ -277,7 +277,7 @@ template&lt;template&lt; class &gt; class Hasher = QUICKCPPLIB_NAMESPACE::algori
</table>
</div><div class="memdoc">
<p>Initialises a shared filing system mutex using the file at <em>lockfile</em>. </p><dl class="section user"><dt>Errors returnable</dt><dd>Awaiting the clang result&lt;&gt; AST parser which auto generates all the error codes which could occur, but a particularly important one is <code>errc::no_lock_available</code> which will be returned if the lock is in use by another computer on a network. </dd></dl>
-<div class="fragment"><div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; {</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; AFIO_LOG_FUNCTION_CALL(0);</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; {</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; OUTCOME_TRY(ret, <a class="code" href="classafio__v2__xxx_1_1file__handle.html#accb36f2bfd98393dc868653798c02d34">file_handle::file</a>(base, lockfile, <a class="code" href="classafio__v2__xxx_1_1handle.html#a0489b6c1e25cd2bad2ba1ec86e1aaf18aefb2a684e4afb7d55e6147fbe5a332ee">file_handle::mode::write</a>, file_handle::creation::if_needed, <a class="code" href="classafio__v2__xxx_1_1handle.html#a6f7e37c73271968271c2342023f58c9ea0fb9cf5f04f61bb6f1151da57ceb1ca1">file_handle::caching::reads</a>));</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; file_handle temph;</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; <span class="comment">// Am I the first person to this file? Lock everything exclusively</span></div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; <span class="keyword">auto</span> lockinuse = ret.try_lock(_initialisingoffset, 2, <span class="keyword">true</span>);</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordflow">if</span>(lockinuse.has_error())</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; {</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="keywordflow">if</span>(lockinuse.error() != errc::timed_out)</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; {</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="keywordflow">return</span> lockinuse.error();</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; }</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="comment">// Somebody else is also using this file, so try to read the hash index file I ought to use</span></div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; lockinuse = ret.lock(_lockinuseoffset, 1, <span class="keyword">false</span>); <span class="comment">// inuse shared access, blocking</span></div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordflow">if</span>(!lockinuse)</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; {</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="keywordflow">return</span> lockinuse.error();</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; }</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; byte buffer[65536];</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; memset(buffer, 0, <span class="keyword">sizeof</span>(buffer));</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; OUTCOME_TRYV(ret.read(0, {{buffer, 65535}}));</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; path_view temphpath(reinterpret_cast&lt;filesystem::path::value_type *&gt;(buffer));</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; result&lt;file_handle&gt; _temph(in_place_type&lt;file_handle&gt;);</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; _temph = <a class="code" href="classafio__v2__xxx_1_1file__handle.html#accb36f2bfd98393dc868653798c02d34">file_handle::file</a>({}, temphpath, <a class="code" href="classafio__v2__xxx_1_1handle.html#a0489b6c1e25cd2bad2ba1ec86e1aaf18aefb2a684e4afb7d55e6147fbe5a332ee">file_handle::mode::write</a>, file_handle::creation::open_existing, <a class="code" href="classafio__v2__xxx_1_1handle.html#a6f7e37c73271968271c2342023f58c9ead5197d93c063a2b1e22d1630a39b7aef">file_handle::caching::temporary</a>);</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <span class="comment">// If temp file doesn&#39;t exist, I am on a different machine</span></div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <span class="keywordflow">if</span>(!_temph)</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; {</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; <span class="comment">// Release the exclusive lock and tell caller that this lock is not available</span></div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; <span class="keywordflow">return</span> errc::no_lock_available;</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; }</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; temph = std::move(_temph.value());</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="comment">// Map the hash index file into memory for read/write access</span></div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; OUTCOME_TRY(temphsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(temph, HashIndexSize));</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; OUTCOME_TRY(temphmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(temphsection, HashIndexSize));</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="comment">// Map the path file into memory with its maximum possible size, read only</span></div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; OUTCOME_TRY(hsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(ret, 65536, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; OUTCOME_TRY(hmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(hsection, 0, 0, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <span class="keywordflow">return</span> memory_map(std::move(ret), std::move(temph), std::move(lockinuse.value()), std::move(hmap), std::move(temphmap));</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; }</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="comment">// I am the first person to be using this (stale?) file, so create a new hash index file in /tmp</span></div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; <span class="keyword">auto</span> &amp;tempdirh = <a class="code" href="namespaceafio__v2__xxx_1_1path__discovery.html#ae34df4ad4e4f2c977ef99575713fd9bf">path_discovery::memory_backed_temporary_files_directory</a>().<a class="code" href="classafio__v2__xxx_1_1handle.html#a4194a05dd9694d2c47d5a45f925db1d7">is_valid</a>() ? <a class="code" href="namespaceafio__v2__xxx_1_1path__discovery.html#ae34df4ad4e4f2c977ef99575713fd9bf">path_discovery::memory_backed_temporary_files_directory</a>() : path_discovery::<a class="code" href="namespaceafio__v2__xxx_1_1path__discovery.html#af398b6c3762f60aa96cebd270879093e">storage_backed_temporary_files_directory</a>();</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; OUTCOME_TRY(_temph, <a class="code" href="classafio__v2__xxx_1_1file__handle.html#a7fdd164a8af6542c5fb80c514283c585">file_handle::random_file</a>(tempdirh));</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; temph = std::move(_temph);</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="comment">// Truncate it out to the hash index size, and map it into memory for read/write access</span></div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; OUTCOME_TRYV(temph.truncate(HashIndexSize));</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; OUTCOME_TRY(temphsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(temph, HashIndexSize));</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; OUTCOME_TRY(temphmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(temphsection, HashIndexSize));</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="comment">// Write the path of my new hash index file, padding zeros to the nearest page size</span></div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; <span class="comment">// multiple to work around a race condition in the Linux kernel</span></div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; OUTCOME_TRY(temppath, temph.current_path());</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="keywordtype">char</span> buffer[4096];</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; memset(buffer, 0, <span class="keyword">sizeof</span>(buffer));</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; <span class="keywordtype">size_t</span> bytes = temppath.native().size() * <span class="keyword">sizeof</span>(*temppath.c_str());</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; file_handle::const_buffer_type buffers[] = {{<span class="keyword">reinterpret_cast&lt;</span><span class="keyword">const </span>byte *<span class="keyword">&gt;</span>(temppath.c_str()), bytes}, {<span class="keyword">reinterpret_cast&lt;</span><span class="keyword">const </span>byte *<span class="keyword">&gt;</span>(buffer), 4096 - (bytes % 4096)}};</div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; OUTCOME_TRYV(ret.truncate(65536));</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; OUTCOME_TRYV(ret.write({buffers, 0}));</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; <span class="comment">// Map for read the maximum possible path file size, again to avoid race problems</span></div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; OUTCOME_TRY(hsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(ret, 65536, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; OUTCOME_TRY(hmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(hsection, 0, 0, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="comment">/* Take shared locks on inuse. Even if this implementation doesn&#39;t implement</span></div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160;<span class="comment"> atomic downgrade of exclusive range to shared range, we&#39;re fully prepared for other users</span></div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;<span class="comment"> now. The _initialisingoffset remains exclusive to prevent double entry into this init routine.</span></div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; OUTCOME_TRY(lockinuse2, ret.lock(_lockinuseoffset, 1, <span class="keyword">false</span>));</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; lockinuse = std::move(lockinuse2); <span class="comment">// releases exclusive lock on all three offsets</span></div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordflow">return</span> memory_map(std::move(ret), std::move(temph), std::move(lockinuse.value()), std::move(hmap), std::move(temphmap));</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; }</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160; <span class="keywordflow">catch</span>(...)</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; {</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordflow">return</span> error_from_exception();</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; }</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; }</div><div class="ttc" id="classafio__v2__xxx_1_1handle_html_a6f7e37c73271968271c2342023f58c9ea0fb9cf5f04f61bb6f1151da57ceb1ca1"><div class="ttname"><a href="classafio__v2__xxx_1_1handle.html#a6f7e37c73271968271c2342023f58c9ea0fb9cf5f04f61bb6f1151da57ceb1ca1">afio_v2_xxx::handle::caching::reads</a></div><div class="ttdoc">Cache reads only. Writes of data and metadata do not complete until reaching storage (O_SYNC)...</div></div>
+<div class="fragment"><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; {</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; AFIO_LOG_FUNCTION_CALL(0);</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; {</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; OUTCOME_TRY(ret, <a class="code" href="classafio__v2__xxx_1_1file__handle.html#accb36f2bfd98393dc868653798c02d34">file_handle::file</a>(base, lockfile, <a class="code" href="classafio__v2__xxx_1_1handle.html#a0489b6c1e25cd2bad2ba1ec86e1aaf18aefb2a684e4afb7d55e6147fbe5a332ee">file_handle::mode::write</a>, file_handle::creation::if_needed, <a class="code" href="classafio__v2__xxx_1_1handle.html#a6f7e37c73271968271c2342023f58c9ea0fb9cf5f04f61bb6f1151da57ceb1ca1">file_handle::caching::reads</a>));</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; file_handle temph;</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="comment">// Am I the first person to this file? Lock everything exclusively</span></div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <span class="keyword">auto</span> lockinuse = ret.try_lock(_initialisingoffset, 2, <span class="keyword">true</span>);</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">if</span>(lockinuse.has_error())</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; {</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordflow">if</span>(lockinuse.error() != errc::timed_out)</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; {</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="keywordflow">return</span> lockinuse.error();</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; }</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; <span class="comment">// Somebody else is also using this file, so try to read the hash index file I ought to use</span></div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; lockinuse = ret.lock(_lockinuseoffset, 1, <span class="keyword">false</span>); <span class="comment">// inuse shared access, blocking</span></div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <span class="keywordflow">if</span>(!lockinuse)</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; {</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; <span class="keywordflow">return</span> lockinuse.error();</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; }</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; byte buffer[65536];</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; memset(buffer, 0, <span class="keyword">sizeof</span>(buffer));</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; OUTCOME_TRYV(ret.read(0, {{buffer, 65535}}));</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; path_view temphpath(reinterpret_cast&lt;filesystem::path::value_type *&gt;(buffer));</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; result&lt;file_handle&gt; _temph(in_place_type&lt;file_handle&gt;);</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; _temph = <a class="code" href="classafio__v2__xxx_1_1file__handle.html#accb36f2bfd98393dc868653798c02d34">file_handle::file</a>({}, temphpath, <a class="code" href="classafio__v2__xxx_1_1handle.html#a0489b6c1e25cd2bad2ba1ec86e1aaf18aefb2a684e4afb7d55e6147fbe5a332ee">file_handle::mode::write</a>, file_handle::creation::open_existing, <a class="code" href="classafio__v2__xxx_1_1handle.html#a6f7e37c73271968271c2342023f58c9ead5197d93c063a2b1e22d1630a39b7aef">file_handle::caching::temporary</a>);</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="comment">// If temp file doesn&#39;t exist, I am on a different machine</span></div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordflow">if</span>(!_temph)</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; {</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="comment">// Release the exclusive lock and tell caller that this lock is not available</span></div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="keywordflow">return</span> errc::no_lock_available;</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; }</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; temph = std::move(_temph.value());</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <span class="comment">// Map the hash index file into memory for read/write access</span></div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; OUTCOME_TRY(temphsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(temph, HashIndexSize));</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; OUTCOME_TRY(temphmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(temphsection, HashIndexSize));</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="comment">// Map the path file into memory with its maximum possible size, read only</span></div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; OUTCOME_TRY(hsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(ret, 65536, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; OUTCOME_TRY(hmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(hsection, 0, 0, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; <span class="keywordflow">return</span> memory_map(std::move(ret), std::move(temph), std::move(lockinuse.value()), std::move(hmap), std::move(temphmap));</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; }</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="comment">// I am the first person to be using this (stale?) file, so create a new hash index file in /tmp</span></div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="keyword">auto</span> &amp;tempdirh = <a class="code" href="namespaceafio__v2__xxx_1_1path__discovery.html#ae34df4ad4e4f2c977ef99575713fd9bf">path_discovery::memory_backed_temporary_files_directory</a>().<a class="code" href="classafio__v2__xxx_1_1handle.html#a4194a05dd9694d2c47d5a45f925db1d7">is_valid</a>() ? <a class="code" href="namespaceafio__v2__xxx_1_1path__discovery.html#ae34df4ad4e4f2c977ef99575713fd9bf">path_discovery::memory_backed_temporary_files_directory</a>() : path_discovery::<a class="code" href="namespaceafio__v2__xxx_1_1path__discovery.html#af398b6c3762f60aa96cebd270879093e">storage_backed_temporary_files_directory</a>();</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; OUTCOME_TRY(_temph, <a class="code" href="classafio__v2__xxx_1_1file__handle.html#a7fdd164a8af6542c5fb80c514283c585">file_handle::random_file</a>(tempdirh));</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; temph = std::move(_temph);</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="comment">// Truncate it out to the hash index size, and map it into memory for read/write access</span></div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; OUTCOME_TRYV(temph.truncate(HashIndexSize));</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; OUTCOME_TRY(temphsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(temph, HashIndexSize));</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; OUTCOME_TRY(temphmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(temphsection, HashIndexSize));</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="comment">// Write the path of my new hash index file, padding zeros to the nearest page size</span></div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="comment">// multiple to work around a race condition in the Linux kernel</span></div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; OUTCOME_TRY(temppath, temph.current_path());</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; <span class="keywordtype">char</span> buffer[4096];</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; memset(buffer, 0, <span class="keyword">sizeof</span>(buffer));</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <span class="keywordtype">size_t</span> bytes = temppath.native().size() * <span class="keyword">sizeof</span>(*temppath.c_str());</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; file_handle::const_buffer_type buffers[] = {{<span class="keyword">reinterpret_cast&lt;</span><span class="keyword">const </span>byte *<span class="keyword">&gt;</span>(temppath.c_str()), bytes}, {<span class="keyword">reinterpret_cast&lt;</span><span class="keyword">const </span>byte *<span class="keyword">&gt;</span>(buffer), 4096 - (bytes % 4096)}};</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; OUTCOME_TRYV(ret.truncate(65536));</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; OUTCOME_TRYV(ret.write({buffers, 0}));</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="comment">// Map for read the maximum possible path file size, again to avoid race problems</span></div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; OUTCOME_TRY(hsection, <a class="code" href="classafio__v2__xxx_1_1section__handle.html#a7e69ae5094da2517f2ed0bd046d18302">section_handle::section</a>(ret, 65536, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; OUTCOME_TRY(hmap, <a class="code" href="classafio__v2__xxx_1_1map__handle.html#a9c43d182b257682d320f12f6e6be30b3">map_handle::map</a>(hsection, 0, 0, <a class="code" href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">section_handle::flag::read</a>));</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="comment">/* Take shared locks on inuse. Even if this implementation doesn&#39;t implement</span></div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160;<span class="comment"> atomic downgrade of exclusive range to shared range, we&#39;re fully prepared for other users</span></div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;<span class="comment"> now. The _initialisingoffset remains exclusive to prevent double entry into this init routine.</span></div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; OUTCOME_TRY(lockinuse2, ret.lock(_lockinuseoffset, 1, <span class="keyword">false</span>));</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; lockinuse = std::move(lockinuse2); <span class="comment">// releases exclusive lock on all three offsets</span></div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; <span class="keywordflow">return</span> memory_map(std::move(ret), std::move(temph), std::move(lockinuse.value()), std::move(hmap), std::move(temphmap));</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; }</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; <span class="keywordflow">catch</span>(...)</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; {</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160; <span class="keywordflow">return</span> error_from_exception();</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; }</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; }</div><div class="ttc" id="classafio__v2__xxx_1_1handle_html_a6f7e37c73271968271c2342023f58c9ea0fb9cf5f04f61bb6f1151da57ceb1ca1"><div class="ttname"><a href="classafio__v2__xxx_1_1handle.html#a6f7e37c73271968271c2342023f58c9ea0fb9cf5f04f61bb6f1151da57ceb1ca1">afio_v2_xxx::handle::caching::reads</a></div><div class="ttdoc">Cache reads only. Writes of data and metadata do not complete until reaching storage (O_SYNC)...</div></div>
<div class="ttc" id="namespaceafio__v2__xxx_html_a3cff8f3910dbf47663e5df1dc7e5ba47"><div class="ttname"><a href="namespaceafio__v2__xxx.html#a3cff8f3910dbf47663e5df1dc7e5ba47">afio_v2_xxx::read</a></div><div class="ttdeci">io_handle::io_result&lt; io_handle::buffers_type &gt; read(io_handle &amp;self, io_handle::io_request&lt; io_handle::buffers_type &gt; reqs, deadline d=deadline()) noexcept</div><div class="ttdoc">Read data from the open handle. </div><div class="ttdef"><b>Definition:</b> io_handle.hpp:483</div></div>
<div class="ttc" id="namespaceafio__v2__xxx_1_1path__discovery_html_af398b6c3762f60aa96cebd270879093e"><div class="ttname"><a href="namespaceafio__v2__xxx_1_1path__discovery.html#af398b6c3762f60aa96cebd270879093e">afio_v2_xxx::path_discovery::storage_backed_temporary_files_directory</a></div><div class="ttdeci">const path_handle &amp; storage_backed_temporary_files_directory() noexcept</div><div class="ttdoc">Returns a reference to an open handle to a verified temporary directory where files created are store...</div></div>
<div class="ttc" id="namespaceafio__v2__xxx_1_1path__discovery_html_ae34df4ad4e4f2c977ef99575713fd9bf"><div class="ttname"><a href="namespaceafio__v2__xxx_1_1path__discovery.html#ae34df4ad4e4f2c977ef99575713fd9bf">afio_v2_xxx::path_discovery::memory_backed_temporary_files_directory</a></div><div class="ttdeci">const path_handle &amp; memory_backed_temporary_files_directory() noexcept</div><div class="ttdoc">Returns a reference to an open handle to a verified temporary directory where files created are store...</div></div>