[PATCH v2 1/7] Move hint_t definition to tuple_compare.h
Vladimir Davydov
vdavydov.dev at gmail.com
Sat Apr 6 23:01:48 MSK 2019
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
More information about the Tarantool-patches
mailing list