On 01/16/2018 06:26 AM, kefu chai wrote:
On Tue, Jan 16, 2018 at 4:48 AM, Casey Bodley <cbodley@xxxxxxxxxx> wrote:
On 01/15/2018 02:30 PM, Matt Benjamin wrote:
It's the buffer::raw class that abstracts foreign buffer
representations now, is it now? A mechanism to allow seastar to
single-allocate a composite buffer::raw and temporary_buffer<char>
seems possible to imagine.
Matt
Thanks Matt. I think that's effectively what I did with
https://github.com/cbodley/ceph/commit/67ae06e488c50a6102c66d34b942ff207493ffd6.
It allocates a buffer::raw subclass that stores temporary_buffer<char> as a
member. The raw allocation here is the same one we'd see with any other
buffer type, so I was mistaken in thinking of this as extra overhead. The
allocation in the other direction is effectively seastar's version of this
same abstraction. So I think these conversions are fine as they are.
I do still think there are wins in generalizing denc to avoid these
conversions, but we'll have to explore whether it's worth the extra
complexity.
i see. is https://github.com/tchaikov/ceph/tree/wip-seastar-msg
something more close to what you are thinking about?
Dear Kefu, you are a wizard. That looks like a great start!
I'm guessing that segmented buffers will be the hard part - we might
look to the boost::asio buffer concepts for some ideas there?
they have const and non-const sequences:
http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/ConstBufferSequence.html
http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/MutableBufferSequence.html
and a dynamic/resizable sequence:
http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/DynamicBuffer.htm
Boost has lots of built-in adapters for array/vector/string types:
http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/buffer.html
If we could find a way to use those concepts directly, we'd get those
built-in types for free, and it should be easy to adapt other types like
those from seastar.
DynamicBuffer::prepare() looks like a natural way to do the append part
on encode, but it returns a MutableBufferSequence so is not guaranteed
to be contiguous. Can you remind me where we really depend on contiguous
buffers? Is it just that some types set need_contiguous=false because we
haven't yet implemented logic for segmented buffers, or are there cases
where implementing that logic is actually intractable?
Thanks,
Casey
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html