[ 
https://issues.apache.org/jira/browse/THRIFT-5772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17831710#comment-17831710
 ] 

Triton Circonflexe commented on THRIFT-5772:
--------------------------------------------

I forgot the goal to remove the Boost dependency, you’re right.
In this case, it make sense to have a Thrift-specific wrapper class that could 
expose the minimum usual interface (enough for the users to easily move into a 
more complete implementation like the one from Boost).

So, regarding this wrapper class, I took a quick look at multiple C++ uuid 
libraries (crossuuid, proposal P0959 for  std::uuid, Boost::uuid, 
studlib::uuid, …) and there is always a way to construct from some variant of 
the raw bytes (from what I saw, always in full network order) so it might be a 
good idea to add one that can be used internally as well as a {{data()}} member 
function or similar to avoid intermediate string conversion in most cases. With 
this small addition, I think your proposal will be usable easily for anyone who 
have their own library to manage uuids (having both {{8-4-4-4-12}} and 
{{\{8-4-4-4-12\}}} strings probably covers almost  every use cases if not all 
and raw data would allow for better performances in many cases).

For the wrapper class PR, I’d say that once there is a consensus on the API, 
you can merge it directly in this PR to have a single step to the apache repo 
and avoid the risk of having an API change in between version (although risk is 
low since 0.20.0 just came out).

> Add UUID support for C++
> ------------------------
>
>                 Key: THRIFT-5772
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5772
>             Project: Thrift
>          Issue Type: New Feature
>            Reporter: Carel
>            Priority: Minor
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Starting the discussion to add UUID support for C++.
> I have started with an implementation (See PR linked soon)
> Open points for discussion: 
> # Is there perhaps a need to add a wrapper class for UUID?
> ## I started off with {{std::string}} for ease-of-use
> ## 'ease-of-use' has the drawback of ease of miss-use... 
> ## Something lightweight as a strong wrapper to wrap a `{{uint8_t data[16];}}`
> ### A wrapper gives us the ability to add utility functions, like 
> `to_string()` and `from_string()`
> ### Can use {{boost::uuids::uuid}} in the implementation, hidden from users 
> (see current implementation)
> ## I will see if I can't implement something while this PR is looked at.
> # Can someone help with some cross tests
> ## With the absence of working dockers I am really struggling to get other 
> languages compiled.
> ## I don't have enough experience with other languages to effectively do this
> ## I will probably be able to add Java tests if there is something to build 
> on (pointers needed)
> # How important is the JSON side? 
> ## I did add the support but I see only go has some support for it. 
> # (edit) How important is the HOST vs Network order on the UUID?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to