lucasfang commented on code in PR #209:
URL: https://github.com/apache/paimon-cpp/pull/209#discussion_r3802506780


##########
include/paimon/utils/read_ahead_cache.h:
##########
@@ -162,11 +173,28 @@ class PAIMON_EXPORT ReadAheadCache {
     /// on the cache configuration.
     Status Init(std::vector<ByteRange>&& ranges);
 
-    /// Read a range previously provided to Init().
+    /// Read a range previously provided to Init(), copying the cached data
+    /// directly into the given destination buffer.
+    ///
+    /// Multi-segment hits are copied into `dest` segment by segment, without
+    /// an intermediate assembled buffer.
     /// @param range The byte range to read.
-    /// @return The byte slice containing the requested data. If the data is 
not yet cached
-    /// (cache miss), the returned `ByteSlice` will have a null buffer 
(`buffer == nullptr`)
-    Result<ByteSlice> Read(const ByteRange& range);
+    /// @param dest Destination buffer with at least `range.length` bytes.
+    /// @return true if the range was served from the cache and `dest` was
+    /// filled; false on cache miss (`dest` is left untouched).
+    Result<bool> Read(const ByteRange& range, char* dest);
+
+    /// Start fetching the first batch of pending ranges immediately.
+    /// Init() only registers the ranges; without Warmup() the first fetch 
starts
+    /// when the first Read() arrives, racing the caller's own miss fetch.
+    void Warmup();
+
+    /// Collect hit/miss counters of Read() calls and the prefetch IO
+    /// counters into the given metrics as counters named after
+    /// `ReadAheadCacheMetrics`. Only reads issued through Read() are counted
+    /// as hits/misses; prefetch fetches dispatched by the cache itself are
+    /// counted in the fetch counters instead.
+    void CollectMetrics(const std::shared_ptr<Metrics>& metrics) const;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to