fs2-data icon indicating copy to clipboard operation
fs2-data copied to clipboard

Improve MessagePack model

Open jarmuszz opened this issue 1 year ago • 1 comments

Current implementation of the MessagePack model allows for creation of malformed objects as the ByteVector class (which underlays most of the types in the model) has a maximum length of Long.MaxValue bytes which is bigger than the specification defines for some types.

This PR proposes following changes:

  • Float32(ByteVector) -> Float32(Float)
  • Float64(ByteVector) -> Float64(Double)
  • Timestamp32(ByteVector) -> Timestamp64(Int)
  • Timestamp64(ByteVector, ByteVector) -> Timestamp64(Long) with nanoseconds and seconds fields
  • Timestamp96(ByteVector, ByteVector) -> Timestamp96(Int, Long)

Ref. #603

jarmuszz avatar Jul 07 '24 14:07 jarmuszz

I have currently held back from changing the integer types. UnsignedInt would have to hold a BigInt in order to keep a sign which is not quite performant. We could also bit cast it into a Long but I think it would be confusing for users.

jarmuszz avatar Jul 07 '24 14:07 jarmuszz

Looks good to me, let's see if @ybasket has some comments.

No, was only waiting for the small fix you had requested. LGTM

ybasket avatar Jul 14 '24 21:07 ybasket