@based/db 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/dist/lib/darwin_aarch64/include/jemalloc.h +468 -0
  2. package/dist/lib/darwin_aarch64/include/selva/selva_string.h +2 -0
  3. package/dist/lib/darwin_aarch64/libdeflate.dylib +0 -0
  4. package/dist/lib/darwin_aarch64/libjemalloc_selva.2.dylib +0 -0
  5. package/dist/lib/darwin_aarch64/libnode-v20.11.1.node +0 -0
  6. package/dist/lib/darwin_aarch64/libnode-v22.13.1.node +0 -0
  7. package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
  8. package/dist/src/client/bitWise.d.ts +7 -0
  9. package/dist/src/client/bitWise.js +62 -0
  10. package/dist/src/client/bitWise.js.map +1 -0
  11. package/dist/src/client/crc32.js.map +1 -0
  12. package/dist/src/client/index.js.map +1 -0
  13. package/dist/src/client/modify/ModifyRes.js.map +1 -0
  14. package/dist/src/client/modify/alias.js.map +1 -0
  15. package/dist/src/client/modify/binary.js.map +1 -0
  16. package/dist/src/client/modify/create.js.map +1 -0
  17. package/dist/src/client/modify/fixed.js.map +1 -0
  18. package/dist/src/client/modify/hll.js.map +1 -0
  19. package/dist/src/client/modify/index.js.map +1 -0
  20. package/dist/src/client/modify/modify.js +5 -1
  21. package/dist/src/client/modify/modify.js.map +1 -0
  22. package/dist/src/client/modify/references/edge.js.map +1 -0
  23. package/dist/src/client/modify/references/reference.js.map +1 -0
  24. package/dist/src/client/modify/references/references.js.map +1 -0
  25. package/dist/src/client/modify/remove.js.map +1 -0
  26. package/dist/src/client/modify/setCursor.js.map +1 -0
  27. package/dist/src/client/modify/string.js.map +1 -0
  28. package/dist/src/client/modify/text.d.ts +4 -2
  29. package/dist/src/client/modify/text.js +1 -2
  30. package/dist/src/client/modify/text.js.map +1 -0
  31. package/dist/src/client/modify/types.js.map +1 -0
  32. package/dist/src/client/modify/update.js.map +1 -0
  33. package/dist/src/client/modify/upsert.js.map +1 -0
  34. package/dist/src/client/modify/vector.d.ts +4 -0
  35. package/dist/src/client/modify/vector.js +44 -0
  36. package/dist/src/client/modify/vector.js.map +1 -0
  37. package/dist/src/client/operations.js.map +1 -0
  38. package/dist/src/client/query/BasedDbQuery.d.ts +3 -1
  39. package/dist/src/client/query/BasedDbQuery.js +9 -7
  40. package/dist/src/client/query/BasedDbQuery.js.map +1 -0
  41. package/dist/src/client/query/BasedIterable.d.ts +2 -2
  42. package/dist/src/client/query/BasedIterable.js +10 -5
  43. package/dist/src/client/query/BasedIterable.js.map +1 -0
  44. package/dist/src/client/query/debug.js +4 -3
  45. package/dist/src/client/query/debug.js.map +1 -0
  46. package/dist/src/client/query/display.js +19 -4
  47. package/dist/src/client/query/display.js.map +1 -0
  48. package/dist/src/client/query/filter/FilterBranch.js.map +1 -0
  49. package/dist/src/client/query/filter/createFixedFilterBuffer.js.map +1 -0
  50. package/dist/src/client/query/filter/createReferenceFilter.js.map +1 -0
  51. package/dist/src/client/query/filter/createVariableFilterBuffer.d.ts +2 -1
  52. package/dist/src/client/query/filter/createVariableFilterBuffer.js +16 -7
  53. package/dist/src/client/query/filter/createVariableFilterBuffer.js.map +1 -0
  54. package/dist/src/client/query/filter/filter.js +17 -4
  55. package/dist/src/client/query/filter/filter.js.map +1 -0
  56. package/dist/src/client/query/filter/operators.js.map +1 -0
  57. package/dist/src/client/query/filter/parseFilterValue.js.map +1 -0
  58. package/dist/src/client/query/filter/primitiveFilter.d.ts +2 -1
  59. package/dist/src/client/query/filter/primitiveFilter.js +2 -2
  60. package/dist/src/client/query/filter/primitiveFilter.js.map +1 -0
  61. package/dist/src/client/query/filter/toBuffer.js.map +1 -0
  62. package/dist/src/client/query/filter/types.js.map +1 -0
  63. package/dist/src/client/query/include/props.js.map +1 -0
  64. package/dist/src/client/query/include/toBuffer.js.map +1 -0
  65. package/dist/src/client/query/include/utils.js +1 -0
  66. package/dist/src/client/query/include/utils.js.map +1 -0
  67. package/dist/src/client/query/include/walk.js +1 -0
  68. package/dist/src/client/query/include/walk.js.map +1 -0
  69. package/dist/src/client/query/query.js.map +1 -0
  70. package/dist/src/client/query/queryDef.js +2 -0
  71. package/dist/src/client/query/queryDef.js.map +1 -0
  72. package/dist/src/client/query/read/read.d.ts +2 -2
  73. package/dist/src/client/query/read/read.js +64 -38
  74. package/dist/src/client/query/read/read.js.map +1 -0
  75. package/dist/src/client/query/registerQuery.js.map +1 -0
  76. package/dist/src/client/query/search/index.js.map +1 -0
  77. package/dist/src/client/query/sort.js.map +1 -0
  78. package/dist/src/client/query/subscription/index.js +3 -3
  79. package/dist/src/client/query/subscription/index.js.map +1 -0
  80. package/dist/src/client/query/subscription/markers.js.map +1 -0
  81. package/dist/src/client/query/subscription/run.d.ts +1 -1
  82. package/dist/src/client/query/subscription/run.js +12 -2
  83. package/dist/src/client/query/subscription/run.js.map +1 -0
  84. package/dist/src/client/query/subscription/types.js.map +1 -0
  85. package/dist/src/client/query/thresholds.js.map +1 -0
  86. package/dist/src/client/query/toBuffer.js +3 -0
  87. package/dist/src/client/query/toBuffer.js.map +1 -0
  88. package/dist/src/client/query/types.d.ts +2 -0
  89. package/dist/src/client/query/types.js.map +1 -0
  90. package/dist/src/client/query/validation.js.map +1 -0
  91. package/dist/src/client/string.d.ts +3 -2
  92. package/dist/src/client/string.js +13 -7
  93. package/dist/src/client/string.js.map +1 -0
  94. package/dist/src/client/tree.js.map +1 -0
  95. package/dist/src/index.js.map +1 -0
  96. package/dist/src/native.d.ts +1 -1
  97. package/dist/src/native.js +2 -1
  98. package/dist/src/native.js.map +1 -0
  99. package/dist/src/server/csmt/draw-dot.js.map +1 -0
  100. package/dist/src/server/csmt/index.js.map +1 -0
  101. package/dist/src/server/csmt/match.js.map +1 -0
  102. package/dist/src/server/csmt/memebership-proof.js.map +1 -0
  103. package/dist/src/server/csmt/tree-utils.js.map +1 -0
  104. package/dist/src/server/csmt/tree.js.map +1 -0
  105. package/dist/src/server/csmt/types.js.map +1 -0
  106. package/dist/src/server/index.d.ts +1 -1
  107. package/dist/src/server/index.js +2 -1
  108. package/dist/src/server/index.js.map +1 -0
  109. package/dist/src/server/migrate/index.js.map +1 -0
  110. package/dist/src/server/migrate/worker.js.map +1 -0
  111. package/dist/src/server/save.js.map +1 -0
  112. package/dist/src/server/schema/schema.js.map +1 -0
  113. package/dist/src/server/schema/selvaBuffer.js +4 -3
  114. package/dist/src/server/schema/selvaBuffer.js.map +1 -0
  115. package/dist/src/server/schema/typeDef.js +4 -1
  116. package/dist/src/server/schema/typeDef.js.map +1 -0
  117. package/dist/src/server/schema/types.d.ts +3 -0
  118. package/dist/src/server/schema/types.js +5 -0
  119. package/dist/src/server/schema/types.js.map +1 -0
  120. package/dist/src/server/schema/utils.js.map +1 -0
  121. package/dist/src/server/start.js.map +1 -0
  122. package/dist/src/server/tree.js.map +1 -0
  123. package/dist/src/server/worker.js +1 -1
  124. package/dist/src/server/worker.js.map +1 -0
  125. package/dist/test/alias.d.ts +1 -0
  126. package/dist/test/alias.js +232 -0
  127. package/dist/test/alias.js.map +1 -0
  128. package/dist/test/binary.d.ts +1 -0
  129. package/dist/test/binary.js +45 -0
  130. package/dist/test/binary.js.map +1 -0
  131. package/dist/test/boolean.d.ts +1 -0
  132. package/dist/test/boolean.js +43 -0
  133. package/dist/test/boolean.js.map +1 -0
  134. package/dist/test/clientServer.d.ts +1 -0
  135. package/dist/test/clientServer.js +64 -0
  136. package/dist/test/clientServer.js.map +1 -0
  137. package/dist/test/concurrency.d.ts +1 -0
  138. package/dist/test/concurrency.js +61 -0
  139. package/dist/test/concurrency.js.map +1 -0
  140. package/dist/test/csmt.d.ts +1 -0
  141. package/dist/test/csmt.js +365 -0
  142. package/dist/test/csmt.js.map +1 -0
  143. package/dist/test/edges.d.ts +1 -0
  144. package/dist/test/edges.js +295 -0
  145. package/dist/test/edges.js.map +1 -0
  146. package/dist/test/edgesReference.d.ts +1 -0
  147. package/dist/test/edgesReference.js +179 -0
  148. package/dist/test/edgesReference.js.map +1 -0
  149. package/dist/test/edgesReferences.d.ts +1 -0
  150. package/dist/test/edgesReferences.js +472 -0
  151. package/dist/test/edgesReferences.js.map +1 -0
  152. package/dist/test/enum.d.ts +1 -0
  153. package/dist/test/enum.js +44 -0
  154. package/dist/test/enum.js.map +1 -0
  155. package/dist/test/filter.d.ts +1 -0
  156. package/dist/test/filter.js +512 -0
  157. package/dist/test/filter.js.map +1 -0
  158. package/dist/test/filterString.d.ts +1 -0
  159. package/dist/test/filterString.js +482 -0
  160. package/dist/test/filterString.js.map +1 -0
  161. package/dist/test/flush.d.ts +1 -0
  162. package/dist/test/flush.js +44 -0
  163. package/dist/test/flush.js.map +1 -0
  164. package/dist/test/hll.d.ts +1 -0
  165. package/dist/test/hll.js +32 -0
  166. package/dist/test/hll.js.map +1 -0
  167. package/dist/test/migration.d.ts +1 -0
  168. package/dist/test/migration.js +112 -0
  169. package/dist/test/migration.js.map +1 -0
  170. package/dist/test/number.d.ts +1 -0
  171. package/dist/test/number.js +172 -0
  172. package/dist/test/number.js.map +1 -0
  173. package/dist/test/range.d.ts +1 -0
  174. package/dist/test/range.js +70 -0
  175. package/dist/test/range.js.map +1 -0
  176. package/dist/test/references.d.ts +1 -0
  177. package/dist/test/references.js +350 -0
  178. package/dist/test/references.js.map +1 -0
  179. package/dist/test/referencesIndex.d.ts +1 -0
  180. package/dist/test/referencesIndex.js +151 -0
  181. package/dist/test/referencesIndex.js.map +1 -0
  182. package/dist/test/referencesModify.d.ts +1 -0
  183. package/dist/test/referencesModify.js +79 -0
  184. package/dist/test/referencesModify.js.map +1 -0
  185. package/dist/test/remove.d.ts +1 -0
  186. package/dist/test/remove.js +61 -0
  187. package/dist/test/remove.js.map +1 -0
  188. package/dist/test/rootProps.d.ts +1 -0
  189. package/dist/test/rootProps.js +53 -0
  190. package/dist/test/rootProps.js.map +1 -0
  191. package/dist/test/save.d.ts +1 -0
  192. package/dist/test/save.js +43 -0
  193. package/dist/test/save.js.map +1 -0
  194. package/dist/test/saveRange.d.ts +1 -0
  195. package/dist/test/saveRange.js +230 -0
  196. package/dist/test/saveRange.js.map +1 -0
  197. package/dist/test/search.d.ts +1 -0
  198. package/dist/test/search.js +322 -0
  199. package/dist/test/search.js.map +1 -0
  200. package/dist/test/shared/assert.d.ts +5 -0
  201. package/dist/test/shared/assert.js +75 -0
  202. package/dist/test/shared/assert.js.map +1 -0
  203. package/dist/test/shared/examples.d.ts +6 -0
  204. package/dist/test/shared/examples.js +1323 -0
  205. package/dist/test/shared/examples.js.map +1 -0
  206. package/dist/test/shared/playground.d.ts +1 -0
  207. package/dist/test/shared/playground.js +250 -0
  208. package/dist/test/shared/playground.js.map +1 -0
  209. package/dist/test/shared/test.d.ts +11 -0
  210. package/dist/test/shared/test.js +112 -0
  211. package/dist/test/shared/test.js.map +1 -0
  212. package/dist/test/shared/worker.d.ts +1 -0
  213. package/dist/test/shared/worker.js +127 -0
  214. package/dist/test/shared/worker.js.map +1 -0
  215. package/dist/test/simpleQuery.d.ts +1 -0
  216. package/dist/test/simpleQuery.js +43 -0
  217. package/dist/test/simpleQuery.js.map +1 -0
  218. package/dist/test/singleRef.d.ts +1 -0
  219. package/dist/test/singleRef.js +572 -0
  220. package/dist/test/singleRef.js.map +1 -0
  221. package/dist/test/singleRefQuery.d.ts +1 -0
  222. package/dist/test/singleRefQuery.js +136 -0
  223. package/dist/test/singleRefQuery.js.map +1 -0
  224. package/dist/test/sort.d.ts +1 -0
  225. package/dist/test/sort.js +401 -0
  226. package/dist/test/sort.js.map +1 -0
  227. package/dist/test/sortIds.d.ts +1 -0
  228. package/dist/test/sortIds.js +104 -0
  229. package/dist/test/sortIds.js.map +1 -0
  230. package/dist/test/sortNumber.d.ts +1 -0
  231. package/dist/test/sortNumber.js +76 -0
  232. package/dist/test/sortNumber.js.map +1 -0
  233. package/dist/test/sortString.d.ts +1 -0
  234. package/dist/test/sortString.js +118 -0
  235. package/dist/test/sortString.js.map +1 -0
  236. package/dist/test/string.d.ts +1 -0
  237. package/dist/test/string.js +310 -0
  238. package/dist/test/string.js.map +1 -0
  239. package/dist/test/subscription.d.ts +1 -0
  240. package/dist/test/subscription.js +336 -0
  241. package/dist/test/subscription.js.map +1 -0
  242. package/dist/test/text.d.ts +1 -0
  243. package/dist/test/text.js +87 -0
  244. package/dist/test/text.js.map +1 -0
  245. package/dist/test/timestamp.d.ts +1 -0
  246. package/dist/test/timestamp.js +50 -0
  247. package/dist/test/timestamp.js.map +1 -0
  248. package/dist/test/update.d.ts +1 -0
  249. package/dist/test/update.js +223 -0
  250. package/dist/test/update.js.map +1 -0
  251. package/dist/test/validation.d.ts +1 -0
  252. package/dist/test/validation.js +90 -0
  253. package/dist/test/validation.js.map +1 -0
  254. package/dist/test/vector.d.ts +1 -0
  255. package/dist/test/vector.js +47 -0
  256. package/dist/test/vector.js.map +1 -0
  257. package/package.json +4 -4
  258. package/dist/lib/darwin_aarch64/libnode-v20.18.1.node +0 -0
  259. package/dist/lib/darwin_aarch64/libnode-v22.13.0.node +0 -0
  260. package/dist/lib/darwin_aarch64/libnode-v22.8.0.node +0 -0
  261. package/dist/lib/linux_aarch64/include/cdefs.h +0 -317
  262. package/dist/lib/linux_aarch64/include/libdeflate.h +0 -322
  263. package/dist/lib/linux_aarch64/include/libdeflate_strings.h +0 -35
  264. package/dist/lib/linux_aarch64/include/linker_set.h +0 -109
  265. package/dist/lib/linux_aarch64/include/queue.h +0 -627
  266. package/dist/lib/linux_aarch64/include/selva/_export.h +0 -7
  267. package/dist/lib/linux_aarch64/include/selva/align.h +0 -9
  268. package/dist/lib/linux_aarch64/include/selva/backoff_timeout.h +0 -29
  269. package/dist/lib/linux_aarch64/include/selva/base64.h +0 -59
  270. package/dist/lib/linux_aarch64/include/selva/base64url.h +0 -59
  271. package/dist/lib/linux_aarch64/include/selva/bitmap.h +0 -95
  272. package/dist/lib/linux_aarch64/include/selva/crc32c.h +0 -17
  273. package/dist/lib/linux_aarch64/include/selva/ctime.h +0 -135
  274. package/dist/lib/linux_aarch64/include/selva/db.h +0 -284
  275. package/dist/lib/linux_aarch64/include/selva/endian.h +0 -301
  276. package/dist/lib/linux_aarch64/include/selva/fast_linear_search.h +0 -23
  277. package/dist/lib/linux_aarch64/include/selva/fast_memmem.h +0 -11
  278. package/dist/lib/linux_aarch64/include/selva/fast_parsei.h +0 -36
  279. package/dist/lib/linux_aarch64/include/selva/fields.h +0 -338
  280. package/dist/lib/linux_aarch64/include/selva/find.h +0 -47
  281. package/dist/lib/linux_aarch64/include/selva/lpf.h +0 -28
  282. package/dist/lib/linux_aarch64/include/selva/node_id_set.h +0 -43
  283. package/dist/lib/linux_aarch64/include/selva/poptop.h +0 -114
  284. package/dist/lib/linux_aarch64/include/selva/queue_r.h +0 -190
  285. package/dist/lib/linux_aarch64/include/selva/selva_hash128.h +0 -39
  286. package/dist/lib/linux_aarch64/include/selva/selva_lang.h +0 -105
  287. package/dist/lib/linux_aarch64/include/selva/selva_math.h +0 -37
  288. package/dist/lib/linux_aarch64/include/selva/selva_string.h +0 -672
  289. package/dist/lib/linux_aarch64/include/selva/sort.h +0 -119
  290. package/dist/lib/linux_aarch64/include/selva/strsearch.h +0 -43
  291. package/dist/lib/linux_aarch64/include/selva/timestamp.h +0 -25
  292. package/dist/lib/linux_aarch64/include/selva/traverse.h +0 -65
  293. package/dist/lib/linux_aarch64/include/selva/types.h +0 -110
  294. package/dist/lib/linux_aarch64/include/selva/vector.h +0 -14
  295. package/dist/lib/linux_aarch64/include/selva/worker_ctx.h +0 -13
  296. package/dist/lib/linux_aarch64/include/selva_error.h +0 -137
  297. package/dist/lib/linux_aarch64/include/selva_lang_code.h +0 -157
  298. package/dist/lib/linux_aarch64/include/tree.h +0 -852
  299. package/dist/lib/linux_aarch64/libdeflate.so +0 -0
  300. package/dist/lib/linux_aarch64/libjemalloc_selva.so.2 +0 -0
  301. package/dist/lib/linux_aarch64/libnode-v20.11.1.node +0 -0
  302. package/dist/lib/linux_aarch64/libnode-v20.18.1.node +0 -0
  303. package/dist/lib/linux_aarch64/libnode-v22.13.0.node +0 -0
  304. package/dist/lib/linux_aarch64/libselva.so +0 -0
  305. package/dist/lib/linux_aarch64/libxxhash.so +0 -0
  306. package/dist/lib/linux_aarch64/libxxhash.so.0 +0 -0
  307. package/dist/lib/linux_aarch64/libxxhash.so.0.8.2 +0 -0
  308. package/dist/lib/linux_x86_64/include/cdefs.h +0 -317
  309. package/dist/lib/linux_x86_64/include/libdeflate.h +0 -322
  310. package/dist/lib/linux_x86_64/include/libdeflate_strings.h +0 -35
  311. package/dist/lib/linux_x86_64/include/linker_set.h +0 -109
  312. package/dist/lib/linux_x86_64/include/queue.h +0 -627
  313. package/dist/lib/linux_x86_64/include/selva/_export.h +0 -7
  314. package/dist/lib/linux_x86_64/include/selva/align.h +0 -9
  315. package/dist/lib/linux_x86_64/include/selva/backoff_timeout.h +0 -29
  316. package/dist/lib/linux_x86_64/include/selva/base64.h +0 -59
  317. package/dist/lib/linux_x86_64/include/selva/base64url.h +0 -59
  318. package/dist/lib/linux_x86_64/include/selva/bitmap.h +0 -95
  319. package/dist/lib/linux_x86_64/include/selva/crc32c.h +0 -17
  320. package/dist/lib/linux_x86_64/include/selva/ctime.h +0 -135
  321. package/dist/lib/linux_x86_64/include/selva/db.h +0 -284
  322. package/dist/lib/linux_x86_64/include/selva/endian.h +0 -301
  323. package/dist/lib/linux_x86_64/include/selva/fast_linear_search.h +0 -23
  324. package/dist/lib/linux_x86_64/include/selva/fast_memmem.h +0 -11
  325. package/dist/lib/linux_x86_64/include/selva/fast_parsei.h +0 -36
  326. package/dist/lib/linux_x86_64/include/selva/fields.h +0 -338
  327. package/dist/lib/linux_x86_64/include/selva/find.h +0 -47
  328. package/dist/lib/linux_x86_64/include/selva/lpf.h +0 -28
  329. package/dist/lib/linux_x86_64/include/selva/node_id_set.h +0 -43
  330. package/dist/lib/linux_x86_64/include/selva/poptop.h +0 -114
  331. package/dist/lib/linux_x86_64/include/selva/queue_r.h +0 -190
  332. package/dist/lib/linux_x86_64/include/selva/selva_hash128.h +0 -39
  333. package/dist/lib/linux_x86_64/include/selva/selva_lang.h +0 -105
  334. package/dist/lib/linux_x86_64/include/selva/selva_math.h +0 -37
  335. package/dist/lib/linux_x86_64/include/selva/selva_string.h +0 -672
  336. package/dist/lib/linux_x86_64/include/selva/sort.h +0 -119
  337. package/dist/lib/linux_x86_64/include/selva/strsearch.h +0 -43
  338. package/dist/lib/linux_x86_64/include/selva/timestamp.h +0 -25
  339. package/dist/lib/linux_x86_64/include/selva/traverse.h +0 -65
  340. package/dist/lib/linux_x86_64/include/selva/types.h +0 -110
  341. package/dist/lib/linux_x86_64/include/selva/vector.h +0 -14
  342. package/dist/lib/linux_x86_64/include/selva/worker_ctx.h +0 -13
  343. package/dist/lib/linux_x86_64/include/selva_error.h +0 -137
  344. package/dist/lib/linux_x86_64/include/selva_lang_code.h +0 -157
  345. package/dist/lib/linux_x86_64/include/tree.h +0 -852
  346. package/dist/lib/linux_x86_64/libdeflate.so +0 -0
  347. package/dist/lib/linux_x86_64/libjemalloc_selva.so.2 +0 -0
  348. package/dist/lib/linux_x86_64/libnode-v20.11.1.node +0 -0
  349. package/dist/lib/linux_x86_64/libnode-v20.18.1.node +0 -0
  350. package/dist/lib/linux_x86_64/libnode-v22.13.0.node +0 -0
  351. package/dist/lib/linux_x86_64/libselva.so +0 -0
  352. package/dist/lib/linux_x86_64/libxxhash.so +0 -0
  353. package/dist/lib/linux_x86_64/libxxhash.so.0 +0 -0
  354. package/dist/lib/linux_x86_64/libxxhash.so.0.8.2 +0 -0
