You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "masaori335 (via GitHub)" <gi...@apache.org> on 2024/06/04 00:52:54 UTC

Re: [PR] Clean up the insertion of documents into the aggregate write buffer [trafficserver]

masaori335 commented on code in PR #11407:
URL: https://github.com/apache/trafficserver/pull/11407#discussion_r1625199264


##########
src/iocore/cache/AggregateWriteBuffer.cc:
##########
@@ -30,6 +34,23 @@
 
 #include <cstring>
 
+void
+AggregateWriteBuffer::add(Doc const *doc, int approx_size)
+{
+  std::memcpy(this->_buffer + this->_buffer_pos, doc, doc->len);
+  this->_buffer_pos += approx_size;
+  this->add_bytes_pending_aggregation(approx_size);
+}
+
+Doc *
+AggregateWriteBuffer::emplace(int approx_size)
+{
+  Doc *result{new (this->_buffer + this->_buffer_pos) Doc};
+  this->_buffer_pos += approx_size;
+  this->add_bytes_pending_aggregation(-approx_size);

Review Comment:
   I'm confused with why `_bytes_pending_aggregation` is increased by `add` and it's reduced by `emplace`.



##########
src/iocore/cache/P_CacheVol.h:
##########
@@ -329,6 +329,7 @@ class Stripe : public Continuation
   void _init_dir();
   void _init_data_internal();
   void _init_data();
+  int  agg_copy(CacheVC *vc);

Review Comment:
   `_agg_copy` to follow naming convention?



-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org