From: Timur Safin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: v.shpilevoy@tarantool.org, olegrok@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v3 0/9] Initial datetime support
Date: Mon, 2 Aug 2021 03:40:56 +0300 [thread overview]
Message-ID: <cover.1627864075.git.tsafin@tarantool.org> (raw)
* Version #3 changes:
- renamed `struct datetime_t` to `struct datetime`, and `struct
datetime_interval_t` to `struct datetime_interval`;
- significantly reworked arguments checks in module api entries;
- fixed datetime comparisons;
- changed hints calculation to take into account fractional part;
- provided more comments here and there;
NB! There are MacOSX problems due to GLIBC specific code used (as Vlad
has already pointed out) - so additional patch, making it more
cross-compatible coming here soon...
* Version #2 changes:
- fixed problem with overloaded '-' and '+' operations for datetime
arguments;
- fixed messagepack serialization problems;
- heavily documented MessagePack serialization schema in the code;
- introduced working implementation of datetime hints for storage engines;
- made interval related names be more consistent, renamed durations and period
to intervals, i.e. t_datetime_duration to datetime_interval_t,
duration_* to interval_*, period to interval;
- properly implemented all reasonable cases of datetime+interval
arithmetic;
- moved all initialization code to utils.c;
- renamed core/mp_datetime.c to core/datetime.c because it makes more
sense now;
* Version #1 - initial RFC series
In brief
--------
This patchset implements datetime lua support in box, with serialization
to messagepack, yaml, json and lua mode. Also it contains storage
engines' indices implementation for datetime type introduced.
* Current implementation is heavily influenced by Sci-Lua lua-time module
https://github.com/stepelu/lua-time
e.g. you could find very similar approach for handling of operations
with year or month long intervals (which should be handled differently than
usual intervals of seconds, or days).
* But internally we actually use Christian Hanson' c-dt module
https://github.com/chansen/c-dt
(though it has been modified slightly for cleaner integration
into cmake build process)
Datetime Module API
-------------------
We used to have here draft documentation of datetime module api, but
for a convenience it has been extracted to the discussion topic there -
https://github.com/tarantool/tarantool/discussions/6244#discussioncomment-1043988
Messagepack serialization schema
--------------------------------
In short it looks like:
- now we introduce new MP_EXT extension type #4;
- we may save 1 required and 2 optional fields for datetime field;
In all gory details it's explained in MessagePack serialization schema depicted here:
https://github.com/tarantool/tarantool/discussions/6244#discussioncomment-1043990
https://github.com/tarantool/tarantool/issues/5941
https://github.com/tarantool/tarantool/issues/5946
https://github.com/tarantool/tarantool/tree/tsafin/gh-5941-datetime-v3
Timur Safin (9):
build: add Christian Hansen c-dt to the build
lua: built-in module datetime
lua, datetime: datetime tests
lua, datetime: display datetime
box, datetime: messagepack support for datetime
box, datetime: datetime comparison for indices
lua, datetime: time intervals support
datetime: changelog for datetime module
lua, box, datetime: rename struct datetime_t
.gitmodules | 3 +
CMakeLists.txt | 8 +
.../gh-5941-datetime-type-support.md | 4 +
cmake/BuildCDT.cmake | 6 +
src/CMakeLists.txt | 3 +
src/box/field_def.c | 52 +-
src/box/field_def.h | 4 +
src/box/lua/serialize_lua.c | 7 +-
src/box/memtx_space.c | 3 +-
src/box/msgpack.c | 7 +-
src/box/tuple_compare.cc | 76 ++
src/box/vinyl.c | 3 +-
src/exports.h | 29 +
src/lib/core/CMakeLists.txt | 4 +-
src/lib/core/datetime.c | 250 ++++
src/lib/core/datetime.h | 115 ++
src/lib/core/mp_extension_types.h | 1 +
src/lib/mpstream/mpstream.c | 10 +
src/lib/mpstream/mpstream.h | 3 +
src/lua/datetime.lua | 1058 +++++++++++++++++
src/lua/init.c | 4 +-
src/lua/msgpack.c | 12 +
src/lua/msgpackffi.lua | 18 +
src/lua/serializer.c | 4 +
src/lua/serializer.h | 2 +
src/lua/utils.c | 28 +-
src/lua/utils.h | 12 +
test/app-tap/datetime.test.lua | 367 ++++++
test/engine/datetime.result | 77 ++
test/engine/datetime.test.lua | 35 +
test/unit/CMakeLists.txt | 2 +
test/unit/datetime.c | 221 ++++
test/unit/datetime.result | 358 ++++++
third_party/c-dt | 1 +
third_party/lua-cjson/lua_cjson.c | 8 +
third_party/lua-yaml/lyaml.cc | 6 +-
36 files changed, 2776 insertions(+), 25 deletions(-)
create mode 100644 changelogs/unreleased/gh-5941-datetime-type-support.md
create mode 100644 cmake/BuildCDT.cmake
create mode 100755 src/lib/core/datetime.c
create mode 100644 src/lib/core/datetime.h
create mode 100644 src/lua/datetime.lua
create mode 100755 test/app-tap/datetime.test.lua
create mode 100644 test/engine/datetime.result
create mode 100644 test/engine/datetime.test.lua
create mode 100644 test/unit/datetime.c
create mode 100644 test/unit/datetime.result
create mode 160000 third_party/c-dt
--
2.29.2
next reply other threads:[~2021-08-02 0:41 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 0:40 Timur Safin via Tarantool-patches [this message]
2021-08-02 0:40 ` [Tarantool-patches] [PATCH v3 1/9] build: add Christian Hansen c-dt to the build Timur Safin via Tarantool-patches
2021-08-04 23:58 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-05 8:55 ` Safin Timur via Tarantool-patches
2021-08-08 14:34 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-02 0:40 ` [Tarantool-patches] [PATCH v3 2/9] lua: built-in module datetime Timur Safin via Tarantool-patches
2021-08-04 23:58 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-06 0:23 ` Safin Timur via Tarantool-patches
2021-08-06 1:30 ` Oleg Babin via Tarantool-patches
2021-08-06 13:00 ` Safin Timur via Tarantool-patches
2021-08-06 17:24 ` Safin Timur via Tarantool-patches
2021-08-08 11:26 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-08 16:35 ` Safin Timur via Tarantool-patches
2021-08-10 12:20 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-10 12:21 ` Igor Munkin via Tarantool-patches
2021-08-12 20:47 ` Safin Timur via Tarantool-patches
2021-08-15 20:52 ` Safin Timur via Tarantool-patches
2021-08-06 0:26 ` Safin Timur via Tarantool-patches
2021-08-08 14:34 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-08 16:47 ` Safin Timur via Tarantool-patches
2021-08-02 0:40 ` [Tarantool-patches] [PATCH v3 3/9] lua, datetime: datetime tests Timur Safin via Tarantool-patches
2021-08-06 0:25 ` Safin Timur via Tarantool-patches
2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 4/9] lua, datetime: display datetime Timur Safin via Tarantool-patches
2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 5/9] box, datetime: messagepack support for datetime Timur Safin via Tarantool-patches
2021-08-03 13:38 ` Timur Safin via Tarantool-patches
2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 6/9] box, datetime: datetime comparison for indices Timur Safin via Tarantool-patches
2021-08-03 12:02 ` Serge Petrenko via Tarantool-patches
2021-08-03 12:59 ` Timur Safin via Tarantool-patches
2021-08-04 10:12 ` Timur Safin via Tarantool-patches
2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 7/9] lua, datetime: time intervals support Timur Safin via Tarantool-patches
2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 8/9] datetime: changelog for datetime module Timur Safin via Tarantool-patches
2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 9/9] lua, box, datetime: rename struct datetime_t Timur Safin via Tarantool-patches
2021-08-06 0:27 ` Safin Timur via Tarantool-patches
2021-08-03 21:23 ` [Tarantool-patches] [PATCH v3 1/2] datetime: update tests for macosx Timur Safin via Tarantool-patches
2021-08-06 0:28 ` Safin Timur via Tarantool-patches
2021-08-03 21:23 ` [Tarantool-patches] [PATCH v3 2/2] lua, datetime: introduce ctime, strftime wrappers Timur Safin via Tarantool-patches
2021-08-06 0:30 ` Safin Timur via Tarantool-patches
2021-08-03 21:26 ` [Tarantool-patches] [PATCH v3 0/9] Initial datetime support Timur Safin via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1627864075.git.tsafin@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=olegrok@tarantool.org \
--cc=tsafin@tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v3 0/9] Initial datetime support' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox