isomorfeus-ferret 0.17.2 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/ext/isomorfeus_ferret_ext/benchmark.c +9 -20
  3. data/ext/isomorfeus_ferret_ext/benchmarks_all.h +1 -2
  4. data/ext/isomorfeus_ferret_ext/bm_hash.c +1 -2
  5. data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +4 -2
  6. data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +3 -2
  7. data/ext/isomorfeus_ferret_ext/frb_analysis.c +4 -5
  8. data/ext/isomorfeus_ferret_ext/frb_field_info.c +3 -4
  9. data/ext/isomorfeus_ferret_ext/frb_index.c +118 -125
  10. data/ext/isomorfeus_ferret_ext/frb_lazy_doc.c +14 -16
  11. data/ext/isomorfeus_ferret_ext/frb_search.c +31 -23
  12. data/ext/isomorfeus_ferret_ext/frb_store.c +27 -13
  13. data/ext/isomorfeus_ferret_ext/frb_utils.c +3 -6
  14. data/ext/isomorfeus_ferret_ext/frt_analysis.c +39 -46
  15. data/ext/isomorfeus_ferret_ext/frt_analysis.h +9 -9
  16. data/ext/isomorfeus_ferret_ext/frt_array.c +11 -22
  17. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +3 -6
  18. data/ext/isomorfeus_ferret_ext/frt_doc_field.c +87 -0
  19. data/ext/isomorfeus_ferret_ext/frt_doc_field.h +26 -0
  20. data/ext/isomorfeus_ferret_ext/frt_document.c +4 -97
  21. data/ext/isomorfeus_ferret_ext/frt_document.h +2 -27
  22. data/ext/isomorfeus_ferret_ext/frt_except.c +8 -6
  23. data/ext/isomorfeus_ferret_ext/frt_except.h +1 -2
  24. data/ext/isomorfeus_ferret_ext/frt_field_index.c +13 -32
  25. data/ext/isomorfeus_ferret_ext/frt_field_index.h +0 -6
  26. data/ext/isomorfeus_ferret_ext/frt_field_info.c +69 -0
  27. data/ext/isomorfeus_ferret_ext/frt_field_info.h +49 -0
  28. data/ext/isomorfeus_ferret_ext/frt_field_infos.c +196 -0
  29. data/ext/isomorfeus_ferret_ext/frt_field_infos.h +35 -0
  30. data/ext/isomorfeus_ferret_ext/frt_global.c +10 -4
  31. data/ext/isomorfeus_ferret_ext/frt_global.h +11 -15
  32. data/ext/isomorfeus_ferret_ext/frt_hash.c +8 -8
  33. data/ext/isomorfeus_ferret_ext/frt_hash.h +1 -2
  34. data/ext/isomorfeus_ferret_ext/frt_hashset.c +20 -40
  35. data/ext/isomorfeus_ferret_ext/frt_hashset.h +1 -2
  36. data/ext/isomorfeus_ferret_ext/frt_helper.c +7 -15
  37. data/ext/isomorfeus_ferret_ext/frt_in_stream.c +35 -45
  38. data/ext/isomorfeus_ferret_ext/frt_in_stream.h +3 -2
  39. data/ext/isomorfeus_ferret_ext/frt_ind.c +20 -38
  40. data/ext/isomorfeus_ferret_ext/frt_index.c +292 -790
  41. data/ext/isomorfeus_ferret_ext/frt_index.h +1 -102
  42. data/ext/isomorfeus_ferret_ext/frt_lang.c +5 -10
  43. data/ext/isomorfeus_ferret_ext/frt_lazy_doc.c +3 -3
  44. data/ext/isomorfeus_ferret_ext/frt_lazy_doc.h +1 -1
  45. data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.c +18 -25
  46. data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.h +5 -5
  47. data/ext/isomorfeus_ferret_ext/frt_mdbx_store.c +102 -70
  48. data/ext/isomorfeus_ferret_ext/frt_mempool.c +8 -16
  49. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +23 -46
  50. data/ext/isomorfeus_ferret_ext/frt_multimapper.h +4 -8
  51. data/ext/isomorfeus_ferret_ext/frt_out_stream.c +31 -43
  52. data/ext/isomorfeus_ferret_ext/frt_out_stream.h +2 -2
  53. data/ext/isomorfeus_ferret_ext/frt_posh.c +6 -819
  54. data/ext/isomorfeus_ferret_ext/frt_posh.h +0 -57
  55. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.c +11 -22
  56. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.h +1 -2
  57. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +85 -171
  58. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +8 -16
  59. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +1 -2
  60. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +49 -98
  61. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +52 -104
  62. data/ext/isomorfeus_ferret_ext/frt_q_range.c +6 -12
  63. data/ext/isomorfeus_ferret_ext/frt_q_span.c +113 -226
  64. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +1 -2
  65. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +134 -85
  66. data/ext/isomorfeus_ferret_ext/frt_search.c +82 -164
  67. data/ext/isomorfeus_ferret_ext/frt_similarity.c +11 -22
  68. data/ext/isomorfeus_ferret_ext/frt_similarity.h +1 -2
  69. data/ext/isomorfeus_ferret_ext/frt_store.c +13 -25
  70. data/ext/isomorfeus_ferret_ext/frt_store.h +86 -52
  71. data/ext/isomorfeus_ferret_ext/frt_term_vectors.c +8 -16
  72. data/ext/isomorfeus_ferret_ext/frt_win32.h +5 -10
  73. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +12 -11
  74. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +11 -13
  75. data/ext/isomorfeus_ferret_ext/lz4.c +422 -195
  76. data/ext/isomorfeus_ferret_ext/lz4.h +114 -46
  77. data/ext/isomorfeus_ferret_ext/lz4frame.c +421 -242
  78. data/ext/isomorfeus_ferret_ext/lz4frame.h +122 -53
  79. data/ext/isomorfeus_ferret_ext/lz4hc.c +127 -111
  80. data/ext/isomorfeus_ferret_ext/lz4hc.h +14 -14
  81. data/ext/isomorfeus_ferret_ext/lz4xxhash.h +1 -1
  82. data/ext/isomorfeus_ferret_ext/mdbx.c +3762 -2526
  83. data/ext/isomorfeus_ferret_ext/mdbx.h +115 -70
  84. data/ext/isomorfeus_ferret_ext/test.c +40 -87
  85. data/ext/isomorfeus_ferret_ext/test.h +3 -6
  86. data/ext/isomorfeus_ferret_ext/test_1710.c +11 -13
  87. data/ext/isomorfeus_ferret_ext/test_analysis.c +32 -64
  88. data/ext/isomorfeus_ferret_ext/test_array.c +6 -12
  89. data/ext/isomorfeus_ferret_ext/test_bitvector.c +12 -24
  90. data/ext/isomorfeus_ferret_ext/test_document.c +23 -33
  91. data/ext/isomorfeus_ferret_ext/test_except.c +10 -21
  92. data/ext/isomorfeus_ferret_ext/test_fields.c +62 -68
  93. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +15 -23
  94. data/ext/isomorfeus_ferret_ext/test_filter.c +17 -27
  95. data/ext/isomorfeus_ferret_ext/test_global.c +14 -29
  96. data/ext/isomorfeus_ferret_ext/test_hash.c +19 -38
  97. data/ext/isomorfeus_ferret_ext/test_hashset.c +8 -16
  98. data/ext/isomorfeus_ferret_ext/test_helper.c +4 -8
  99. data/ext/isomorfeus_ferret_ext/test_highlighter.c +16 -28
  100. data/ext/isomorfeus_ferret_ext/test_index.c +277 -487
  101. data/ext/isomorfeus_ferret_ext/test_lang.c +7 -14
  102. data/ext/isomorfeus_ferret_ext/test_mdbx_store.c +2 -5
  103. data/ext/isomorfeus_ferret_ext/test_mempool.c +5 -10
  104. data/ext/isomorfeus_ferret_ext/test_multimapper.c +3 -6
  105. data/ext/isomorfeus_ferret_ext/test_priorityqueue.c +9 -18
  106. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +4 -6
  107. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +3 -4
  108. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +9 -15
  109. data/ext/isomorfeus_ferret_ext/test_q_parser.c +8 -16
  110. data/ext/isomorfeus_ferret_ext/test_q_span.c +19 -35
  111. data/ext/isomorfeus_ferret_ext/test_ram_store.c +14 -13
  112. data/ext/isomorfeus_ferret_ext/test_search.c +60 -109
  113. data/ext/isomorfeus_ferret_ext/test_segments.c +8 -13
  114. data/ext/isomorfeus_ferret_ext/test_similarity.c +2 -4
  115. data/ext/isomorfeus_ferret_ext/test_sort.c +14 -24
  116. data/ext/isomorfeus_ferret_ext/test_store.c +96 -115
  117. data/ext/isomorfeus_ferret_ext/test_term.c +9 -15
  118. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -14
  119. data/ext/isomorfeus_ferret_ext/test_test.c +4 -8
  120. data/ext/isomorfeus_ferret_ext/test_threading.c +14 -20
  121. data/ext/isomorfeus_ferret_ext/testhelper.c +11 -21
  122. data/ext/isomorfeus_ferret_ext/testhelper.h +1 -1
  123. data/ext/isomorfeus_ferret_ext/tests_all.h +1 -2
  124. data/lib/isomorfeus/ferret/index/index.rb +1 -1
  125. data/lib/isomorfeus/ferret/version.rb +1 -1
  126. metadata +24 -4
