is byte-buffer returned by SerializationTraits<Message, void>::Serialize() read-only?

30 views
Skip to first unread message

mayank...@cohesity.com

unread,
Jun 26, 2019, 12:22:21 PM6/26/19
to grpc.io
Hi folks

I am referring to this definition - 
/// 1.  static Status Serialize(const Message& msg,
///                             ByteBuffer* buffer,
///                             bool* own_buffer);

Are the memory-regions referred to by slices in 'buffer' (output of Serialize) read-only for rest of gRPC stack? Otherwise my impl of Serialize() would have to copy these memory regions and then create slices & resulting byte-buffer. I want to avoid copy-ing these memory-regions.

Thanks
Mayank

Yang Gao

unread,
Jun 26, 2019, 2:49:16 PM6/26/19
to grpc.io
I think you can consider then read-only. The buffer is usually not changed in-place because you do not know whether you are the only owner that holds the ref.

Mayank Narula

unread,
Jun 27, 2019, 2:13:00 AM6/27/19
to grpc.io
That makes sense, thanks for confirming.
Reply all
Reply to author
Forward
0 new messages