This is a short preamble to refactoring agg_copy, but I'm PRing it separately because it mostly touches AggregateWriteBuffer and I'm more confident in the change. It moves agg_copy to Stripe::agg_copy and adds two new methods to AggregateWriteBuffer: add and emplace. The implementation of emplace uses placement new to create the document instead of a reinterpret cast because this is precisely what it's designed for and makes the intent crystal clear.
The two new methods also adjust the buffer position and the number of bytes pending copy. This puts directly related logic together that was previously spread out across hundreds of lines.
The AggregateWriteBuffer::add_buffer_pos method has been removed, improving encapsulation and simplifying the interface.
This also moves AggregateWriteBuffer.cc and AggregateWriteBuffer.h to src/ instead of include/ because it's an internal detail at this point, not part of the public interface.
This is a short preamble to refactoring agg_copy, but I'm PRing it separately because it mostly touches
AggregateWriteBuffer
and I'm more confident in the change. It movesagg_copy
toStripe::agg_copy
and adds two new methods toAggregateWriteBuffer
:add
andemplace
. The implementation ofemplace
uses placement new to create the document instead of a reinterpret cast because this is precisely what it's designed for and makes the intent crystal clear.The two new methods also adjust the buffer position and the number of bytes pending copy. This puts directly related logic together that was previously spread out across hundreds of lines.
The
AggregateWriteBuffer::add_buffer_pos
method has been removed, improving encapsulation and simplifying the interface.This also moves AggregateWriteBuffer.cc and AggregateWriteBuffer.h to src/ instead of include/ because it's an internal detail at this point, not part of the public interface.