-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This changes allow the usage of the c++ grpc arena feature to allocate the messages from the same location, the initial motivation of this was save all the message strings in the same memory portion but seems that the open source version of the grpc don't allow it and like google has this internal feature isn't possible create a PR. Please google, if you dont mind, could you spend a little of your engineering team time to open source it? protocolbuffers/protobuf#1896
- Loading branch information
Showing
13 changed files
with
96 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1 @@ | ||
#include "mhconfig/api/session.h" | ||
|
||
namespace mhconfig | ||
{ | ||
namespace api | ||
{ | ||
|
||
bool parse_from_byte_buffer( | ||
const grpc::ByteBuffer& buffer, | ||
grpc::protobuf::Message& message | ||
) { | ||
std::vector<grpc::Slice> slices; | ||
buffer.Dump(&slices); | ||
grpc::string buf; | ||
buf.reserve(buffer.Length()); | ||
for (auto s = slices.begin(); s != slices.end(); ++s) { | ||
buf.append(reinterpret_cast<const char*>(s->begin()), s->size()); | ||
} | ||
return message.ParseFromString(buf); | ||
} | ||
|
||
} /* api */ | ||
} /* mhconfig */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.