Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: tarantool-patches@freelists.org
Subject: [PATCH v2 1/7] Move hint_t definition to tuple_compare.h
Date: Sat,  6 Apr 2019 23:01:48 +0300	[thread overview]
Message-ID: <337310aef56d65deee641375c1eac21e5c905c01.1554580275.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1554580275.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1554580275.git.vdavydov.dev@gmail.com>

So as not to include heavy key_def.h when we only need hint_t.
---
 src/box/key_def.h       | 22 +---------------------
 src/box/tuple_compare.h | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/box/key_def.h b/src/box/key_def.h
index 50009dc0..c269482a 100644
--- a/src/box/key_def.h
+++ b/src/box/key_def.h
@@ -36,6 +36,7 @@
 #include <msgpuck.h>
 #include "field_def.h"
 #include "coll_id.h"
+#include "tuple_compare.h"
 
 #if defined(__cplusplus)
 extern "C" {
@@ -117,27 +118,6 @@ struct key_def;
 struct tuple;
 
 /**
- * Tuple comparison hint h(t) is such a function of tuple t that
- * the following conditions always hold for any pair of tuples
- * t1 and t2:
- *
- *   if h(t1) < h(t2) then t1 < t2;
- *   if h(t1) > h(t2) then t1 > t2;
- *   if h(t1) == h(t2) then t1 may or may not be equal to t2.
- *
- * These rules mean that instead of direct tuple vs tuple
- * (or tuple vs key) comparison one may compare their hints
- * first and only if theirs hints equal compare the tuples
- * themselves.
- */
-typedef uint64_t hint_t;
-
-/**
- * Reserved value to use when comparison hint is undefined.
- */
-#define HINT_NONE ((hint_t)UINT64_MAX)
-
-/**
  * Get is_nullable property of key_part.
  * @param key_part for which attribute is being fetched
  *
diff --git a/src/box/tuple_compare.h b/src/box/tuple_compare.h
index 6538d5fc..77140ca0 100644
--- a/src/box/tuple_compare.h
+++ b/src/box/tuple_compare.h
@@ -30,6 +30,8 @@
  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include <stdint.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif /* defined(__cplusplus) */
@@ -37,6 +39,27 @@ extern "C" {
 struct key_def;
 
 /**
+ * Tuple comparison hint h(t) is such a function of tuple t that
+ * the following conditions always hold for any pair of tuples
+ * t1 and t2:
+ *
+ *   if h(t1) < h(t2) then t1 < t2;
+ *   if h(t1) > h(t2) then t1 > t2;
+ *   if h(t1) == h(t2) then t1 may or may not be equal to t2.
+ *
+ * These rules mean that instead of direct tuple vs tuple
+ * (or tuple vs key) comparison one may compare their hints
+ * first and only if theirs hints equal compare the tuples
+ * themselves.
+ */
+typedef uint64_t hint_t;
+
+/**
+ * Reserved value to use when comparison hint is undefined.
+ */
+#define HINT_NONE ((hint_t)UINT64_MAX)
+
+/**
  * Initialize comparator functions for the key_def.
  * @param key_def key definition
  */
-- 
2.11.0

  reply	other threads:[~2019-04-06 20:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-06 20:01 [PATCH v2 0/7] Incorporate tuple comparison hints into Vinyl Vladimir Davydov
2019-04-06 20:01 ` Vladimir Davydov [this message]
2019-04-08 12:08   ` [tarantool-patches] Re: [PATCH v2 1/7] Move hint_t definition to tuple_compare.h Konstantin Osipov
2019-04-06 20:01 ` [PATCH v2 2/7] vinyl: rename vy_cache_entry to vy_cache_node Vladimir Davydov
2019-04-08 12:09   ` [tarantool-patches] " Konstantin Osipov
2019-04-06 20:01 ` [PATCH v2 3/7] vinyl: rename tree_mem_key to vy_mem_tree_key Vladimir Davydov
2019-04-08 12:09   ` [tarantool-patches] " Konstantin Osipov
2019-04-06 20:01 ` [PATCH v2 4/7] vinyl: zap vy_mem_iterator_curr_stmt helper Vladimir Davydov
2019-04-08 12:09   ` [tarantool-patches] " Konstantin Osipov
2019-04-06 20:01 ` [PATCH v2 5/7] vinyl: add wrapper around vy_tx_set Vladimir Davydov
2019-04-06 20:01 ` [PATCH v2 6/7] vinyl: prepare for storing hints in vinyl data structures Vladimir Davydov
2019-04-06 20:01 ` [PATCH v2 7/7] vinyl: incorporate tuple comparison hints into " Vladimir Davydov
2019-04-07 12:33 ` [PATCH v2 0/7] Incorporate tuple comparison hints into Vinyl Vladimir Davydov

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=337310aef56d65deee641375c1eac21e5c905c01.1554580275.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 1/7] Move hint_t definition to tuple_compare.h' \
    /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