JosiahWI commented on code in PR #10987:
URL: https://github.com/apache/trafficserver/pull/10987#discussion_r1452843446


##########
src/iocore/cache/CacheVC.cc:
##########
@@ -535,6 +519,40 @@ LramHit: {
   return EVENT_RETURN; // allow the caller to release the volume lock
 }
 
+bool
+CacheVC::check_ram_cache()
+{
+  int64_t o           = dir_offset(&this->dir);
+  int ram_hit_state   = this->stripe->ram_cache->get(read_key, &this->buf, 
static_cast<uint64_t>(o));
+  f.compressed_in_ram = (ram_hit_state > RAM_HIT_COMPRESS_NONE) ? 1 : 0;
+  return ram_hit_state >= RAM_HIT_COMPRESS_NONE;
+}
+
+bool
+CacheVC::check_last_open_read_call()
+{
+  if (*this->read_key == this->stripe->first_fragment_key && 
dir_offset(&this->dir) == this->stripe->first_fragment_offset) {
+    this->buf = this->stripe->first_fragment_data;
+    return true;
+  }
+  return false;
+}
+
+bool
+CacheVC::check_aggregation_buffer()
+{
+  if (!dir_agg_buf_valid(this->stripe, &this->dir)) {
+    return false;
+  }
+
+  this->buf = 
new_IOBufferData(iobuffer_size_to_index(this->io.aiocb.aio_nbytes, 
MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
+  char *doc = this->buf->data();
+  [[maybe_unused]] bool success = 
this->stripe->copy_from_aggregate_write_buffer(doc, dir, 
this->io.aiocb.aio_nbytes);
+  // We already confirmed that the copy was valid, so it should not fail.
+  assert(success);

Review Comment:
   Good catch.



##########
include/iocore/cache/CacheVC.h:
##########
@@ -141,6 +141,9 @@ struct CacheVC : public CacheVConnection {
 
   int handleReadDone(int event, Event *e);
   int handleRead(int event, Event *e);
+  bool check_ram_cache();

Review Comment:
   Great idea!



-- 
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