blob: 63265b2012cfc8f2dbe17fba36daa22bf65834b9 [file]
<!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" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Paimon-cpp: paimon::ReadAheadCache Class Reference</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 id="projectrow">
<td id="projectalign">
<div id="projectname">Paimon-cpp
</div>
<div id="projectbrief">A high-performance C++ implementation of Apache Paimon</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @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:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacepaimon.html">paimon</a></li><li class="navelem"><a class="el" href="classpaimon_1_1_read_ahead_cache.html">ReadAheadCache</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="classpaimon_1_1_read_ahead_cache-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">paimon::ReadAheadCache Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p>A read cache designed to hide IO latencies when reading.
<a href="classpaimon_1_1_read_ahead_cache.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="read__ahead__cache_8h_source.html">/home/runner/work/paimon-cpp/paimon-cpp/include/paimon/utils/read_ahead_cache.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a59419e607f302c714b0ed01f258937b7" id="r_a59419e607f302c714b0ed01f258937b7"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpaimon_1_1_read_ahead_cache.html#a59419e607f302c714b0ed01f258937b7">ReadAheadCache</a> (<a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> std::shared_ptr&lt; <a class="el" href="classpaimon_1_1_input_stream.html">InputStream</a> &gt; &amp;stream, <a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> <a class="el" href="classpaimon_1_1_cache_config.html">CacheConfig</a> &amp;<a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">config</a>, <a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> std::shared_ptr&lt; <a class="el" href="classpaimon_1_1_memory_pool.html">MemoryPool</a> &gt; &amp;<a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">memory_pool</a>)</td></tr>
<tr class="memdesc:a59419e607f302c714b0ed01f258937b7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a read cache with given options. <br /></td></tr>
<tr class="separator:a59419e607f302c714b0ed01f258937b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a973c05d669dd4cfac5852e0ac5a61dc5" id="r_a973c05d669dd4cfac5852e0ac5a61dc5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpaimon_1_1_read_ahead_cache.html#a973c05d669dd4cfac5852e0ac5a61dc5">~ReadAheadCache</a> ()</td></tr>
<tr class="separator:a973c05d669dd4cfac5852e0ac5a61dc5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9c467e26b34251cede32cd43ca79b998" id="r_a9c467e26b34251cede32cd43ca79b998"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpaimon_1_1_status.html">Status</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpaimon_1_1_read_ahead_cache.html#a9c467e26b34251cede32cd43ca79b998">Init</a> (std::vector&lt; <a class="el" href="structpaimon_1_1_byte_range.html">ByteRange</a> &gt; &amp;&amp;<a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">ranges</a>)</td></tr>
<tr class="memdesc:a9c467e26b34251cede32cd43ca79b998"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the cache with given byte ranges to be cached. <br /></td></tr>
<tr class="separator:a9c467e26b34251cede32cd43ca79b998"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef0d61f73f6a97c2b980c391f3d1be52" id="r_aef0d61f73f6a97c2b980c391f3d1be52"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpaimon_1_1_result.html">Result</a>&lt; <a class="el" href="structpaimon_1_1_byte_slice.html">ByteSlice</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpaimon_1_1_read_ahead_cache.html#aef0d61f73f6a97c2b980c391f3d1be52">Read</a> (<a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> <a class="el" href="structpaimon_1_1_byte_range.html">ByteRange</a> &amp;<a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">range</a>)</td></tr>
<tr class="memdesc:aef0d61f73f6a97c2b980c391f3d1be52"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a range previously provided to <a class="el" href="classpaimon_1_1_read_ahead_cache.html#a9c467e26b34251cede32cd43ca79b998" title="Initialize the cache with given byte ranges to be cached.">Init()</a>. <br /></td></tr>
<tr class="separator:aef0d61f73f6a97c2b980c391f3d1be52"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b87e72510149507434b9bd6aa01d2f5" id="r_a7b87e72510149507434b9bd6aa01d2f5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">void</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpaimon_1_1_read_ahead_cache.html#a7b87e72510149507434b9bd6aa01d2f5">Reset</a> ()</td></tr>
<tr class="memdesc:a7b87e72510149507434b9bd6aa01d2f5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reset the cache to its initial state, clearing all cached data and configuration. <br /></td></tr>
<tr class="separator:a7b87e72510149507434b9bd6aa01d2f5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:a1d442726bac5c6fbfa3cce79577a4123" id="r_a1d442726bac5c6fbfa3cce79577a4123"><td class="memItemLeft" align="right" valign="top">std::unique_ptr&lt; <a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">Impl</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpaimon_1_1_read_ahead_cache.html#a1d442726bac5c6fbfa3cce79577a4123">impl_</a></td></tr>
<tr class="separator:a1d442726bac5c6fbfa3cce79577a4123"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A read cache designed to hide IO latencies when reading. </p>
<p>Prefetching strategy: When a range is read, the cache will prefetch up to <code>pre_buffer_range_count</code> additional adjacent ranges ahead of the requested offset. This helps hide I/O latency for sequential access. Example: If you read range [0, 100), and pre_buffer_range_count=2, the next two configured ranges will also be prefetched.</p>
<p>Eviction policy: The cache uses a simple FIFO eviction policy based on total cached byte size. When adding new ranges would exceed <code>buffer_size_limit</code>, the oldest cached ranges are evicted first until there is enough space for the new data. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a59419e607f302c714b0ed01f258937b7" name="a59419e607f302c714b0ed01f258937b7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a59419e607f302c714b0ed01f258937b7">&#9670;&#160;</a></span>ReadAheadCache()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">paimon::ReadAheadCache::ReadAheadCache </td>
<td>(</td>
<td class="paramtype"><a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> std::shared_ptr&lt; <a class="el" href="classpaimon_1_1_input_stream.html">InputStream</a> &gt; &amp;&#160;</td>
<td class="paramname"><em>stream</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> <a class="el" href="classpaimon_1_1_cache_config.html">CacheConfig</a> &amp;&#160;</td>
<td class="paramname"><em>config</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> std::shared_ptr&lt; <a class="el" href="classpaimon_1_1_memory_pool.html">MemoryPool</a> &gt; &amp;&#160;</td>
<td class="paramname"><em>memory_pool</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct a read cache with given options. </p>
</div>
</div>
<a id="a973c05d669dd4cfac5852e0ac5a61dc5" name="a973c05d669dd4cfac5852e0ac5a61dc5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a973c05d669dd4cfac5852e0ac5a61dc5">&#9670;&#160;</a></span>~ReadAheadCache()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">paimon::ReadAheadCache::~ReadAheadCache </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a9c467e26b34251cede32cd43ca79b998" name="a9c467e26b34251cede32cd43ca79b998"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9c467e26b34251cede32cd43ca79b998">&#9670;&#160;</a></span>Init()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpaimon_1_1_status.html">Status</a> paimon::ReadAheadCache::Init </td>
<td>(</td>
<td class="paramtype">std::vector&lt; <a class="el" href="structpaimon_1_1_byte_range.html">ByteRange</a> &gt; &amp;&amp;&#160;</td>
<td class="paramname"><em>ranges</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initialize the cache with given byte ranges to be cached. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ranges</td><td>The byte ranges to be cached. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classpaimon_1_1_status.html" title="Status outcome object (success or error)">Status</a> of the operation. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>This method must be called before any <a class="el" href="classpaimon_1_1_read_ahead_cache.html#aef0d61f73f6a97c2b980c391f3d1be52" title="Read a range previously provided to Init().">Read()</a> calls. Ranges will be coalesced based on the cache configuration. </dd></dl>
</div>
</div>
<a id="aef0d61f73f6a97c2b980c391f3d1be52" name="aef0d61f73f6a97c2b980c391f3d1be52"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef0d61f73f6a97c2b980c391f3d1be52">&#9670;&#160;</a></span>Read()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpaimon_1_1_result.html">Result</a>&lt; <a class="el" href="structpaimon_1_1_byte_slice.html">ByteSlice</a> &gt; paimon::ReadAheadCache::Read </td>
<td>(</td>
<td class="paramtype"><a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">const</a> <a class="el" href="structpaimon_1_1_byte_range.html">ByteRange</a> &amp;&#160;</td>
<td class="paramname"><em>range</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read a range previously provided to <a class="el" href="classpaimon_1_1_read_ahead_cache.html#a9c467e26b34251cede32cd43ca79b998" title="Initialize the cache with given byte ranges to be cached.">Init()</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">range</td><td>The byte range to read. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The byte slice containing the requested data. If the data is not yet cached (cache miss), the returned <code><a class="el" href="structpaimon_1_1_byte_slice.html" title="A byte slice with buffer, offset and length.">ByteSlice</a></code> will have a null buffer (<code>buffer == nullptr</code>) </dd></dl>
</div>
</div>
<a id="a7b87e72510149507434b9bd6aa01d2f5" name="a7b87e72510149507434b9bd6aa01d2f5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b87e72510149507434b9bd6aa01d2f5">&#9670;&#160;</a></span>Reset()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">void</a> paimon::ReadAheadCache::Reset </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reset the cache to its initial state, clearing all cached data and configuration. </p>
<p>This method waits for all ongoing asynchronous read operations to complete, clears all cached entries, and resets the internal state so that <a class="el" href="classpaimon_1_1_read_ahead_cache.html#a9c467e26b34251cede32cd43ca79b998" title="Initialize the cache with given byte ranges to be cached.">Init()</a> can be called again. After calling Reset, the cache can be safely re-initialized with new ranges. </p>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="a1d442726bac5c6fbfa3cce79577a4123" name="a1d442726bac5c6fbfa3cce79577a4123"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1d442726bac5c6fbfa3cce79577a4123">&#9670;&#160;</a></span>impl_</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::unique_ptr&lt;<a class="el" href="memory__pool_8h.html#a147ba4ba34a215b3a4f3a95c1ee11704">Impl</a>&gt; paimon::ReadAheadCache::impl_</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>/home/runner/work/paimon-cpp/paimon-cpp/include/paimon/utils/<a class="el" href="read__ahead__cache_8h_source.html">read_ahead_cache.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>