@@ -1,47 +0,0 @@
1
- /*
2
- * Copyright (c) 2024 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
-
7
- #include "selva/_export.h"
8
- #include "selva/types.h"
9
- #include "selva/traverse.h"
10
-
11
- struct SelvaFindParam {
12
- SelvaTraversalNodeCallback node_cb;
13
- void *node_arg;
14
-
15
- /**
16
- * Traverse field selector.
17
- */
18
- const struct FindFields {
19
- uint8_t len;
20
- struct {
21
- node_type_t type;
22
- field_t field;
23
- } __packed data[];
24
- } __packed *fields;
25
-
26
- /**
27
- * Skip the first n nodes in the traversal.
28
- * This happens before filtering.
29
- */
30
- ssize_t skip;
31
-
32
- /**
33
- * Skip the first n - 1 results.
34
- * This skipping is executed on the final result set.
35
- * 0 for no offset.
36
- */
37
- ssize_t offset;
38
-
39
- /**
40
- * Limit the number of results.
41
- * -1 for no limit (inf).
42
- */
43
- ssize_t limit;
44
- };
45
-
46
- SELVA_EXPORT
47
- int selva_find(struct SelvaDb *db, struct SelvaNode *node, const struct SelvaFindParam *param);
@@ -1,28 +0,0 @@
1
- /*
2
- * Copyright (c) 2021-2022 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
- #ifndef _UTIL_LPF_H_
7
- #define _UTIL_LPF_H_
8
-
9
- /**
10
- * Calculate the alpha coefficient for the lpf.
11
- */
12
- __constfn static inline float lpf_geta(float period, float sample_interval);
13
- static inline float lpf_geta(float period, float sample_interval) {
14
- return __builtin_expf(-(sample_interval / period));
15
- }
16
-
17
- /**
18
- * Calculate the next output value of the lpf.
19
- * @param prev is the previous output of this function.
20
- * @param a is the coefficient calculated by lpf_geta().
21
- * @param sample is the current sample.
22
- */
23
- __constfn static inline float lpf_calc_next(float a, float prev, float sample);
24
- static inline float lpf_calc_next(float a, float prev, float sample) {
25
- return a * prev + (1.0f - a) * sample;
26
- }
27
-
28
- #endif /* _UTIL_LPF_H_ */
@@ -1,43 +0,0 @@
1
- /*
2
- * Copyright (c) 2024 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
-
7
- #include <stddef.h>
8
- #include <sys/types.h>
9
- #include "selva/types.h"
10
-
11
- /*
12
- * node_id set is an array that is always sorted for fast lookups.
13
- */
14
-
15
- /**
16
- * Search from a node_id set.
17
- */
18
- SELVA_EXPORT
19
- ssize_t node_id_set_bsearch(const node_id_t *a, size_t n, node_id_t x)
20
- __attribute__((access(read_only, 1, 2)));
21
-
22
- static inline bool node_id_set_has(const node_id_t *set, size_t len, node_id_t id)
23
- {
24
- if (len == 0) {
25
- return false;
26
- }
27
-
28
- return node_id_set_bsearch(set, len, id) >= 0;
29
- }
30
-
31
- /**
32
- * Sorted insert to a node_id set.
33
- * @param set_p is an array allocated with jemalloc_selva.
34
- */
35
- SELVA_EXPORT
36
- bool node_id_set_add(node_id_t **set_p, size_t *len, node_id_t id);
37
-
38
- /**
39
- * Remove from a node_id set.
40
- * @param set_p is an array allocated with jemalloc_selva.
41
- */
42
- SELVA_EXPORT
43
- bool node_id_set_remove(node_id_t **set_p, size_t *len, node_id_t id);
@@ -1,114 +0,0 @@
1
- /*
2
- * Copyright (c) 2021-2022, 2025 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
-
7
- #include "selva/_export.h"
8
-
9
- /**
10
- * An element in the poptop list.
11
- */
12
- struct poptop_list_el {
13
- float score;
14
- void *p;
15
- };
16
-
17
- /**
18
- * A poptop structure.
19
- * Poptop is a data structure that attempts to keep a list of the most popular
20
- * entries based on a score seen on each insert. The list is kept at least
21
- * half-full at all times.
22
- *
23
- * The data structure has a maximum size of `max_size` and a cutoff limit that's
24
- * the median of the score of elements currently on the list. A new cutoff is
25
- * calculated when `poptop_maintenance()` is called and each call to
26
- * `poptop_maintenance_drop()` removes one element falling under the cutoff
27
- * limit until every element of the list has no more elements with score under
28
- * the cutoff limit.
29
- *
30
- * The list can be iterated using the `POPTOP_FOREACH()` macro.
31
- *
32
- * The list is not guaranteed to be ordered, in fact, it's typically unordered
33
- * unless `poptop_maintenance()` was called and no new inserts have been made
34
- * since that call.
35
- */
36
- struct poptop {
37
- /**
38
- * Maximum size of the top list.
39
- */
40
- unsigned int max_size;
41
- /**
42
- * Current number of elements on the top list.
43
- */
44
- unsigned int current_size;
45
- /**
46
- * Minimum score.
47
- * A long term minimum score for an element to get into and remain in the
48
- * data structure. This is updated when poptop_maintenance() is called.
49
- */
50
- float cut_limit;
51
- struct poptop_list_el *list;
52
- };
53
-
54
- /**
55
- * An iterator for `struct poptop`.
56
- * Note that the elements in the poptop list are not returned in any
57
- * particular order.
58
- * @param[out] _el_ is a pointer to a `poptop_list_el` structure. Can be NULL.
59
- * @param _l_ is a pointer to the poptop instance to be iterated over.
60
- */
61
- #define POPTOP_FOREACH(_el_, _l_) \
62
- _el_ = (_l_)->list - 1; \
63
- while (++_el_ != ((_l_)->list + (_l_)->max_size))
64
-
65
- /**
66
- * Initialize a poptop structure.
67
- * @param l is a pointer to an uninitalized poptop structure.
68
- * @param max_size is the maximum number of elements allowed in the data
69
- * structure. Poptop will attempt to maintain a list of about half of the
70
- * maximum size.
71
- * @param initial_cut is an initial value for the cut limit.
72
- * @returns 0 if succeed; Otherwise a non-zero value is returned.
73
- */
74
- SELVA_EXPORT
75
- int poptop_init(struct poptop *l, unsigned int max_size, float initial_cut);
76
-
77
- /**
78
- * Deinit a poptop structure.
79
- * @param l is a pointer to an initialized poptop structure.
80
- */
81
- SELVA_EXPORT
82
- void poptop_deinit(struct poptop *l);
83
-
84
- /**
85
- * Add an element to the top list if it's above the self-determined score limit.
86
- * If the element already exists the score is updated.
87
- * @param l is a pointer to the poptop structure.
88
- */
89
- SELVA_EXPORT
90
- void poptop_maybe_add(struct poptop * restrict l, float score, void * restrict p);
91
-
92
- /**
93
- * Remove an element from the top list.
94
- * @param l is a pointer to the poptop structure.
95
- */
96
- SELVA_EXPORT
97
- void poptop_remove(struct poptop * restrict l, const void * restrict p);
98
-
99
- /**
100
- * Periodic maintenance.
101
- * Find the median score and establish a new cut limit.
102
- * @param l is a pointer to the poptop structure.
103
- */
104
- SELVA_EXPORT
105
- int poptop_maintenance(struct poptop *l);
106
-
107
- /**
108
- * Drop an element that has a score below the cut limit.
109
- * This function should be called repeatedly until no entry is returned.
110
- * @param l is a pointer to the poptop structure.
111
- * @returns a pointer to the element that was removed from the data structure l.
112
- */
113
- SELVA_EXPORT
114
- void *poptop_maintenance_drop(struct poptop *l);
@@ -1,190 +0,0 @@
1
- /**
2
- *******************************************************************************
3
- * @file queue_r.h
4
- * @author Olli Vanhoja
5
- * @brief Thread-safe queue
6
- * @section LICENSE
7
- * Copyright (c) 2020-2021, 2023, 2025 SAULX
8
- * Copyright (c) 2013, 2015, 2016 Olli Vanhoja <olli.vanhoja@cs.helsinki.fi>
9
- * Copyright (c) 2012, 2013 Ninjaware Oy,
10
- * Olli Vanhoja <olli.vanhoja@ninjaware.fi>
11
- * All rights reserved.
12
- *
13
- * Redistribution and use in source and binary forms, with or without
14
- * modification, are permitted provided that the following conditions are met:
15
- *
16
- * 1. Redistributions of source code must retain the above copyright notice,
17
- * this list of conditions and the following disclaimer.
18
- * 2. Redistributions in binary form must reproduce the above copyright notice,
19
- * this list of conditions and the following disclaimer in the documentation
20
- * and/or other materials provided with the distribution.
21
- *
22
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
- * POSSIBILITY OF SUCH DAMAGE.
33
- *
34
- * SPDX-License-Identifier: BSD-2-Clause
35
- *******************************************************************************
36
- */
37
-
38
- /**
39
- * @addtogroup queue_r
40
- * @{
41
- */
42
-
43
- #pragma once
44
-
45
- #include <stddef.h>
46
- #include "selva/_export.h"
47
-
48
- /**
49
- * Queue control block.
50
- */
51
- typedef struct queue_cb {
52
- void * data; /*!< Pointer to the data array used for queue. */
53
- size_t b_size; /*!< Block size in bytes. */
54
- size_t a_len; /*!< Array length. */
55
- size_t m_write; /*!< Write index. */
56
- size_t m_read; /*!< Read index. */
57
- } queue_cb_t;
58
-
59
- #define QUEUE_INITIALIZER(data_array, block_size, array_size) \
60
- (struct queue_cb){ \
61
- .data = (data_array), \
62
- .b_size = (block_size), \
63
- .a_len = (array_size / block_size), \
64
- .m_write = 0, \
65
- .m_read = 0, \
66
- }
67
-
68
- /**
69
- * Create a new queue control block.
70
- * Initializes a new queue control block and returns it as a value.
71
- * @param data_array an array where the actual queue data is stored.
72
- * @param block_size the size of single data block/struct/data type in
73
- * data_array in bytes.
74
- * @param array_size the size of the data_array in bytes.
75
- * @return a new queue_cb_t queue control block structure.
76
- */
77
- SELVA_EXPORT
78
- queue_cb_t queue_create(void * data_array, size_t block_size,
79
- size_t array_size)
80
- __attribute__((pure, access(read_only, 1, 3)));
81
-
82
- /**
83
- * Push an element to the queue.
84
- * @param cb is a pointer to the queue control block.
85
- * @param element the new element to be copied.
86
- * @return 0 if queue is already full; otherwise operation was succeed.
87
- * @note element is always copied to the queue, so it is safe to remove the
88
- * original data after a push.
89
- */
90
- SELVA_EXPORT
91
- int queue_push(queue_cb_t * cb, const void * element)
92
- __attribute__((access(read_write, 1)));
93
-
94
- /**
95
- * Allocate an element from the queue.
96
- * @param cb is a pointer to the queue control block.
97
- * @return A pointer to the element in the queue.
98
- */
99
- SELVA_EXPORT
100
- void * queue_alloc_get(queue_cb_t * cb)
101
- __attribute__((access(read_write, 1)));
102
-
103
- /**
104
- * Commit previous allocation from the queue.
105
- * @note queue_push() should not be called between calls to queue_alloc_get()
106
- * and queue_alloc_commit().
107
- */
108
- SELVA_EXPORT
109
- void queue_alloc_commit(queue_cb_t * cb)
110
- __attribute__((access(read_write, 1)));
111
-
112
- /**
113
- * Pop an element from the queue.
114
- * @param cb is a pointer to the queue control block.
115
- * @param element is the location where element is copied to from the queue.
116
- * @return 0 if queue is empty; otherwise operation was succeed.
117
- */
118
- SELVA_EXPORT
119
- int queue_pop(queue_cb_t * cb, void * element)
120
- __attribute__((access(read_write, 1)));
121
-
122
- /**
123
- * Peek an element from the queue.
124
- * @param cb is a pointer to the queue control block.
125
- * @param element is the location where element is copied to from the queue.
126
- * @return 0 if queue is empty; otherwise operation was succeed.
127
- */
128
- SELVA_EXPORT
129
- int queue_peek(queue_cb_t * cb, void ** element)
130
- __attribute__((access(read_only, 1), access(write_only, 2)));
131
-
132
- /**
133
- * Skip n number of elements in the queue.
134
- * @param cb is a pointer to the queue control block.
135
- * @return Returns the number of elements skipped.
136
- */
137
- SELVA_EXPORT
138
- int queue_skip(queue_cb_t * cb, size_t n)
139
- __attribute__((access(read_write, 1)));
140
-
141
- /**
142
- * Clear the queue.
143
- * This operation is considered safe when committed from the push end thread.
144
- * @param cb is a pointer to the queue control block.
145
- */
146
- SELVA_EXPORT
147
- void queue_clear_from_push_end(queue_cb_t * cb)
148
- __attribute__((access(read_write, 1)));
149
-
150
- /**
151
- * Clear the queue.
152
- * This operation is considered safe when committed from the pop end thread.
153
- * @param cb is a pointer to the queue control block.
154
- */
155
- SELVA_EXPORT
156
- void queue_clear_from_pop_end(queue_cb_t * cb)
157
- __attribute__((access(read_write, 1)));
158
-
159
- /**
160
- * Check if the queue is empty.
161
- * @param cb is a pointer to the queue control block.
162
- * @return 0 if the queue is not empty.
163
- */
164
- SELVA_EXPORT
165
- int queue_isempty(const queue_cb_t * cb)
166
- __attribute__((access(read_only, 1)));
167
-
168
- /**
169
- * Check if the queue is full.
170
- * @param cb is a pointer to the queue control block.
171
- * @return 0 if the queue is not full.
172
- */
173
- SELVA_EXPORT
174
- int queue_isfull(const queue_cb_t * cb)
175
- __attribute__((access(read_only, 1)));
176
-
177
- /**
178
- * Seek queue.
179
- * @param cb is a pointer to the queue control block.
180
- * @param i index.
181
- * @param[in] element returned element.
182
- * @return 0 if failed; otherwise succeed.
183
- */
184
- SELVA_EXPORT
185
- int seek(const queue_cb_t * cb, size_t i, void * element)
186
- __attribute__((access(read_only, 1), access(write_only, 3)));
187
-
188
- /**
189
- * @}
190
- */
@@ -1,39 +0,0 @@
1
- /*
2
- * Copyright (c) 2024 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
- #include "xxhash.h"
7
- #include "selva/types.h"
8
-
9
- typedef struct XXH3_state_s selva_hash_state_t;
10
-
11
- #define selva_hash_create_state XXH3_createState
12
- #define selva_hash_reset XXH3_128bits_reset
13
- #define selva_hash_free_state XXH3_freeState
14
- #define selva_hash_update XXH3_128bits_update
15
-
16
- SELVA_EXPORT
17
- selva_hash128_t selva_hash_digest_zig(selva_hash_state_t *hash_state);
18
-
19
- #ifdef __zig
20
- #define selva_hash_digest selva_hash_digest_zig
21
- #else
22
- static inline selva_hash128_t selva_hash_digest(selva_hash_state_t *hash_state)
23
- {
24
- XXH128_hash_t res;
25
-
26
- retry:
27
- res = XXH3_128bits_digest(hash_state);
28
- if (res.low64 == 0 && res.high64 == 0) {
29
- /*
30
- * We don't allow zero hash.
31
- * RFE Is this a good approach?
32
- */
33
- XXH3_128bits_update(hash_state, &(int64_t){ 1 }, sizeof(int64_t));
34
- goto retry;
35
- }
36
-
37
- return (selva_hash128_t)res.low64 | (selva_hash128_t)res.high64 << 64;
38
- }
39
- #endif
@@ -1,105 +0,0 @@
1
- /*
2
- * Copyright (c) 2022, 2024-2025 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
-
7
- #if defined(__APPLE__) && __MACH__
8
- #include <xlocale.h>
9
- #endif
10
- #include <locale.h>
11
- #include <wchar.h>
12
- #include <wctype.h>
13
- #include "selva/_export.h"
14
- #include "selva_lang_code.h"
15
-
16
- #define SELVA_LANG_NAME_MAX 4ul
17
-
18
- struct libdeflate_decompressor;
19
- struct libdeflate_block_state;
20
-
21
- int selva_lang_set_fallback(const char *lang_str, size_t lang_len);
22
-
23
- /**
24
- * Get locale for a lang string.
25
- * @param lang_str is a pointer to the language name.
26
- * @param lang_len is the length of lang_str excluding any possible nul-character(s).
27
- * @returns a POSIX locale.
28
- */
29
- SELVA_EXPORT
30
- locale_t selva_lang_getlocale(const char *lang_str, size_t lang_len);
31
-
32
- SELVA_EXPORT
33
- locale_t selva_lang_getlocale2(enum selva_lang_code lang);
34
-
35
- /* TODO rename these */
36
- enum selva_langs_trans {
37
- SELVA_LANGS_TRANS_NONE = 0,
38
- SELVA_LANGS_TRANS_TOUPPER,
39
- SELVA_LANGS_TRANS_TOLOWER,
40
- SELVA_LANGS_TRANS_TOJHIRA, /*!< When lang is selva_lang_ja. */
41
- SELVA_LANGS_TRANS_TOJKATA, /*!< When lang is selva_lang_ja. */
42
- };
43
-
44
- SELVA_EXPORT
45
- wctrans_t selva_lang_wctrans(enum selva_lang_code lang, enum selva_langs_trans trans);
46
-
47
- /**
48
- * Transform a multibyte string.
49
- * @returns a selva_malloc'd c-string.
50
- */
51
- SELVA_EXPORT
52
- char *selva_mbstrans(locale_t loc, const char *src, size_t len, wctrans_t trans);
53
-
54
- /**
55
- * Read a symbol from a multibyte string.
56
- * @param wc symbol read from mbs_str.
57
- * @returns bytes consumed from mbs_str.
58
- */
59
- SELVA_EXPORT
60
- size_t selva_mbstowc(wchar_t *wc, const char *mbs_str, size_t mbs_len, mbstate_t *ps, wctrans_t trans, locale_t loc);
61
-
62
- /**
63
- * Compare two multibyte strings by transforming each character.
64
- * Unicode normalization and flattening is not supported.
65
- */
66
- SELVA_EXPORT
67
- int selva_mbscmp(const char *mbs1_str, size_t mbs1_len, const char *mbs2_str, size_t mbs2_len, wctrans_t trans, locale_t loc);
68
-
69
- SELVA_EXPORT
70
- int selva_deflate_mbscmp(
71
- struct libdeflate_decompressor *decompressor,
72
- struct libdeflate_block_state *state,
73
- const char *in_buf, size_t in_len,
74
- const char *mbs2_str, size_t mbs2_len,
75
- wctrans_t trans, locale_t loc);
76
-
77
- SELVA_EXPORT
78
- const char *selva_mbsstrstr(const char *mbs1_str, size_t mbs1_len, const char *mbs2_str, size_t mbs2_len, wctrans_t trans, locale_t loc);
79
-
80
- SELVA_EXPORT
81
- bool selva_deflate_mbsstrstr(
82
- struct libdeflate_decompressor *decompressor,
83
- struct libdeflate_block_state *state,
84
- const char *in_buf, size_t in_len,
85
- const void *needle_buf, size_t needle_len,
86
- wctrans_t trans, locale_t loc);
87
-
88
- /**
89
- * Constructs a value of type wctrans_t that describes a LC_CTYPE category of wide character mapping.
90
- * - "" none
91
- * - "toupper"
92
- * - "tolower"
93
- * - "tojhira" when lang is "jp"
94
- * - "tojkata" when lang is "jp"
95
- */
96
- static inline wctrans_t selva_wctrans(const char *class_str, size_t class_len, locale_t loc)
97
- {
98
- char charclass[16] = {};
99
-
100
- if (likely(class_len < sizeof(charclass))) {
101
- __builtin_memcpy(charclass, class_str, class_len);
102
- }
103
-
104
- return wctrans_l(charclass, loc);
105
- }
@@ -1,37 +0,0 @@
1
- /*
2
- * Copyright (c) 2022-2024 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
- #include <math.h>
7
-
8
- static inline double nan_undefined(void)
9
- {
10
- return nan("1");
11
- }
12
-
13
- static inline int isnan_undefined(double x)
14
- {
15
- long long i;
16
-
17
- if (!isnan(x)) {
18
- return 0;
19
- }
20
-
21
- __builtin_memcpy(&i, &x, sizeof(i));
22
-
23
- return i & 1;
24
- }
25
-
26
- /**
27
- * Mod (%) like it is in JS.
28
- */
29
- static inline double js_fmod(double x, double y)
30
- {
31
- double result = remainder(fabs(x), (y = fabs(y)));
32
- if (signbit(result)) {
33
- result += y;
34
- }
35
-
36
- return copysign(result, x);
37
- }