@@ -77,10 +77,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
77
77
 
78
78
  #if defined(__riscv) || defined(__riscv__) || defined(__RISCV) || \
79
79
  defined(__RISCV__)
80
- #warning The RISC-V architecture is intentionally insecure by design. \
80
+ #warning "The RISC-V architecture is intentionally insecure by design. \
81
81
  Please delete this admonition at your own risk, \
82
82
  if you make such decision informed and consciously. \
83
- Refer to https://clck.ru/32d9xH for more information.
83
+ Refer to https://clck.ru/32d9xH for more information."
84
84
  #endif /* RISC-V */
85
85
 
86
86
  #ifdef _MSC_VER
@@ -1926,6 +1926,15 @@ enum MDBX_error_t {
1926
1926
  /** Overlapping read and write transactions for the current thread */
1927
1927
  MDBX_TXN_OVERLAPPING = -30415,
1928
1928
 
1929
+ /** Internal error returned in case of insufficient free pages
1930
+ * during GC update. Used as a debugging aid.
1931
+ * \note From the user's point of view, semantically
1932
+ * is equivalent to \ref MDBX_PROBLEM. */
1933
+ MDBX_BACKLOG_DEPLETED = -30414,
1934
+
1935
+ /** Alternative/Duplicate LCK-file is exists and should be removed manually */
1936
+ MDBX_DUPLICATED_CLK = -30413,
1937
+
1929
1938
  /* The last of MDBX-added error codes */
1930
1939
  MDBX_LAST_ADDED_ERRCODE = MDBX_TXN_OVERLAPPING,
1931
1940
 
@@ -2220,6 +2229,39 @@ enum MDBX_option_t {
2220
2229
  * to 50% (half empty) which corresponds to the range from 8192 and to 32768
2221
2230
  * in units respectively. */
2222
2231
  MDBX_opt_merge_threshold_16dot16_percent,
2232
+
2233
+ /** \brief Controls the choosing between use write-through disk writes and
2234
+ * usual ones with followed flush by the `fdatasync()` syscall.
2235
+ * \details Depending on the operating system, storage subsystem
2236
+ * characteristics and the use case, higher performance can be achieved by
2237
+ * either using write-through or a serie of usual/lazy writes followed by
2238
+ * the flush-to-disk.
2239
+ *
2240
+ * Basically for N chunks the latency/cost of write-through is:
2241
+ * latency = N * (emit + round-trip-to-storage + storage-execution);
2242
+ * And for serie of lazy writes with flush is:
2243
+ * latency = N * (emit + storage-execution) + flush + round-trip-to-storage.
2244
+ *
2245
+ * So, for large N and/or noteable round-trip-to-storage the write+flush
2246
+ * approach is win. But for small N and/or near-zero NVMe-like latency
2247
+ * the write-through is better.
2248
+ *
2249
+ * To solve this issue libmdbx provide `MDBX_opt_writethrough_threshold`:
2250
+ * - when N described above less or equal specified threshold,
2251
+ * a write-through approach will be used;
2252
+ * - otherwise, when N great than specified threshold,
2253
+ * a write-and-flush approach will be used.
2254
+ *
2255
+ * \note MDBX_opt_writethrough_threshold affects only \ref MDBX_SYNC_DURABLE
2256
+ * mode without \ref MDBX_WRITEMAP, and not supported on Windows.
2257
+ * On Windows a write-through is used always but \ref MDBX_NOMETASYNC could
2258
+ * be used for switching to write-and-flush. */
2259
+ MDBX_opt_writethrough_threshold,
2260
+
2261
+ /** \brief Controls prevention of page-faults of reclaimed and allocated pages
2262
+ * in the \ref MDBX_WRITEMAP mode by clearing ones through file handle before
2263
+ * touching. */
2264
+ MDBX_opt_prefault_write_enable,
2223
2265
  };
2224
2266
  #ifndef __cplusplus
2225
2267
  /** \ingroup c_settings */
@@ -2555,16 +2597,18 @@ struct MDBX_envinfo {
2555
2597
  * first process opened the database after everyone had previously closed it).
2556
2598
  */
2557
2599
  struct {
2558
- uint64_t newly; /**< Quantity of a new pages added */
2559
- uint64_t cow; /**< Quantity of pages copied for update */
2560
- uint64_t clone; /**< Quantity of parent's dirty pages clones
2561
- for nested transactions */
2562
- uint64_t split; /**< Page splits */
2563
- uint64_t merge; /**< Page merges */
2564
- uint64_t spill; /**< Quantity of spilled dirty pages */
2565
- uint64_t unspill; /**< Quantity of unspilled/reloaded pages */
2566
- uint64_t wops; /**< Number of explicit write operations (not a pages)
2567
- to a disk */
2600
+ uint64_t newly; /**< Quantity of a new pages added */
2601
+ uint64_t cow; /**< Quantity of pages copied for update */
2602
+ uint64_t clone; /**< Quantity of parent's dirty pages clones
2603
+ for nested transactions */
2604
+ uint64_t split; /**< Page splits */
2605
+ uint64_t merge; /**< Page merges */
2606
+ uint64_t spill; /**< Quantity of spilled dirty pages */
2607
+ uint64_t unspill; /**< Quantity of unspilled/reloaded pages */
2608
+ uint64_t wops; /**< Number of explicit write operations (not a pages)
2609
+ to a disk */
2610
+ uint64_t prefault; /**< Number of prefault write operations (not a pages) */
2611
+ uint64_t mincore; /**< Number of mincore() calls */
2568
2612
  uint64_t
2569
2613
  msync; /**< Number of explicit msync-to-disk operations (not a pages) */
2570
2614
  uint64_t
@@ -3735,75 +3779,69 @@ struct MDBX_commit_latency {
3735
3779
  /** \brief User-mode CPU time spent on GC update. */
3736
3780
  uint32_t gc_cputime;
3737
3781
 
3738
- /** \brief Информация для профилирования работы GC.
3739
- * \note Статистика является общей для всех процессов работающих с одним
3740
- * файлом БД и хранится в LCK-файле. Данные аккумулируются при фиксации всех
3741
- * транзакций, но только в сборках libmdbx c установленной опцией
3742
- * \ref MDBX_ENABLE_PROFGC. Собранная статистика возвращаются любому процессу
3743
- * при использовании \ref mdbx_txn_commit_ex() и одновременно обнуляется
3744
- * при завершении транзакций верхнего уровня (не вложенных). */
3782
+ /** \brief Information for profiling GC performance.
3783
+ * \note Statistics is common for all processes working with one
3784
+ * database file and is stored in the LCK file. Data is accumulated when fixing all
3785
+ * transactions, but only in libmdbx builds with the option set
3786
+ * \ref MDBX_ENABLE_PROFGC. Collected statistics are returned to any process
3787
+ * when using \ref mdbx_txn_commit_ex() and reset to zero at the same time
3788
+ * when completing top-level transactions (not nested). */
3745
3789
  struct {
3746
- /** \brief Количество итераций обновления GC,
3747
- * больше 1 если были повторы/перезапуски. */
3790
+ /** \brief Number of GC update iterations,
3791
+ * more than 1 if there were repetitions/restarts. */
3748
3792
  uint32_t wloops;
3749
- /** \brief Количество итераций слияния записей GC. */
3793
+ /** \brief Number of iterations to merge GC records. */
3750
3794
  uint32_t coalescences;
3751
- /** \brief Количество уничтожений предыдущих надежных/устойчивых
3752
- * точек фиксации при работе в режиме \ref MDBX_UTTERLY_NOSYNC. */
3795
+ /** \brief Number of previous reliable/sustainable kills
3796
+ * fixation points when working in the mode \ref MDBX_UTTERLY_NOSYNC. */
3753
3797
  uint32_t wipes;
3754
- /** \brief Количество принудительных фиксаций на диск
3755
- * во избежания приращения БД при работе вне режима
3798
+ /** \brief Number of forced commits per disk
3799
+ * in order to avoid incrementing the database when working outside the mode
3756
3800
  * \ref MDBX_UTTERLY_NOSYNC. */
3757
3801
  uint32_t flushes;
3758
- /** \brief Количество обращений к механизму Handle-Slow-Readers
3759
- * во избежания приращения БД.
3802
+ /** \brief Number of calls to the mechanism Handle-Slow-Readers
3803
+ * to avoid database increment.
3760
3804
  * \see MDBX_hsr_func */
3761
3805
  uint32_t kicks;
3762
3806
 
3763
- /** \brief Счетчик выполнения по медленному пути (slow path execution count)
3764
- * GC ради данных пользователя. */
3807
+ /** \brief Slow path execution counter
3808
+ * GC for user data. */
3765
3809
  uint32_t work_counter;
3766
- /** \brief Время "по настенным часам" затраченное на чтение и поиск внутри
3767
- * GC ради данных пользователя. */
3810
+ /** \brief The "by wall clock" time spent reading and searching within
3811
+ * GC for user data. */
3768
3812
  uint32_t work_rtime_monotonic;
3769
- /** \brief Монотонное время по "настенным часам" затраченное
3770
- * на подготовку страниц извлекаемых из GC для данных пользователя,
3771
- * включая подкачку с диска. */
3772
- uint32_t work_xtime_monotonic;
3773
- /** \brief Время ЦПУ в режиме пользователе затраченное на чтение и поиск
3774
- * внтури GC ради данных пользователя. */
3775
- uint32_t work_rtime_cpu;
3776
- /** \brief Количество итераций поиска внутри GC при выделении страниц
3777
- * ради данных пользователя. */
3813
+ /** \brief CPU time in user mode spent
3814
+ * to prepare pages retrieved from GC for user data,
3815
+ * including paging from disk. */
3816
+ uint32_t work_xtime_cpu;
3817
+ /** \brief Number of search iterations within the GC when selecting pages
3818
+ * For the sake of user data. */
3778
3819
  uint32_t work_rsteps;
3779
- /** \brief Количество запросов на выделение последовательностей страниц
3780
- * ради данных пользователя. */
3820
+ /** \brief Number of queries to allocate page sequences
3821
+ * For the sake of user data. */
3781
3822
  uint32_t work_xpages;
3782
- /** \brief Количество страничных промахов (page faults) внутри GC
3783
- * при выделении и подготовки страниц для данных пользователя. */
3823
+ /** \brief Number of page faults within GC.
3824
+ * when selecting and preparing pages for user data. */
3784
3825
  uint32_t work_majflt;
3785
3826
 
3786
- /** \brief Счетчик выполнения по медленному пути (slow path execution count)
3787
- * GC для целей поддержки и обновления самой GC. */
3827
+ /** \brief Slow path execution count
3828
+ * GC for the purpose of maintaining and updating the GC itself. */
3788
3829
  uint32_t self_counter;
3789
- /** \brief Время "по настенным часам" затраченное на чтение и поиск внутри
3790
- * GC для целей поддержки и обновления самой GC. */
3830
+ /** \brief The "by wall clock" time spent reading and searching inside
3831
+ * GC for the purpose of maintaining and updating the GC itself. */
3791
3832
  uint32_t self_rtime_monotonic;
3792
- /** \brief Монотонное время по "настенным часам" затраченное на подготовку
3793
- * страниц извлекаемых из GC для целей поддержки и обновления самой GC,
3794
- * включая подкачку с диска. */
3795
- uint32_t self_xtime_monotonic;
3796
- /** \brief Время ЦПУ в режиме пользователе затраченное на чтение и поиск
3797
- * внтури GC для целей поддержки и обновления самой GC. */
3798
- uint32_t self_rtime_cpu;
3799
- /** \brief Количество итераций поиска внутри GC при выделении страниц
3800
- * для целей поддержки и обновления самой GC. */
3833
+ /** \brief CPU time in user mode spent on preparing
3834
+ * pages retrieved from GC for the purpose of maintaining and updating GC itself,
3835
+ * including paging from disk. */
3836
+ uint32_t self_xtime_cpu;
3837
+ /** \brief Number of search iterations within the GC when highlighting pages
3838
+ * for the purpose of maintaining and updating the GC itself. */
3801
3839
  uint32_t self_rsteps;
3802
- /** \brief Количество запросов на выделение последовательностей страниц
3803
- * для самой GC. */
3840
+ /** \brief Number of requests for page sequences allocation
3841
+ * for GC itself. */
3804
3842
  uint32_t self_xpages;
3805
- /** \brief Количество страничных промахов (page faults) внутри GC
3806
- * при выделении и подготовки страниц для самой GC. */
3843
+ /** \brief Number of page faults inside the GC.
3844
+ * when selecting and preparing pages for the GC itself. */
3807
3845
  uint32_t self_majflt;
3808
3846
  } gc_prof;
3809
3847
  };
@@ -4128,6 +4166,8 @@ typedef int(MDBX_cmp_func)(const MDBX_val *a,
4128
4166
  * by current thread. */
4129
4167
  LIBMDBX_API int mdbx_dbi_open(MDBX_txn *txn, const char *name,
4130
4168
  MDBX_db_flags_t flags, MDBX_dbi *dbi);
4169
+ LIBMDBX_API int mdbx_dbi_open2(MDBX_txn *txn, const MDBX_val *name,
4170
+ MDBX_db_flags_t flags, MDBX_dbi *dbi);
4131
4171
 
4132
4172
  /** \deprecated Please
4133
4173
  * \ref avoid_custom_comparators "avoid using custom comparators" and use
@@ -4147,6 +4187,9 @@ LIBMDBX_API int mdbx_dbi_open(MDBX_txn *txn, const char *name,
4147
4187
  MDBX_DEPRECATED LIBMDBX_API int
4148
4188
  mdbx_dbi_open_ex(MDBX_txn *txn, const char *name, MDBX_db_flags_t flags,
4149
4189
  MDBX_dbi *dbi, MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp);
4190
+ MDBX_DEPRECATED LIBMDBX_API int
4191
+ mdbx_dbi_open_ex2(MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags,
4192
+ MDBX_dbi *dbi, MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp);
4150
4193
 
4151
4194
  /** \defgroup value2key Value-to-Key functions
4152
4195
  * \brief Value-to-Key functions to
@@ -5444,18 +5487,20 @@ typedef enum MDBX_page_type_t MDBX_page_type_t;
5444
5487
  #endif
5445
5488
 
5446
5489
  /** \brief Pseudo-name for MainDB */
5447
- #define MDBX_PGWALK_MAIN ((const char *)((ptrdiff_t)0))
5490
+ #define MDBX_PGWALK_MAIN ((void *)((ptrdiff_t)0))
5448
5491
  /** \brief Pseudo-name for GarbageCollectorDB */
5449
- #define MDBX_PGWALK_GC ((const char *)((ptrdiff_t)-1))
5492
+ #define MDBX_PGWALK_GC ((void *)((ptrdiff_t)-1))
5450
5493
  /** \brief Pseudo-name for MetaPages */
5451
- #define MDBX_PGWALK_META ((const char *)((ptrdiff_t)-2))
5494
+ #define MDBX_PGWALK_META ((void *)((ptrdiff_t)-2))
5452
5495
 
5453
5496
  /** \brief Callback function for traverse the b-tree. \see mdbx_env_pgwalk() */
5454
- typedef int MDBX_pgvisitor_func(
5455
- const uint64_t pgno, const unsigned number, void *const ctx, const int deep,
5456
- const char *const dbi, const size_t page_size, const MDBX_page_type_t type,
5457
- const MDBX_error_t err, const size_t nentries, const size_t payload_bytes,
5458
- const size_t header_bytes, const size_t unused_bytes) MDBX_CXX17_NOEXCEPT;
5497
+ typedef int
5498
+ MDBX_pgvisitor_func(const uint64_t pgno, const unsigned number, void *const ctx,
5499
+ const int deep, const MDBX_val *dbi_name,
5500
+ const size_t page_size, const MDBX_page_type_t type,
5501
+ const MDBX_error_t err, const size_t nentries,
5502
+ const size_t payload_bytes, const size_t header_bytes,
5503
+ const size_t unused_bytes) MDBX_CXX17_NOEXCEPT;
5459
5504
 
5460
5505
  /** \brief B-tree traversal function. */
5461
5506
  LIBMDBX_API int mdbx_env_pgwalk(MDBX_txn *txn, MDBX_pgvisitor_func *visitor,
@@ -45,8 +45,7 @@ static char *msg_buf;
45
45
  static char *msg_bufp;
46
46
 
47
47
  /* Determine if the test should be run at all */
48
- static bool should_test_run(const char *testname)
49
- {
48
+ static bool should_test_run(const char *testname) {
50
49
  if (list_tests == true) {
51
50
  /* when listing tests, don't run any of them */
52
51
  return false;
@@ -60,16 +59,14 @@ static void reset_stats(void) {
60
59
  f_cnt = 0;
61
60
  }
62
61
 
63
- static void reset_status(void)
64
- {
62
+ static void reset_status(void) {
65
63
  curr_char = 0;
66
64
  }
67
65
 
68
66
  /* Basically this just deletes the previous character and replaces it with the
69
67
  * next character in the ticker array. If the tests run slowly enough it will
70
68
  * look like a spinning bar. */
71
- static void update_status(void)
72
- {
69
+ static void update_status(void) {
73
70
  if (!quiet) {
74
71
  curr_char = (curr_char + 1) % TST_STAT_SIZE;
75
72
  fprintf(stdout, "\b%c", status[curr_char]);
@@ -81,8 +78,7 @@ static void update_status(void)
81
78
  /*
82
79
  * Ends the test suite by writing SUCCESS or FAILED at the end of the test
83
80
  * results in the diagnostics. */
84
- static void end_suite(TestSuite *suite)
85
- {
81
+ static void end_suite(TestSuite *suite) {
86
82
  if (suite != NULL) {
87
83
  TestSubSuite *last = suite->tail;
88
84
  if (!quiet) {
@@ -92,8 +88,7 @@ static void end_suite(TestSuite *suite)
92
88
  if (last->failed == 0) {
93
89
  fprintf(stdout, " -> SUCCESS\n");
94
90
  fflush(stdout);
95
- }
96
- else {
91
+ } else {
97
92
  fprintf(stdout, " -> FAILED %d of %d\n", last->failed,
98
93
  last->num_test);
99
94
  fflush(stdout);
@@ -101,8 +96,7 @@ static void end_suite(TestSuite *suite)
101
96
  }
102
97
  }
103
98
 
104
- TestSuite *tst_add_suite(TestSuite *suite, const char *suite_name_full)
105
- {
99
+ TestSuite *tst_add_suite(TestSuite *suite, const char *suite_name_full) {
106
100
  TestSubSuite *subsuite;
107
101
  char *p;
108
102
  const char *suite_name;
@@ -127,8 +121,7 @@ TestSuite *tst_add_suite(TestSuite *suite, const char *suite_name_full)
127
121
  suite_name = strrchr(suite_name_full, '/');
128
122
  if (suite_name) {
129
123
  suite_name++;
130
- }
131
- else {
124
+ } else {
132
125
  suite_name = suite_name_full;
133
126
  }
134
127
  /* strip extension */
@@ -153,8 +146,7 @@ TestSuite *tst_add_suite(TestSuite *suite, const char *suite_name_full)
153
146
  suite = (TestSuite *)malloc(sizeof(*suite));
154
147
  suite->head = subsuite;
155
148
  suite->tail = subsuite;
156
- }
157
- else {
149
+ } else {
158
150
  /* Add the current suite to the tail of the suite linked list */
159
151
  suite->tail->next = subsuite;
160
152
  suite->tail = subsuite;
@@ -174,8 +166,7 @@ TestSuite *tst_add_suite(TestSuite *suite, const char *suite_name_full)
174
166
  return suite;
175
167
  }
176
168
 
177
- void tst_run_test_with_name(TestSuite *ts, test_func f, void *value, const char *func_name)
178
- {
169
+ void tst_run_test_with_name(TestSuite *ts, test_func f, void *value, const char *func_name) {
179
170
  TestCase tc;
180
171
  TestSubSuite *ss;
181
172
 
@@ -199,24 +190,20 @@ void tst_run_test_with_name(TestSuite *ts, test_func f, void *value, const char
199
190
  ss->failed++;
200
191
  if (quiet) {
201
192
  printf("F");
202
- }
203
- else {
193
+ } else {
204
194
  printf("\bF_");
205
195
  }
206
- }
207
- else {
196
+ } else {
208
197
  if (quiet) {
209
198
  printf(".");
210
- }
211
- else {
199
+ } else {
212
200
  printf("\b._");
213
201
  }
214
202
  }
215
203
  update_status();
216
204
  }
217
205
 
218
- static int report(TestSuite *suite)
219
- {
206
+ static int report(TestSuite *suite) {
220
207
  int count = 0;
221
208
  TestSubSuite *dptr;
222
209
 
@@ -260,8 +247,7 @@ static int report(TestSuite *suite)
260
247
  static const char *curr_err_func = "";
261
248
 
262
249
  #define MSG_BUF_HAVE MAX_MSG_SIZE - (msg_bufp - msg_buf) - 1
263
- static void vappend_to_msg_buf(const char *fmt, va_list args)
264
- {
250
+ static void vappend_to_msg_buf(const char *fmt, va_list args) {
265
251
  int v = vsnprintf(msg_bufp, MSG_BUF_HAVE, fmt, args);
266
252
  if (v < 0) {
267
253
  rb_raise(rb_eStandardError, "Error: can't write to test message buffer\n");
@@ -270,8 +256,7 @@ static void vappend_to_msg_buf(const char *fmt, va_list args)
270
256
  }
271
257
  }
272
258
 
273
- static void append_to_msg_buf(const char *fmt, ...)
274
- {
259
+ static void append_to_msg_buf(const char *fmt, ...) {
275
260
  va_list args;
276
261
 
277
262
  va_start(args, fmt);
@@ -279,15 +264,13 @@ static void append_to_msg_buf(const char *fmt, ...)
279
264
  va_end(args);
280
265
  }
281
266
 
282
- static void vTmsg_nf(const char *fmt, va_list args)
283
- {
267
+ static void vTmsg_nf(const char *fmt, va_list args) {
284
268
  if (verbose) {
285
269
  vappend_to_msg_buf(fmt, args);
286
270
  }
287
271
  }
288
272
 
289
- void vTmsg(const char *fmt, va_list args)
290
- {
273
+ void vTmsg(const char *fmt, va_list args) {
291
274
  if (verbose) {
292
275
  append_to_msg_buf("\t");
293
276
  vappend_to_msg_buf(fmt, args);
@@ -296,8 +279,7 @@ void vTmsg(const char *fmt, va_list args)
296
279
  }
297
280
  }
298
281
 
299
- void Tmsg(const char *fmt, ...)
300
- {
282
+ void Tmsg(const char *fmt, ...) {
301
283
  va_list args;
302
284
 
303
285
  va_start(args, fmt);
@@ -305,8 +287,7 @@ void Tmsg(const char *fmt, ...)
305
287
  va_end(args);
306
288
  }
307
289
 
308
- void Tmsg_nf(const char *fmt, ...)
309
- {
290
+ void Tmsg_nf(const char *fmt, ...) {
310
291
  va_list args;
311
292
 
312
293
  va_start(args, fmt);
@@ -314,8 +295,7 @@ void Tmsg_nf(const char *fmt, ...)
314
295
  va_end(args);
315
296
  }
316
297
 
317
- void tst_msg(const char *func, const char *fname, int line_num, const char *fmt, ...)
318
- {
298
+ void tst_msg(const char *func, const char *fname, int line_num, const char *fmt, ...) {
319
299
  int i;
320
300
  va_list args;
321
301
 
@@ -338,8 +318,7 @@ void tst_msg(const char *func, const char *fname, int line_num, const char *fmt,
338
318
  }
339
319
 
340
320
  bool tst_raise(int line_num, TestCase *tc, const int err_code,
341
- void (*func)(void *args), void *args)
342
- {
321
+ void (*func)(void *args), void *args) {
343
322
  volatile bool was_raised = false;
344
323
  a_cnt++;
345
324
  update_status();
@@ -353,8 +332,7 @@ bool tst_raise(int line_num, TestCase *tc, const int err_code,
353
332
  default:
354
333
  if (err_code == xcontext.excode) {
355
334
  was_raised = true;
356
- }
357
- else {
335
+ } else {
358
336
  tc->failed = true;
359
337
  tst_msg(tc->name, tc->suite->name, line_num,
360
338
  "exception %d raised unexpectedly with msg;\n\"\"\"\n%s\n\"\"\"\n",
@@ -371,16 +349,14 @@ bool tst_raise(int line_num, TestCase *tc, const int err_code,
371
349
  }
372
350
  if (tc->failed) {
373
351
  return false;
374
- }
375
- else {
352
+ } else {
376
353
  return true;
377
354
  }
378
355
  }
379
356
 
380
357
  #define I64_PFX POSH_I64_PRINTF_PREFIX
381
358
  bool tst_int_equal(int line_num, TestCase *tc, const frt_u64 expected,
382
- const frt_u64 actual)
383
- {
359
+ const frt_u64 actual) {
384
360
  a_cnt++;
385
361
  update_status();
386
362
  if (tc->failed && !force) {
@@ -399,8 +375,7 @@ bool tst_int_equal(int line_num, TestCase *tc, const frt_u64 expected,
399
375
  }
400
376
 
401
377
  bool tst_flt_delta_equal(int line_num, TestCase *tc, const double expected,
402
- const double actual, const double delta)
403
- {
378
+ const double actual, const double delta) {
404
379
  double diff;
405
380
  a_cnt++;
406
381
  update_status();
@@ -426,14 +401,12 @@ bool tst_flt_delta_equal(int line_num, TestCase *tc, const double expected,
426
401
  }
427
402
 
428
403
  bool tst_flt_equal(int line_num, TestCase *tc, const double expected,
429
- const double actual)
430
- {
404
+ const double actual) {
431
405
  return tst_flt_delta_equal(line_num, tc, expected, actual, 0.00001);
432
406
  }
433
407
 
434
408
  bool tst_str_equal(int line_num, TestCase *tc, const char *expected,
435
- const char *actual)
436
- {
409
+ const char *actual) {
437
410
  a_cnt++;
438
411
  update_status();
439
412
  if (tc->failed && !force) {
@@ -454,8 +427,7 @@ bool tst_str_equal(int line_num, TestCase *tc, const char *expected,
454
427
  }
455
428
 
456
429
  bool tst_strstr(int line_num, TestCase *tc, const char *haystack,
457
- const char *needle)
458
- {
430
+ const char *needle) {
459
431
  a_cnt++;
460
432
  update_status();
461
433
  if (tc->failed && !force) {
@@ -476,8 +448,7 @@ bool tst_strstr(int line_num, TestCase *tc, const char *haystack,
476
448
  }
477
449
 
478
450
  bool tst_arr_int_equal(int line_num, TestCase *tc, const int *expected,
479
- const int *actual, int size)
480
- {
451
+ const int *actual, int size) {
481
452
  a_cnt++;
482
453
  update_status();
483
454
  if (tc->failed && !force) {
@@ -503,8 +474,7 @@ bool tst_arr_int_equal(int line_num, TestCase *tc, const int *expected,
503
474
  }
504
475
 
505
476
  bool tst_arr_str_equal(int line_num, TestCase *tc, const char **expected,
506
- const char **actual, int size)
507
- {
477
+ const char **actual, int size) {
508
478
  a_cnt++;
509
479
  update_status();
510
480
  if (tc->failed && !force) {
@@ -530,8 +500,7 @@ bool tst_arr_str_equal(int line_num, TestCase *tc, const char **expected,
530
500
  }
531
501
 
532
502
  bool tst_str_nequal(int line_num, TestCase *tc, const char *expected,
533
- const char *actual, size_t n)
534
- {
503
+ const char *actual, size_t n) {
535
504
  char *buf1;
536
505
  char *buf2;
537
506
 
@@ -557,8 +526,7 @@ bool tst_str_nequal(int line_num, TestCase *tc, const char *expected,
557
526
  return false;
558
527
  }
559
528
 
560
- bool tst_ptr_null(int line_num, TestCase *tc, const void *ptr)
561
- {
529
+ bool tst_ptr_null(int line_num, TestCase *tc, const void *ptr) {
562
530
  a_cnt++;
563
531
  update_status();
564
532
  if (tc->failed && !force) {
@@ -574,8 +542,7 @@ bool tst_ptr_null(int line_num, TestCase *tc, const void *ptr)
574
542
  return false;
575
543
  }
576
544
 
577
- bool tst_ptr_notnull(int line_num, TestCase *tc, const void *ptr)
578
- {
545
+ bool tst_ptr_notnull(int line_num, TestCase *tc, const void *ptr) {
579
546
  a_cnt++;
580
547
  update_status();
581
548
  if (tc->failed && !force) {
@@ -592,8 +559,7 @@ bool tst_ptr_notnull(int line_num, TestCase *tc, const void *ptr)
592
559
  }
593
560
 
594
561
  bool tst_ptr_equal(int line_num, TestCase *tc, const void *expected,
595
- const void *actual)
596
- {
562
+ const void *actual) {
597
563
  a_cnt++;
598
564
  update_status();
599
565
  if (tc->failed && !force) {
@@ -610,8 +576,7 @@ bool tst_ptr_equal(int line_num, TestCase *tc, const void *expected,
610
576
  return false;
611
577
  }
612
578
 
613
- bool tst_fail(int line_num, TestCase *tc, const char *fmt, ...)
614
- {
579
+ bool tst_fail(int line_num, TestCase *tc, const char *fmt, ...) {
615
580
  va_list args;
616
581
  a_cnt++;
617
582
  update_status();
@@ -626,8 +591,7 @@ bool tst_fail(int line_num, TestCase *tc, const char *fmt, ...)
626
591
  return false;
627
592
  }
628
593
 
629
- bool tst_assert(int line_num, TestCase *tc, int condition, const char *fmt, ...)
630
- {
594
+ bool tst_assert(int line_num, TestCase *tc, int condition, const char *fmt, ...) {
631
595
  va_list args;
632
596
  a_cnt++;
633
597
  update_status();
@@ -647,8 +611,7 @@ bool tst_assert(int line_num, TestCase *tc, int condition, const char *fmt, ...)
647
611
  return false;
648
612
  }
649
613
 
650
- bool tst_true(int line_num, TestCase *tc, int condition)
651
- {
614
+ bool tst_true(int line_num, TestCase *tc, int condition) {
652
615
  a_cnt++;
653
616
  update_status();
654
617
  if (tc->failed && !force) {
@@ -666,8 +629,7 @@ bool tst_true(int line_num, TestCase *tc, int condition)
666
629
  return false;
667
630
  }
668
631
 
669
- bool tst_not_impl(int line_num, TestCase *tc, const char *message)
670
- {
632
+ bool tst_not_impl(int line_num, TestCase *tc, const char *message) {
671
633
  a_cnt++;
672
634
  update_status();
673
635
 
@@ -677,12 +639,10 @@ bool tst_not_impl(int line_num, TestCase *tc, const char *message)
677
639
  }
678
640
 
679
641
  #ifndef FRT_HAS_VARARGS
680
- bool Assert(int condition, const char *fmt, ...)
681
- {
642
+ bool Assert(int condition, const char *fmt, ...) {
682
643
  if (condition) {
683
644
  return true;
684
- }
685
- else {
645
+ } else {
686
646
  va_list args;
687
647
  Tmsg("\n ?)");
688
648
  Tmsg("Assertion failed");
@@ -756,12 +716,6 @@ static VALUE frb_ts_term_vectors(VALUE v) { return INT2FIX(execute_test(32)); }
756
716
  static VALUE frb_ts_test(VALUE v) { return INT2FIX(execute_test(33)); }
757
717
  static VALUE frb_ts_threading(VALUE v) { return INT2FIX(execute_test(34)); }
758
718
 
759
- static VALUE frb_ts_posh(VALUE v) {
760
- const char *posh = POSH_GetArchString();
761
- printf("\n%s\n", posh);
762
- return Qnil;
763
- }
764
-
765
719
  static VALUE frb_ts_run_all(VALUE v) {
766
720
  int i, test_count;
767
721
  int rv = 0;
@@ -832,6 +786,5 @@ void Init_Test(void) {
832
786
  rb_define_singleton_method(mTest, "term_vectors", frb_ts_term_vectors, 0);
833
787
  rb_define_singleton_method(mTest, "test", frb_ts_test, 0);
834
788
  rb_define_singleton_method(mTest, "threading", frb_ts_threading, 0);
835
- rb_define_singleton_method(mTest, "posh", frb_ts_posh, 0);
836
789
  rb_define_singleton_method(mTest, "run_all", frb_ts_run_all, 0);
837
790
  }