mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 11:35:53 +00:00
deploy: 020b285808
This commit is contained in:
242
BatchWriter_8cpp_source.html
Normal file
242
BatchWriter_8cpp_source.html
Normal file
@@ -0,0 +1,242 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.17"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>rippled: BatchWriter.cpp Source File</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">rippled
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.17 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div id="nav-path" class="navpath">
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="dir_df9c78dcf3f59a33b12284f95992a64b.html">ripple</a></li><li class="navelem"><a class="el" href="dir_ceb6d1bc218d15504336f945ff1322da.html">nodestore</a></li><li class="navelem"><a class="el" href="dir_1eae1e3c362aa357dbf8694343222a03.html">impl</a></li> </ul>
|
||||
</div>
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">BatchWriter.cpp</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">//------------------------------------------------------------------------------</span></div>
|
||||
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">/*</span></div>
|
||||
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> This file is part of rippled: https://github.com/ripple/rippled</span></div>
|
||||
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> Copyright (c) 2012, 2013 Ripple Labs Inc.</span></div>
|
||||
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> Permission to use, copy, modify, and/or distribute this software for any</span></div>
|
||||
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> purpose with or without fee is hereby granted, provided that the above</span></div>
|
||||
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> copyright notice and this permission notice appear in all copies.</span></div>
|
||||
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES</span></div>
|
||||
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF</span></div>
|
||||
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR</span></div>
|
||||
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES</span></div>
|
||||
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN</span></div>
|
||||
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF</span></div>
|
||||
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</span></div>
|
||||
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">*/</span></div>
|
||||
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment">//==============================================================================</span></div>
|
||||
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  </div>
|
||||
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include <ripple/nodestore/impl/BatchWriter.h></span></div>
|
||||
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  </div>
|
||||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">namespace </span><a class="code" href="namespaceripple.html">ripple</a> {</div>
|
||||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">namespace </span>NodeStore {</div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  </div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="classripple_1_1NodeStore_1_1BatchWriter.html#ad2bd82080d5ae1a6f10eac76d6ef7874"> 25</a></span> <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#ad2bd82080d5ae1a6f10eac76d6ef7874">BatchWriter::BatchWriter</a> (<a class="code" href="structripple_1_1NodeStore_1_1BatchWriter_1_1Callback.html">Callback</a>& callback, <a class="code" href="classripple_1_1NodeStore_1_1Scheduler.html">Scheduler</a>& scheduler)</div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  : m_callback (callback)</div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  , m_scheduler (scheduler)</div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  , mWriteLoad (0)</div>
|
||||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  , mWritePending (false)</div>
|
||||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> {</div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3764d56b2e80ee3345a2427f06192abb">mWriteSet</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/container/vector/reserve.html">reserve</a> (<a class="code" href="namespaceripple_1_1NodeStore.html#a462140731267cdb1df0c7759a9a31512a3e7cbb590a2149da2328925f4ac5978a">batchWritePreallocationSize</a>);</div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> }</div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  </div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="classripple_1_1NodeStore_1_1BatchWriter.html#af79bad700133763e550a4750fcae40d7"> 34</a></span> <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#af79bad700133763e550a4750fcae40d7">BatchWriter::~BatchWriter</a> ()</div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> {</div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3fe23bec6b7c7fd4a4ca7c954241930c">waitForWriting</a> ();</div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> }</div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  </div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="keywordtype">void</span></div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classripple_1_1NodeStore_1_1BatchWriter.html#a42b3434b00f66603124653fbf691ad26"> 40</a></span> <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a42b3434b00f66603124653fbf691ad26">BatchWriter::store</a> (<a class="codeRef" href="http://en.cppreference.com/w/cpp/memory/shared_ptr.html">std::shared_ptr<NodeObject></a> <span class="keyword">const</span>& <span class="keywordtype">object</span>)</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> {</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/thread/unique_lock.html">std::unique_lock</a><decltype(<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a8446bde66ae915ce1e8a23c1d9e03932">mWriteMutex</a>)> sl (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a8446bde66ae915ce1e8a23c1d9e03932">mWriteMutex</a>);</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  </div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="comment">// If the batch has reached its limit, we wait</span></div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="comment">// until the batch writer is finished</span></div>
|
||||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keywordflow">while</span> (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3764d56b2e80ee3345a2427f06192abb">mWriteSet</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() >= <a class="code" href="namespaceripple_1_1NodeStore.html#a462140731267cdb1df0c7759a9a31512a03b8818e1ee729cf3a62bf6697aff257">batchWriteLimitSize</a>)</div>
|
||||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#ae99b6e34ec47a86bcdc8de5a5a49eff4">mWriteCondition</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/thread/condition_variable_any/wait.html">wait</a> (sl);</div>
|
||||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  </div>
|
||||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3764d56b2e80ee3345a2427f06192abb">mWriteSet</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a> (<span class="keywordtype">object</span>);</div>
|
||||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  </div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">if</span> (! <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a0dac1815fb23e64b1d0a63d4595a816f">mWritePending</a>)</div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  {</div>
|
||||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a0dac1815fb23e64b1d0a63d4595a816f">mWritePending</a> = <span class="keyword">true</span>;</div>
|
||||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  </div>
|
||||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a45c6abdc7dcdc3cdb4a8c1e3bfac8cd8">m_scheduler</a>.<a class="code" href="classripple_1_1NodeStore_1_1Scheduler.html#af3734617d65f9903e3b33d3ee6de8102">scheduleTask</a> (*<span class="keyword">this</span>);</div>
|
||||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  }</div>
|
||||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> }</div>
|
||||
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  </div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="keywordtype">int</span></div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="classripple_1_1NodeStore_1_1BatchWriter.html#a51dceb04c1517ed641e90a51c5a9ea1b"> 60</a></span> <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a51dceb04c1517ed641e90a51c5a9ea1b">BatchWriter::getWriteLoad</a> ()</div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> {</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/thread/lock_guard.html">std::lock_guard</a> sl (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a8446bde66ae915ce1e8a23c1d9e03932">mWriteMutex</a>);</div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  </div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">return</span> <a class="codeRef" href="http://en.cppreference.com/w/cpp/algorithm/max.html">std::max</a> (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a90833868dbf5ca5fcb5840d8ead21f3a">mWriteLoad</a>, <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span> (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3764d56b2e80ee3345a2427f06192abb">mWriteSet</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a> ()));</div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> }</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  </div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="keywordtype">void</span></div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="classripple_1_1NodeStore_1_1BatchWriter.html#aafd94fab31d667c79c53ae2f5b770778"> 68</a></span> <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#aafd94fab31d667c79c53ae2f5b770778">BatchWriter::performScheduledTask</a> ()</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> {</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#ac9098b71490f289b477b5365d98cafee">writeBatch</a> ();</div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> }</div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  </div>
|
||||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">void</span></div>
|
||||
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classripple_1_1NodeStore_1_1BatchWriter.html#ac9098b71490f289b477b5365d98cafee"> 74</a></span> <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#ac9098b71490f289b477b5365d98cafee">BatchWriter::writeBatch</a> ()</div>
|
||||
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> {</div>
|
||||
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">for</span> (;;)</div>
|
||||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  {</div>
|
||||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector< std::shared_ptr<NodeObject></a> > <a class="code" href="namespaceripple.html#a53f80df10254751781250aa20704e98f">set</a>;</div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  </div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <a class="code" href="namespaceripple.html#a53f80df10254751781250aa20704e98f">set</a>.reserve (<a class="code" href="namespaceripple_1_1NodeStore.html#a462140731267cdb1df0c7759a9a31512a3e7cbb590a2149da2328925f4ac5978a">batchWritePreallocationSize</a>);</div>
|
||||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  </div>
|
||||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  {</div>
|
||||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/thread/lock_guard.html">std::lock_guard</a> sl (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a8446bde66ae915ce1e8a23c1d9e03932">mWriteMutex</a>);</div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  </div>
|
||||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3764d56b2e80ee3345a2427f06192abb">mWriteSet</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/container/vector/swap.html">swap</a> (<a class="code" href="namespaceripple.html#a53f80df10254751781250aa20704e98f">set</a>);</div>
|
||||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  assert (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3764d56b2e80ee3345a2427f06192abb">mWriteSet</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/container/vector/empty.html">empty</a> ());</div>
|
||||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a90833868dbf5ca5fcb5840d8ead21f3a">mWriteLoad</a> = <a class="code" href="namespaceripple.html#a53f80df10254751781250aa20704e98f">set</a>.size ();</div>
|
||||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  </div>
|
||||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="keywordflow">if</span> (<a class="code" href="namespaceripple.html#a53f80df10254751781250aa20704e98f">set</a>.empty ())</div>
|
||||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  {</div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a0dac1815fb23e64b1d0a63d4595a816f">mWritePending</a> = <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#ae99b6e34ec47a86bcdc8de5a5a49eff4">mWriteCondition</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/thread/condition_variable_any/notify_all.html">notify_all</a> ();</div>
|
||||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  </div>
|
||||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="comment">// VFALCO NOTE Fix this function to not return from the middle</span></div>
|
||||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  }</div>
|
||||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  </div>
|
||||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  }</div>
|
||||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  </div>
|
||||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <a class="code" href="structripple_1_1NodeStore_1_1BatchWriteReport.html">BatchWriteReport</a> report;</div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  report.<a class="code" href="structripple_1_1NodeStore_1_1BatchWriteReport.html#a357c5cc140aa8da903855175e07b4d0b">writeCount</a> = <a class="code" href="namespaceripple.html#a53f80df10254751781250aa20704e98f">set</a>.size();</div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keyword">auto</span> <span class="keyword">const</span> before = <a class="codeRef" href="http://en.cppreference.com/w/cpp/chrono/steady_clock/now.html">std::chrono::steady_clock::now</a>();</div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  </div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3e9fcc020d96a6a061bc6d00cb8c4eb4">m_callback</a>.<a class="code" href="structripple_1_1NodeStore_1_1BatchWriter_1_1Callback.html#a44ada568a17a0b6f3256005476e68638">writeBatch</a> (<a class="code" href="namespaceripple.html#a53f80df10254751781250aa20704e98f">set</a>);</div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  </div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  report.<a class="code" href="structripple_1_1NodeStore_1_1BatchWriteReport.html#a183bf74eb142fef4d3dd5d18905d9a22">elapsed</a> = std::chrono::duration_cast <std::chrono::milliseconds></div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  (<a class="codeRef" href="http://en.cppreference.com/w/cpp/chrono/steady_clock/now.html">std::chrono::steady_clock::now</a>() - before);</div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  </div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a45c6abdc7dcdc3cdb4a8c1e3bfac8cd8">m_scheduler</a>.<a class="code" href="classripple_1_1NodeStore_1_1Scheduler.html#a0adffe6c4e42f062bd47864f4e615a39">onBatchWrite</a> (report);</div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  }</div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span> }</div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  </div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span> <span class="keywordtype">void</span></div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3fe23bec6b7c7fd4a4ca7c954241930c"> 114</a></span> <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a3fe23bec6b7c7fd4a4ca7c954241930c">BatchWriter::waitForWriting</a> ()</div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> {</div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/thread/unique_lock.html">std::unique_lock</a> <decltype(<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a8446bde66ae915ce1e8a23c1d9e03932">mWriteMutex</a>)> sl (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a8446bde66ae915ce1e8a23c1d9e03932">mWriteMutex</a>);</div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  </div>
|
||||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="keywordflow">while</span> (<a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#a0dac1815fb23e64b1d0a63d4595a816f">mWritePending</a>)</div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <a class="code" href="classripple_1_1NodeStore_1_1BatchWriter.html#ae99b6e34ec47a86bcdc8de5a5a49eff4">mWriteCondition</a>.<a class="codeRef" href="http://en.cppreference.com/w/cpp/thread/condition_variable_any/wait.html">wait</a> (sl);</div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> }</div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  </div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> }</div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> }</div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
<div class="ttc" id="ashared_ptr_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/memory/shared_ptr.html">std::shared_ptr< NodeObject ></a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_ac9098b71490f289b477b5365d98cafee"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#ac9098b71490f289b477b5365d98cafee">ripple::NodeStore::BatchWriter::writeBatch</a></div><div class="ttdeci">void writeBatch()</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8cpp_source.html#l00074">BatchWriter.cpp:74</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_aafd94fab31d667c79c53ae2f5b770778"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#aafd94fab31d667c79c53ae2f5b770778">ripple::NodeStore::BatchWriter::performScheduledTask</a></div><div class="ttdeci">void performScheduledTask() override</div><div class="ttdoc">Performs the task.</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8cpp_source.html#l00068">BatchWriter.cpp:68</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_ae99b6e34ec47a86bcdc8de5a5a49eff4"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#ae99b6e34ec47a86bcdc8de5a5a49eff4">ripple::NodeStore::BatchWriter::mWriteCondition</a></div><div class="ttdeci">CondvarType mWriteCondition</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00085">BatchWriter.h:85</a></div></div>
|
||||
<div class="ttc" id="areserve_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/reserve.html">std::vector::reserve</a></div><div class="ttdeci">T reserve(T... args)</div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a0dac1815fb23e64b1d0a63d4595a816f"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a0dac1815fb23e64b1d0a63d4595a816f">ripple::NodeStore::BatchWriter::mWritePending</a></div><div class="ttdeci">bool mWritePending</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00087">BatchWriter.h:87</a></div></div>
|
||||
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div><div class="ttdoc">STL class.</div></div>
|
||||
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/size.html">std::vector::size</a></div><div class="ttdeci">T size(T... args)</div></div>
|
||||
<div class="ttc" id="alock_guard_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/thread/lock_guard.html">std::lock_guard</a></div><div class="ttdoc">STL class.</div></div>
|
||||
<div class="ttc" id="anamespaceripple_1_1NodeStore_html_a462140731267cdb1df0c7759a9a31512a03b8818e1ee729cf3a62bf6697aff257"><div class="ttname"><a href="namespaceripple_1_1NodeStore.html#a462140731267cdb1df0c7759a9a31512a03b8818e1ee729cf3a62bf6697aff257">ripple::NodeStore::batchWriteLimitSize</a></div><div class="ttdeci">@ batchWriteLimitSize</div><div class="ttdef"><b>Definition:</b> <a href="nodestore_2Types_8h_source.html#l00041">nodestore/Types.h:41</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a3fe23bec6b7c7fd4a4ca7c954241930c"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a3fe23bec6b7c7fd4a4ca7c954241930c">ripple::NodeStore::BatchWriter::waitForWriting</a></div><div class="ttdeci">void waitForWriting()</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8cpp_source.html#l00114">BatchWriter.cpp:114</a></div></div>
|
||||
<div class="ttc" id="apush_back_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">std::vector::push_back</a></div><div class="ttdeci">T push_back(T... args)</div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1Scheduler_html_af3734617d65f9903e3b33d3ee6de8102"><div class="ttname"><a href="classripple_1_1NodeStore_1_1Scheduler.html#af3734617d65f9903e3b33d3ee6de8102">ripple::NodeStore::Scheduler::scheduleTask</a></div><div class="ttdeci">virtual void scheduleTask(Task &task)=0</div><div class="ttdoc">Schedules a task.</div></div>
|
||||
<div class="ttc" id="astructripple_1_1NodeStore_1_1BatchWriter_1_1Callback_html_a44ada568a17a0b6f3256005476e68638"><div class="ttname"><a href="structripple_1_1NodeStore_1_1BatchWriter_1_1Callback.html#a44ada568a17a0b6f3256005476e68638">ripple::NodeStore::BatchWriter::Callback::writeBatch</a></div><div class="ttdeci">virtual void writeBatch(Batch const &batch)=0</div></div>
|
||||
<div class="ttc" id="aunique_lock_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/thread/unique_lock.html">std::unique_lock</a></div><div class="ttdoc">STL class.</div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a53f80df10254751781250aa20704e98f"><div class="ttname"><a href="namespaceripple.html#a53f80df10254751781250aa20704e98f">ripple::set</a></div><div class="ttdeci">bool set(T &target, std::string const &name, Section const &section)</div><div class="ttdoc">Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...</div><div class="ttdef"><b>Definition:</b> <a href="BasicConfig_8h_source.html#l00271">BasicConfig.h:271</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_1_1NodeStore_html_a462140731267cdb1df0c7759a9a31512a3e7cbb590a2149da2328925f4ac5978a"><div class="ttname"><a href="namespaceripple_1_1NodeStore.html#a462140731267cdb1df0c7759a9a31512a3e7cbb590a2149da2328925f4ac5978a">ripple::NodeStore::batchWritePreallocationSize</a></div><div class="ttdeci">@ batchWritePreallocationSize</div><div class="ttdef"><b>Definition:</b> <a href="nodestore_2Types_8h_source.html#l00035">nodestore/Types.h:35</a></div></div>
|
||||
<div class="ttc" id="astructripple_1_1NodeStore_1_1BatchWriter_1_1Callback_html"><div class="ttname"><a href="structripple_1_1NodeStore_1_1BatchWriter_1_1Callback.html">ripple::NodeStore::BatchWriter::Callback</a></div><div class="ttdoc">This callback does the actual writing.</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00044">BatchWriter.h:44</a></div></div>
|
||||
<div class="ttc" id="await_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/thread/condition_variable_any/wait.html">std::condition_variable_any::wait</a></div><div class="ttdeci">T wait(T... args)</div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1Scheduler_html"><div class="ttname"><a href="classripple_1_1NodeStore_1_1Scheduler.html">ripple::NodeStore::Scheduler</a></div><div class="ttdoc">Scheduling for asynchronous backend activity.</div><div class="ttdef"><b>Definition:</b> <a href="ripple_2nodestore_2Scheduler_8h_source.html#l00057">ripple/nodestore/Scheduler.h:57</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_af79bad700133763e550a4750fcae40d7"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#af79bad700133763e550a4750fcae40d7">ripple::NodeStore::BatchWriter::~BatchWriter</a></div><div class="ttdeci">~BatchWriter()</div><div class="ttdoc">Destroy a batch writer.</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8cpp_source.html#l00034">BatchWriter.cpp:34</a></div></div>
|
||||
<div class="ttc" id="astructripple_1_1NodeStore_1_1BatchWriteReport_html"><div class="ttname"><a href="structripple_1_1NodeStore_1_1BatchWriteReport.html">ripple::NodeStore::BatchWriteReport</a></div><div class="ttdoc">Contains information about a batch write operation.</div><div class="ttdef"><b>Definition:</b> <a href="ripple_2nodestore_2Scheduler_8h_source.html#l00041">ripple/nodestore/Scheduler.h:41</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a8446bde66ae915ce1e8a23c1d9e03932"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a8446bde66ae915ce1e8a23c1d9e03932">ripple::NodeStore::BatchWriter::mWriteMutex</a></div><div class="ttdeci">LockType mWriteMutex</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00084">BatchWriter.h:84</a></div></div>
|
||||
<div class="ttc" id="aswap_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/swap.html">std::vector::swap</a></div><div class="ttdeci">T swap(T... args)</div></div>
|
||||
<div class="ttc" id="anamespaceripple_html"><div class="ttname"><a href="namespaceripple.html">ripple</a></div><div class="ttdoc">Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.</div><div class="ttdef"><b>Definition:</b> <a href="RCLCensorshipDetector_8h_source.html#l00029">RCLCensorshipDetector.h:29</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a51dceb04c1517ed641e90a51c5a9ea1b"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a51dceb04c1517ed641e90a51c5a9ea1b">ripple::NodeStore::BatchWriter::getWriteLoad</a></div><div class="ttdeci">int getWriteLoad()</div><div class="ttdoc">Get an estimate of the amount of writing I/O pending.</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8cpp_source.html#l00060">BatchWriter.cpp:60</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a3764d56b2e80ee3345a2427f06192abb"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a3764d56b2e80ee3345a2427f06192abb">ripple::NodeStore::BatchWriter::mWriteSet</a></div><div class="ttdeci">Batch mWriteSet</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00088">BatchWriter.h:88</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_ad2bd82080d5ae1a6f10eac76d6ef7874"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#ad2bd82080d5ae1a6f10eac76d6ef7874">ripple::NodeStore::BatchWriter::BatchWriter</a></div><div class="ttdeci">BatchWriter(Callback &callback, Scheduler &scheduler)</div><div class="ttdoc">Create a batch writer.</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8cpp_source.html#l00025">BatchWriter.cpp:25</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a42b3434b00f66603124653fbf691ad26"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a42b3434b00f66603124653fbf691ad26">ripple::NodeStore::BatchWriter::store</a></div><div class="ttdeci">void store(std::shared_ptr< NodeObject > const &object)</div><div class="ttdoc">Store the object.</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8cpp_source.html#l00040">BatchWriter.cpp:40</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a90833868dbf5ca5fcb5840d8ead21f3a"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a90833868dbf5ca5fcb5840d8ead21f3a">ripple::NodeStore::BatchWriter::mWriteLoad</a></div><div class="ttdeci">int mWriteLoad</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00086">BatchWriter.h:86</a></div></div>
|
||||
<div class="ttc" id="aempty_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/empty.html">std::vector::empty</a></div><div class="ttdeci">T empty(T... args)</div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a3e9fcc020d96a6a061bc6d00cb8c4eb4"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a3e9fcc020d96a6a061bc6d00cb8c4eb4">ripple::NodeStore::BatchWriter::m_callback</a></div><div class="ttdeci">Callback & m_callback</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00082">BatchWriter.h:82</a></div></div>
|
||||
<div class="ttc" id="astructripple_1_1NodeStore_1_1BatchWriteReport_html_a357c5cc140aa8da903855175e07b4d0b"><div class="ttname"><a href="structripple_1_1NodeStore_1_1BatchWriteReport.html#a357c5cc140aa8da903855175e07b4d0b">ripple::NodeStore::BatchWriteReport::writeCount</a></div><div class="ttdeci">int writeCount</div><div class="ttdef"><b>Definition:</b> <a href="ripple_2nodestore_2Scheduler_8h_source.html#l00046">ripple/nodestore/Scheduler.h:46</a></div></div>
|
||||
<div class="ttc" id="amax_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/max.html">std::max</a></div><div class="ttdeci">T max(T... args)</div></div>
|
||||
<div class="ttc" id="astructripple_1_1NodeStore_1_1BatchWriteReport_html_a183bf74eb142fef4d3dd5d18905d9a22"><div class="ttname"><a href="structripple_1_1NodeStore_1_1BatchWriteReport.html#a183bf74eb142fef4d3dd5d18905d9a22">ripple::NodeStore::BatchWriteReport::elapsed</a></div><div class="ttdeci">std::chrono::milliseconds elapsed</div><div class="ttdef"><b>Definition:</b> <a href="ripple_2nodestore_2Scheduler_8h_source.html#l00045">ripple/nodestore/Scheduler.h:45</a></div></div>
|
||||
<div class="ttc" id="anotify_all_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/thread/condition_variable_any/notify_all.html">std::condition_variable_any::notify_all</a></div><div class="ttdeci">T notify_all(T... args)</div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1Scheduler_html_a0adffe6c4e42f062bd47864f4e615a39"><div class="ttname"><a href="classripple_1_1NodeStore_1_1Scheduler.html#a0adffe6c4e42f062bd47864f4e615a39">ripple::NodeStore::Scheduler::onBatchWrite</a></div><div class="ttdeci">virtual void onBatchWrite(BatchWriteReport const &report)=0</div><div class="ttdoc">Reports the completion of a batch write Allows the scheduler to monitor the node store's performance.</div></div>
|
||||
<div class="ttc" id="aclassripple_1_1NodeStore_1_1BatchWriter_html_a45c6abdc7dcdc3cdb4a8c1e3bfac8cd8"><div class="ttname"><a href="classripple_1_1NodeStore_1_1BatchWriter.html#a45c6abdc7dcdc3cdb4a8c1e3bfac8cd8">ripple::NodeStore::BatchWriter::m_scheduler</a></div><div class="ttdeci">Scheduler & m_scheduler</div><div class="ttdef"><b>Definition:</b> <a href="BatchWriter_8h_source.html#l00083">BatchWriter.h:83</a></div></div>
|
||||
<div class="ttc" id="anow_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/chrono/steady_clock/now.html">std::chrono::steady_clock::now</a></div><div class="ttdeci">T now(T... args)</div></div>
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||||
</a> 1.8.17
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user