From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 25 Jul 2019 02:08:03 +0300 From: Konstantin Osipov Subject: Re: [tarantool-patches] [PATCH 2/5] decimal: allow to encode/decode decimals as MsgPack Message-ID: <20190724230803.GB15185@atlas> References: <5f07a0f042b2b6c2d7afc2e595ecd56996afb48a.1563376957.git.sergepetrenko@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f07a0f042b2b6c2d7afc2e595ecd56996afb48a.1563376957.git.sergepetrenko@tarantool.org> To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com, Serge Petrenko List-ID: * Serge Petrenko [19/07/17 18:34]: > This patch adds the methods necessary to encode and decode decimals to > MsgPack. MsgPack EXT type (MP_EXT) together with a new extension type > MP_DECIMAL is used as a record header. > > The decimal MsgPack representation looks like this: > +--------+-------------------+------------+===============+ > | MP_EXT | length (optional) | MP_DECIMAL | PackedDecimal | > +--------+-------------------+------------+===============+ > The whole record may be encoded and decoded with > mp_encode_decimal() and mp_decode_decimal(). This is equivalent to > performing mp_encode_extl()/mp_decode_extl() on the first 3 fields and > decimal_pack/unpack() on the PackedDecimal field. Please extend tarantool/msgpuck with libdecimal-agnostic data type (e.g. struct mp_decimal { char data[] };, and encoders/decoders from this struct. Then use libdecimal api to fill this struct and pass to libmsgpuck for encoding. I think this patch is not worth having on its own, the next logical step after patching msgpack is make sure net.box can marshal decimals, and then - tarantool-python driver can read them, then update test-run with the new python driver, then add a new protocol test. -- Konstantin Osipov, Moscow, Russia