<!-- HTML header for doxygen 1.8.14--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.11"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Caffe2 - C++ API: caffe2/db/leveldb.cc Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link rel="icon" href="/static/favicon.png" type="image/x-icon"> <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> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> <link href="main.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="projectlogo" width="56"><a href="/"><img alt="Logo" src="Caffe2-with-name-55-tall.png"/></a></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Caffe2 - C++ API </div> <div id="projectbrief">A deep learning, cross platform ML framework</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="/doxygen-c/html/classes.html"><span>C++ API</span></a></li> <li><a href="/doxygen-python/html/annotated.html"><span>Python API</span></a></li> <li><a href="https://github.com/caffe2/caffe2"><span>GitHub</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </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_20697b8f204bdfcab31e6b1a416f3ab8.html">caffe2</a></li><li class="navelem"><a class="el" href="dir_5cf62ed137066e1965dc6035878c4666.html">db</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">leveldb.cc</div> </div> </div><!--header--> <div class="contents"> <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#include "caffe2/core/db.h"</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#include "caffe2/core/logging.h"</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="preprocessor">#include "<a class="code" href="flags_8h.html">caffe2/core/flags.h</a>"</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include "leveldb/db.h"</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include "leveldb/write_batch.h"</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> CAFFE2_DEFINE_int(caffe2_leveldb_block_size, 65536,</div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>  <span class="stringliteral">"The caffe2 leveldb block size when writing a leveldb."</span>);</div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> </div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="keyword">namespace </span><a class="code" href="namespacecaffe2.html">caffe2</a> {</div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="keyword">namespace </span>db {</div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div><div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html"> 13</a></span> <span class="keyword">class </span><a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html">LevelDBCursor</a> : <span class="keyword">public</span> <a class="code" href="classcaffe2_1_1db_1_1_cursor.html">Cursor</a> {</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  <span class="keyword">explicit</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html">LevelDBCursor</a>(leveldb::DB* db)</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  : iter_(db->NewIterator(leveldb::ReadOptions())) {</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#aa76034211d229681feb6461e9168699f">SeekToFirst</a>();</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  }</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  ~<a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html">LevelDBCursor</a>() {}</div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a0dc1d262ad596e65b06b1d6cd3cf24df"> 20</a></span>  <span class="keywordtype">void</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a0dc1d262ad596e65b06b1d6cd3cf24df">Seek</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>& <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a347f3970614e76b13aec363c5f926e40">key</a>)<span class="keyword"> override </span>{ iter_->Seek(key); }</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="keywordtype">bool</span> SupportsSeek()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> <span class="keyword">true</span>; }</div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#aa76034211d229681feb6461e9168699f"> 22</a></span>  <span class="keywordtype">void</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#aa76034211d229681feb6461e9168699f">SeekToFirst</a>()<span class="keyword"> override </span>{ iter_->SeekToFirst(); }</div><div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a0111f8b5a0f5421a92b4ebde0433a23c"> 23</a></span>  <span class="keywordtype">void</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a0111f8b5a0f5421a92b4ebde0433a23c">Next</a>()<span class="keyword"> override </span>{ iter_->Next(); }</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a347f3970614e76b13aec363c5f926e40"> 24</a></span>  <span class="keywordtype">string</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a347f3970614e76b13aec363c5f926e40">key</a>()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> iter_->key().ToString(); }</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a343b6d82536ccb7b0fb103dcab445bac"> 25</a></span>  <span class="keywordtype">string</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a343b6d82536ccb7b0fb103dcab445bac">value</a>()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> iter_->value().ToString(); }</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a538fbc5cfd88ffba30acad722106dcca"> 26</a></span>  <span class="keywordtype">bool</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a538fbc5cfd88ffba30acad722106dcca">Valid</a>()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> iter_->Valid(); }</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  std::unique_ptr<leveldb::Iterator> iter_;</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> </div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html"> 32</a></span> <span class="keyword">class </span><a class="code" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html">LevelDBTransaction</a> : <span class="keyword">public</span> <a class="code" href="classcaffe2_1_1db_1_1_transaction.html">Transaction</a> {</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keyword">explicit</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html">LevelDBTransaction</a>(leveldb::DB* db) : db_(db) {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  CAFFE_ENFORCE(db_);</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  batch_.reset(<span class="keyword">new</span> leveldb::WriteBatch());</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>  ~<a class="code" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html">LevelDBTransaction</a>() { Commit(); }</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html#a289303faa3ba113eb7452887fff20463"> 39</a></span>  <span class="keywordtype">void</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html#a289303faa3ba113eb7452887fff20463">Put</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>& <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a347f3970614e76b13aec363c5f926e40">key</a>, <span class="keyword">const</span> <span class="keywordtype">string</span>& <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a343b6d82536ccb7b0fb103dcab445bac">value</a>)<span class="keyword"> override </span>{</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  batch_->Put(key, value);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  }</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html#a312dfbca53b41c461ecaa6c5e83c1f46"> 42</a></span>  <span class="keywordtype">void</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html#a312dfbca53b41c461ecaa6c5e83c1f46">Commit</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  leveldb::Status status = db_->Write(leveldb::WriteOptions(), batch_.get());</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  batch_.reset(<span class="keyword">new</span> leveldb::WriteBatch());</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  CAFFE_ENFORCE(</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  status.ok(),</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="stringliteral">"Failed to write batch to leveldb. "</span>, status.ToString());</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> </div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  leveldb::DB* db_;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  std::unique_ptr<leveldb::WriteBatch> batch_;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  DISABLE_COPY_AND_ASSIGN(<a class="code" href="classcaffe2_1_1db_1_1_level_d_b_transaction.html">LevelDBTransaction</a>);</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</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"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b.html"> 57</a></span> <span class="keyword">class </span><a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html">LevelDB</a> : <span class="keyword">public</span> <a class="code" href="classcaffe2_1_1db_1_1_d_b.html">DB</a> {</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html">LevelDB</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>& source, Mode mode) : <a class="code" href="classcaffe2_1_1db_1_1_d_b.html">DB</a>(source, mode) {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  leveldb::Options options;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  options.block_size = FLAGS_caffe2_leveldb_block_size;</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  options.write_buffer_size = 268435456;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  options.max_open_files = 100;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  options.error_if_exists = mode == NEW;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  options.create_if_missing = mode != READ;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  leveldb::DB* db_temp;</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  leveldb::Status status = leveldb::DB::Open(options, source, &db_temp);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  CAFFE_ENFORCE(</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  status.ok(),</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="stringliteral">"Failed to open leveldb "</span>, source, <span class="stringliteral">". "</span>, status.ToString());</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  db_.reset(db_temp);</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  VLOG(1) << <span class="stringliteral">"Opened leveldb "</span> << source;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  }</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div><div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b.html#a43066abfe5f137c3dafa105c53067c14"> 75</a></span>  <span class="keywordtype">void</span> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html#a43066abfe5f137c3dafa105c53067c14">Close</a>()<span class="keyword"> override </span>{ db_.reset(); }</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b.html#a0b70b7c6dbba237a65ad597486c2618a"> 76</a></span>  unique_ptr<Cursor> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html#a0b70b7c6dbba237a65ad597486c2618a">NewCursor</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keywordflow">return</span> make_unique<LevelDBCursor>(db_.get());</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  }</div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="classcaffe2_1_1db_1_1_level_d_b.html#aee10781fcc13fe362aa1dbd3e332a256"> 79</a></span>  unique_ptr<Transaction> <a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html#aee10781fcc13fe362aa1dbd3e332a256">NewTransaction</a>()<span class="keyword"> override </span>{</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">return</span> make_unique<LevelDBTransaction>(db_.get());</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>  <span class="keyword">private</span>:</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  std::unique_ptr<leveldb::DB> db_;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> };</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> REGISTER_CAFFE2_DB(<a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html">LevelDB</a>, <a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html">LevelDB</a>);</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="comment">// For lazy-minded, one can also call with lower-case name.</span></div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> REGISTER_CAFFE2_DB(leveldb, <a class="code" href="classcaffe2_1_1db_1_1_level_d_b.html">LevelDB</a>);</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> } <span class="comment">// namespace db</span></div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> } <span class="comment">// namespace caffe2</span></div><div class="ttc" id="classcaffe2_1_1db_1_1_transaction_html"><div class="ttname"><a href="classcaffe2_1_1db_1_1_transaction.html">caffe2::db::Transaction</a></div><div class="ttdoc">An abstract class for the current database transaction while writing. </div><div class="ttdef"><b>Definition:</b> <a href="db_8h_source.html#l00061">db.h:61</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_cursor_html"><div class="ttname"><a href="classcaffe2_1_1db_1_1_cursor.html">caffe2::db::Cursor</a></div><div class="ttdoc">An abstract class for the cursor of the database while reading. </div><div class="ttdef"><b>Definition:</b> <a href="db_8h_source.html#l00022">db.h:22</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_transaction_html_a289303faa3ba113eb7452887fff20463"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_transaction.html#a289303faa3ba113eb7452887fff20463">caffe2::db::LevelDBTransaction::Put</a></div><div class="ttdeci">void Put(const string &key, const string &value) override</div><div class="ttdoc">Puts the key value pair to the database. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00039">leveldb.cc:39</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_cursor_html_a538fbc5cfd88ffba30acad722106dcca"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a538fbc5cfd88ffba30acad722106dcca">caffe2::db::LevelDBCursor::Valid</a></div><div class="ttdeci">bool Valid() override</div><div class="ttdoc">Returns whether the current location is valid - for example, if we have reached the end of the databa...</div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00026">leveldb.cc:26</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_cursor_html_aa76034211d229681feb6461e9168699f"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#aa76034211d229681feb6461e9168699f">caffe2::db::LevelDBCursor::SeekToFirst</a></div><div class="ttdeci">void SeekToFirst() override</div><div class="ttdoc">Seek to the first key in the database. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00022">leveldb.cc:22</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_cursor_html_a0111f8b5a0f5421a92b4ebde0433a23c"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a0111f8b5a0f5421a92b4ebde0433a23c">caffe2::db::LevelDBCursor::Next</a></div><div class="ttdeci">void Next() override</div><div class="ttdoc">Go to the next location in the database. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00023">leveldb.cc:23</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_html_a0b70b7c6dbba237a65ad597486c2618a"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b.html#a0b70b7c6dbba237a65ad597486c2618a">caffe2::db::LevelDB::NewCursor</a></div><div class="ttdeci">unique_ptr< Cursor > NewCursor() override</div><div class="ttdoc">Returns a cursor to read the database. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00076">leveldb.cc:76</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_transaction_html_a312dfbca53b41c461ecaa6c5e83c1f46"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_transaction.html#a312dfbca53b41c461ecaa6c5e83c1f46">caffe2::db::LevelDBTransaction::Commit</a></div><div class="ttdeci">void Commit() override</div><div class="ttdoc">Commits the current writes. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00042">leveldb.cc:42</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_cursor_html_a0dc1d262ad596e65b06b1d6cd3cf24df"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a0dc1d262ad596e65b06b1d6cd3cf24df">caffe2::db::LevelDBCursor::Seek</a></div><div class="ttdeci">void Seek(const string &key) override</div><div class="ttdoc">Seek to a specific key (or if the key does not exist, seek to the immediate next). </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00020">leveldb.cc:20</a></div></div> <div class="ttc" id="namespacecaffe2_html"><div class="ttname"><a href="namespacecaffe2.html">caffe2</a></div><div class="ttdoc">A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...</div><div class="ttdef"><b>Definition:</b> <a href="convert__encoded__to__raw__leveldb_8cc_source.html#l00047">convert_encoded_to_raw_leveldb.cc:47</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_d_b_html"><div class="ttname"><a href="classcaffe2_1_1db_1_1_d_b.html">caffe2::db::DB</a></div><div class="ttdoc">An abstract class for accessing a database of key-value pairs. </div><div class="ttdef"><b>Definition:</b> <a href="db_8h_source.html#l00080">db.h:80</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_html"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b.html">caffe2::db::LevelDB</a></div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00057">leveldb.cc:57</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_cursor_html_a343b6d82536ccb7b0fb103dcab445bac"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a343b6d82536ccb7b0fb103dcab445bac">caffe2::db::LevelDBCursor::value</a></div><div class="ttdeci">string value() override</div><div class="ttdoc">Returns the current value. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00025">leveldb.cc:25</a></div></div> <div class="ttc" id="flags_8h_html"><div class="ttname"><a href="flags_8h.html">flags.h</a></div><div class="ttdoc">Commandline flags support for Caffe2. </div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_html_a43066abfe5f137c3dafa105c53067c14"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b.html#a43066abfe5f137c3dafa105c53067c14">caffe2::db::LevelDB::Close</a></div><div class="ttdeci">void Close() override</div><div class="ttdoc">Closes the database. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00075">leveldb.cc:75</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_html_aee10781fcc13fe362aa1dbd3e332a256"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b.html#aee10781fcc13fe362aa1dbd3e332a256">caffe2::db::LevelDB::NewTransaction</a></div><div class="ttdeci">unique_ptr< Transaction > NewTransaction() override</div><div class="ttdoc">Returns a transaction to write data to the database. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00079">leveldb.cc:79</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_transaction_html"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_transaction.html">caffe2::db::LevelDBTransaction</a></div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00032">leveldb.cc:32</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_cursor_html"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_cursor.html">caffe2::db::LevelDBCursor</a></div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00013">leveldb.cc:13</a></div></div> <div class="ttc" id="classcaffe2_1_1db_1_1_level_d_b_cursor_html_a347f3970614e76b13aec363c5f926e40"><div class="ttname"><a href="classcaffe2_1_1db_1_1_level_d_b_cursor.html#a347f3970614e76b13aec363c5f926e40">caffe2::db::LevelDBCursor::key</a></div><div class="ttdeci">string key() override</div><div class="ttdoc">Returns the current key. </div><div class="ttdef"><b>Definition:</b> <a href="leveldb_8cc_source.html#l00024">leveldb.cc:24</a></div></div> </div><!-- fragment --></div><!-- contents --> <!-- HTML footer for doxygen 1.8.14--> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Apr 19 2018 13:03:50 for Caffe2 - C++ API by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> <div class="footerContainer"> <div id="footer_wrap" class="wrapper footerWrapper"> <div class="footerBlocks"> <div id="fb_oss" class="footerSection fbOpenSourceFooter"> <svg class="facebookOSSLogoSvg" viewBox="0 0 1133.9 1133.9" x="0px" y="0px" height=50 width=50> <g> <path class="logoRing outerRing" d="M 498.3 3.7 c 153.6 88.9 307.3 177.7 461.1 266.2 c 7.6 4.4 10.3 9.1 10.3 17.8 c -0.3 179.1 -0.2 358.3 0 537.4 c 0 8.1 -2.4 12.8 -9.7 17.1 c -154.5 88.9 -308.8 178.1 -462.9 267.5 c -9 5.2 -15.5 5.3 -24.6 0.1 c -153.9 -89.2 -307.9 -178 -462.1 -266.8 C 3 838.8 0 833.9 0 825.1 c 0.3 -179.1 0.2 -358.3 0 -537.4 c 0 -8.6 2.6 -13.6 10.2 -18 C 164.4 180.9 318.4 92 472.4 3 C 477 -1.5 494.3 -0.7 498.3 3.7 Z M 48.8 555.3 c 0 79.9 0.2 159.9 -0.2 239.8 c -0.1 10 3 15.6 11.7 20.6 c 137.2 78.8 274.2 157.8 411 237.3 c 9.9 5.7 17 5.7 26.8 0.1 c 137.5 -79.8 275.2 -159.2 412.9 -238.5 c 7.4 -4.3 10.5 -8.9 10.5 -17.8 c -0.3 -160.2 -0.3 -320.5 0 -480.7 c 0 -8.8 -2.8 -13.6 -10.3 -18 C 772.1 218 633.1 137.8 494.2 57.4 c -6.5 -3.8 -11.5 -4.5 -18.5 -0.5 C 336.8 137.4 197.9 217.7 58.8 297.7 c -7.7 4.4 -10.2 9.2 -10.2 17.9 C 48.9 395.5 48.8 475.4 48.8 555.3 Z" /> <path class="logoRing middleRing" d="M 184.4 555.9 c 0 -33.3 -1 -66.7 0.3 -100 c 1.9 -48 24.1 -86 64.7 -110.9 c 54.8 -33.6 110.7 -65.5 167 -96.6 c 45.7 -25.2 92.9 -24.7 138.6 1 c 54.4 30.6 108.7 61.5 162.2 93.7 c 44 26.5 67.3 66.8 68 118.4 c 0.9 63.2 0.9 126.5 0 189.7 c -0.7 50.6 -23.4 90.7 -66.6 116.9 c -55 33.4 -110.8 65.4 -167.1 96.5 c -43.4 24 -89 24.2 -132.3 0.5 c -57.5 -31.3 -114.2 -64 -170 -98.3 c -41 -25.1 -62.9 -63.7 -64.5 -112.2 C 183.5 621.9 184.3 588.9 184.4 555.9 Z M 232.9 556.3 c 0 29.5 0.5 59.1 -0.1 88.6 c -0.8 39.2 16.9 67.1 50.2 86.2 c 51.2 29.4 102.2 59.2 153.4 88.4 c 31.4 17.9 63.6 18.3 95 0.6 c 53.7 -30.3 107.1 -61.2 160.3 -92.5 c 29.7 -17.5 45 -44.5 45.3 -78.8 c 0.6 -61.7 0.5 -123.5 0 -185.2 c -0.3 -34.4 -15.3 -61.5 -44.9 -79 C 637.7 352.6 583 320.8 527.9 290 c -27.5 -15.4 -57.2 -16.1 -84.7 -0.7 c -56.9 31.6 -113.4 64 -169.1 97.6 c -26.4 15.9 -40.7 41.3 -41.1 72.9 C 232.6 491.9 232.9 524.1 232.9 556.3 Z" /> <path class="logoRing innerRing" d="M 484.9 424.4 c 69.8 -2.8 133.2 57.8 132.6 132 C 617 630 558.5 688.7 484.9 689.1 c -75.1 0.4 -132.6 -63.6 -132.7 -132.7 C 352.1 485 413.4 421.5 484.9 424.4 Z M 401.3 556.7 c -3.4 37.2 30.5 83.6 83 84.1 c 46.6 0.4 84.8 -37.6 84.9 -84 c 0.1 -46.6 -37.2 -84.4 -84.2 -84.6 C 432.2 472.1 397.9 518.3 401.3 556.7 Z" /> </g> </svg> <h2>Facebook Open Source</h2> </div> <div class="footerSection"> <a class="footerLink" href="https://code.facebook.com/projects/" target="_blank">Open Source Projects</a> <a class="footerLink" href="https://github.com/facebook/" target="_blank">GitHub</a> <a class="footerLink" href="https://twitter.com/fbOpenSource" target="_blank">Twitter</a> </div> <div class="footerSection rightAlign"> <a class="footerLink" href="https://github.com/caffe2/caffe2" target="_blank">Contribute to this project on GitHub</a> </div> </div> </div> </div> <script type="text/javascript" src="/js/jekyll-link-anchors.js"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '{{ site.gacode }}', 'auto'); ga('send', 'pageview'); </script> </body> </html>