These days people communicating uuids and ipv6 addresses between processes is quite common. These can both be addressed with a 128 bit type.
Just to give an idea of how many users already want this and hack around this.
I have protobuf code generator for go (gogoprotobuf) and I have added a feature called customtype. This allows you to change a bytes type to a type of your choice, but still transfer it as bytes. This allows for quite a large variety of applications, but what people use it for is very constraint. Most users just want some 128bit type.
Transferring this type as bytes (i.e. with the length-delimited wire type) sounds like a good idea. That way we would have the option of implementing it first just for one or two languages, and other languages without support for it could at least handle the data gracefully (e.g. by treating it as an unknown field or just a bytes field). I wonder what the API would look like since as far as I know most languages don't have a standard 128-bit type--maybe just the raw array of 16 bytes?
perfect :)
For Go you can do this nicely with a [16]byte into the struct so no extra malloc. Same goes for C when you expose the length as a constant.
How would one do that for Java? Two (signed) long? :-( Just a byte array couses marshalling errors on size mismatch. A generated class with fields byte0 to byte15?
@gerben-s @jtattermusch why is this closed?
+1 to this feature request -- we could make a good use of it in YugaByte DB as well, for UUIDs, IPv6 addresses, MVCC timestamps, etc.
Any progress?
I'm trying to get this one right at pascaldekloe/colfer#36. Feedback wanted.
Most helpful comment
+1 to this feature request -- we could make a good use of it in YugaByte DB as well, for UUIDs, IPv6 addresses, MVCC timestamps, etc.