@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,301 +0,0 @@
1
- /*
2
- * Copyright (c) 2022-2024 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
- #ifndef _SELVA_ENDIAN_H_
7
- #define _SELVA_ENDIAN_H_
8
-
9
- #include <stddef.h>
10
- #include <stdint.h>
11
-
12
- /*
13
- * NOTICE
14
- * This header conflicts with `endian.h` on Linux/glibc and gets included at
15
- * least by `sys/types.h`. This is not a big problem because we implement the
16
- * same functionality + some extras.
17
- * The original header could be included with `#include_next`. Isn't it pretty
18
- * stupid that we can override system headers included by system headers in
19
- * this way?
20
- */
21
-
22
- _Static_assert(sizeof(double) == 8, "Only 64bit doubles are supported");
23
-
24
- #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
25
-
26
- #ifndef htobe16
27
- #define htobe16(x) __builtin_bswap16(x)
28
- #define htole16(x) (x)
29
- #define be16toh(x) __builtin_bswap16(x)
30
- #define le16toh(x) (x)
31
- #endif
32
-
33
- #ifndef htobe32
34
- #define htobe32(x) __builtin_bswap32(x)
35
- #define htole32(x) (x)
36
- #define be32toh(x) __builtin_bswap32(x)
37
- #define le32toh(x) (x)
38
- #endif
39
-
40
- #ifndef htobe64
41
- #define htobe64(x) __builtin_bswap64(x)
42
- #define htole64(x) (x)
43
- #define be64toh(x) __builtin_bswap64(x)
44
- #define le64toh(x) (x)
45
- #endif
46
-
47
- static inline void htoledouble(char buf[8], double x) {
48
- #if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
49
- /*
50
- * x: 4 5 6 7 0 1 2 3
51
- * 0 1 2 3 4 5 6 7
52
- */
53
- char s[8];
54
-
55
- __builtin_memcpy(s, &x, 8);
56
- buf[0] = s[4];
57
- buf[1] = s[5];
58
- buf[2] = s[6];
59
- buf[3] = s[7];
60
- buf[4] = s[0];
61
- buf[5] = s[1];
62
- buf[6] = s[2];
63
- buf[7] = s[3];
64
- #else
65
- __builtin_memcpy(buf, &x, 8);
66
- #endif
67
- }
68
-
69
- static inline double ledoubletoh(const char buf[8]) {
70
- #if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
71
- char s[8];
72
- double x;
73
-
74
- s[0] = buf[4];
75
- s[1] = buf[5];
76
- s[2] = buf[6];
77
- s[3] = buf[7];
78
- s[4] = buf[0];
79
- s[5] = buf[1];
80
- s[6] = buf[2];
81
- s[7] = buf[3];
82
-
83
- __builtin_memcpy(&x, s, sizeof(double));
84
- return x;
85
- #else
86
- double x;
87
-
88
- __builtin_memcpy(&x, buf, sizeof(double));
89
-
90
- return x;
91
- #endif
92
- }
93
-
94
- #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
95
-
96
- #ifndef htobe16
97
- #define htobe16(x) (x)
98
- #define htole16(x) __builtin_bswap16(x)
99
- #define be16toh(x) (x)
100
- #define le16toh(x) __builtin_bswap16(x)
101
- #endif
102
-
103
- #ifndef htobe32
104
- #define htobe32(x) (x)
105
- #define htole32(x) __builtin_bswap32(x)
106
- #define be32toh(x) (x)
107
- #define le32toh(x) __builtin_bswap32(x)
108
- #endif
109
-
110
- #ifndef htobe64
111
- #define htobe64(x) (x)
112
- #define htole64(x) __builtin_bswap64(x)
113
- #define be64toh(x) (x)
114
- #define le64toh(x) __builtin_bswap64(x)
115
- #endif
116
-
117
- static inline void htoledouble(char buf[8], double x) {
118
- #if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
119
- /*
120
- * x: 3 2 1 0 7 6 5 4
121
- * s: 0 1 2 3 4 5 6 7
122
- */
123
- char s[8];
124
-
125
- __builtin_memcpy(s, &x, 8);
126
- buf[0] = s[3];
127
- buf[1] = s[2];
128
- buf[2] = s[1];
129
- buf[3] = s[0];
130
- buf[4] = s[7];
131
- buf[5] = s[6];
132
- buf[6] = s[5];
133
- buf[7] = s[4];
134
- #else
135
- /*
136
- * x: 7 6 5 4 3 2 1 0
137
- * s: 0 1 2 3 4 5 6 7
138
- */
139
- char s[8];
140
-
141
- __builtin_memcpy(s, &x, 8);
142
- buf[0] = s[7];
143
- buf[1] = s[6];
144
- buf[2] = s[5];
145
- buf[3] = s[4];
146
- buf[4] = s[3];
147
- buf[5] = s[2];
148
- buf[6] = s[1];
149
- buf[7] = s[0];
150
- #endif
151
- }
152
-
153
- static inline double ledoubletoh(const char buf[8]) {
154
- char s[8];
155
- double x;
156
-
157
- #if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
158
- s[0] = buf[3];
159
- s[1] = buf[2];
160
- s[2] = buf[1];
161
- s[3] = buf[0];
162
- s[4] = buf[7];
163
- s[5] = buf[6];
164
- s[6] = buf[5];
165
- s[7] = buf[4];
166
- #else
167
- s[0] = buf[7];
168
- s[1] = buf[6];
169
- s[2] = buf[5];
170
- s[3] = buf[4];
171
- s[4] = buf[3];
172
- s[5] = buf[2];
173
- s[6] = buf[1];
174
- s[7] = buf[0];
175
- #endif
176
-
177
- __builtin_memcpy(&x, s, sizeof(double));
178
- return x;
179
- }
180
-
181
- #else
182
- #error "Machine byte order not supported"
183
- #endif
184
-
185
- #if __linux__
186
-
187
- /**
188
- * Type generic Host to BE.
189
- */
190
- #define htobe(v) _Generic((v), \
191
- uint16_t: htobe16(v), \
192
- int16_t: (int16_t)htobe16(v), \
193
- uint32_t: htobe32(v), \
194
- int32_t: (int32_t)htobe32(v), \
195
- uint64_t: htobe64(v), \
196
- int64_t: (int64_t)htobe64(v), \
197
- unsigned long long: (unsigned long long)htobe64(v), \
198
- long long: (int64_t)htobe64(v))
199
-
200
- /**
201
- * Type generic Host to LE.
202
- */
203
- #define htole(v) _Generic((v), \
204
- uint16_t: htole16(v), \
205
- int16_t: (int16_t)htole16(v), \
206
- uint32_t: htole32(v), \
207
- int32_t: (int32_t)htole32(v), \
208
- uint64_t: htole64(v), \
209
- int64_t: (int64_t)htole64(v), \
210
- unsigned long long: (unsigned long long)htole64(v), \
211
- long long: (int64_t)htole64(v))
212
-
213
- /**
214
- * Type generic LE to Host.
215
- */
216
- #define letoh(v) _Generic((v), \
217
- uint16_t: le16toh(v), \
218
- int16_t: (int16_t)le16toh(v), \
219
- uint32_t: le32toh(v), \
220
- int32_t: (int32_t)le32toh(v), \
221
- uint64_t: le64toh(v), \
222
- int64_t: (int64_t)le64toh(v), \
223
- unsigned long long: (unsigned long long)le64toh(v), \
224
- long long: (int64_t)le64toh(v))
225
-
226
- /**
227
- * Type generic BE to Host.
228
- */
229
- #define betoh(v) _Generic((v), \
230
- uint16_t: be16toh(v), \
231
- int16_t: (int16_t)be16toh(v), \
232
- uint32_t: be32toh(v), \
233
- int32_t: (int32_t)be32toh(v), \
234
- uint64_t: be64toh(v), \
235
- int64_t: (int64_t)be64toh(v), \
236
- unsigned long long: (unsigned long long)be64toh(v), \
237
- long long: (int64_t)be64toh(v))
238
-
239
- /* 128-bit machines not supported atm. */
240
- static_assert(sizeof(long long) == sizeof(uint64_t));
241
-
242
- #else
243
-
244
- /**
245
- * Type generic Host to BE.
246
- */
247
- #define htobe(v) _Generic((v), \
248
- uint16_t: htobe16(v), \
249
- int16_t: (int16_t)htobe16(v), \
250
- uint32_t: htobe32(v), \
251
- int32_t: (int32_t)htobe32(v), \
252
- uint64_t: htobe64(v), \
253
- size_t: htobe64(v), \
254
- ssize_t: htobe64(v), \
255
- int64_t: (int64_t)htobe64(v))
256
-
257
- /**
258
- * Type generic Host to LE.
259
- */
260
- #define htole(v) _Generic((v), \
261
- uint16_t: htole16(v), \
262
- int16_t: (int16_t)htole16(v), \
263
- uint32_t: htole32(v), \
264
- int32_t: (int32_t)htole32(v), \
265
- uint64_t: htole64(v), \
266
- size_t: htole64(v), \
267
- ssize_t: htole64(v), \
268
- int64_t: (int64_t)htole64(v))
269
-
270
- /**
271
- * Type generic LE to Host.
272
- */
273
- #define letoh(v) _Generic((v), \
274
- uint16_t: le16toh(v), \
275
- int16_t: (int16_t)le16toh(v), \
276
- uint32_t: le32toh(v), \
277
- int32_t: (int32_t)le32toh(v), \
278
- uint64_t: le64toh(v), \
279
- size_t: le64toh(v), \
280
- ssize_t: le64toh(v), \
281
- int64_t: (int64_t)le64toh(v))
282
-
283
- /**
284
- * Type generic BE to Host.
285
- */
286
- #define betoh(v) _Generic((v), \
287
- uint16_t: be16toh(v), \
288
- int16_t: (int16_t)be16toh(v), \
289
- uint32_t: be32toh(v), \
290
- int32_t: (int32_t)be32toh(v), \
291
- uint64_t: be64toh(v), \
292
- size_t: be64toh(v), \
293
- ssize_t: be64toh(v), \
294
- int64_t: (int64_t)be64toh(v))
295
-
296
- #endif
297
-
298
- /* If this fails then htole and letoh will need some adjustment. */
299
- static_assert(sizeof(size_t) == sizeof(uint64_t));
300
-
301
- #endif /* _SELVA_ENDIAN_H_ */
@@ -1,23 +0,0 @@
1
- /*
2
- * Copyright (c) 2024 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #include <stddef.h>
6
- #include <stdint.h>
7
- #include <sys/types.h>
8
- #include "selva/types.h"
9
-
10
- struct SelvaNode;
11
- struct SelvaNodeReference;
12
-
13
- SELVA_EXPORT
14
- ssize_t fast_linear_search_uint32(const uint32_t arr[], size_t len, uint32_t x);
15
-
16
- SELVA_EXPORT
17
- ssize_t fast_linear_search_node_id(const node_id_t arr[], size_t len, node_id_t x);
18
-
19
- SELVA_EXPORT
20
- ssize_t fast_linear_search_node(const struct SelvaNode *arr[], size_t len, const struct SelvaNode *x);
21
-
22
- SELVA_EXPORT
23
- ssize_t fast_linear_search_references(const struct SelvaNodeReference *arr, size_t len, const struct SelvaNode *x);
@@ -1,11 +0,0 @@
1
- /*
2
- * Copyright (c) 2024-2025 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
-
7
- #include <stddef.h>
8
- #include "selva/_export.h"
9
-
10
- SELVA_EXPORT
11
- void *fast_memmem(const void *h0, size_t k, const void *n0, size_t l);
@@ -1,36 +0,0 @@
1
- /*
2
- * Copyright (c) 2022-2023, 2025 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
-
7
- /**
8
- * Like atoi but faster and more unsafe.
9
- * This is way faster than strtoll() in glibc.
10
- */
11
- static inline int fast_atou(const char *str)
12
- {
13
- int n = 0;
14
-
15
- while (*str >= '0' && *str <= '9') {
16
- n = n * 10 + (int)(*str++) - '0';
17
- }
18
-
19
- return n;
20
- }
21
-
22
- /**
23
- * Like strtol but faster and more unsafe.
24
- * This is way faster than strtoll() in glibc.
25
- */
26
- static inline int fast_strtou(const char *str, const char **end)
27
- {
28
- int n = 0;
29
-
30
- while (*str >= '0' && *str <= '9') {
31
- n = n * 10 + (int)(*str++) - '0';
32
- }
33
-
34
- *end = str;
35
- return n;
36
- }
@@ -1,338 +0,0 @@
1
- /*
2
- * Copyright (c) 2024-2025 SAULX
3
- * SPDX-License-Identifier: MIT
4
- */
5
- #pragma once
6
-
7
- #include <sys/types.h>
8
- #include "selva/_export.h"
9
- #ifdef __zig
10
- struct selva_string;
11
- #else
12
- #include "selva/selva_string.h"
13
- #endif
14
- #include "selva/types.h"
15
- #include "selva_lang_code.h"
16
-
17
- /**
18
- * Reserved (N/A) field id.
19
- * Can be used to mark that a field doesn't exist.
20
- * E.g. if created and updated fields don't exist their ids can be set to this
21
- * value.
22
- * Technically fields 251..255 are all reserved.
23
- */
24
- #define SELVA_FIELDS_RESERVED 255
25
-
26
- struct XXH3_state_s; /* RFE Not good? */
27
-
28
- #ifndef __zig
29
- struct SelvaTextField {
30
- struct selva_string *tl __pcounted_by(len);
31
- uint8_t len;
32
- } __packed;
33
- #endif
34
-
35
- struct SelvaNodeReference {
36
- struct SelvaNode *dst;
37
- struct SelvaFields *meta;
38
- };
39
-
40
- struct SelvaNodeReferences {
41
- uint32_t nr_refs;
42
- uint16_t offset;
43
- struct SelvaNodeReference *refs __pcounted_by(nr_refs);
44
- node_id_t *index __pcounted_by(nr_refs); /*!< Sorted index of all nodes in `.refs`. */
45
- };
46
-
47
- struct SelvaNodeWeakReference {
48
- /* THe type can be found from the schema. */
49
- #if 0
50
- node_type_t dst_type;
51
- #endif
52
- node_id_t dst_id;
53
- };
54
-
55
- struct SelvaNodeWeakReferences {
56
- uint32_t nr_refs;
57
- uint32_t offset;
58
- struct SelvaNodeWeakReference *refs __pcounted_by(nr_refs);
59
- };
60
-
61
- struct SelvaMicroBuffer {
62
- uint16_t len;
63
- uint8_t data[] __counted_by(len);
64
- } __packed;
65
-
66
- struct SelvaFieldsAny {
67
- enum SelvaFieldType type; /*!< Type of the value. */
68
- union {
69
- bool boolean; /*!< SELVA_FIELD_TYPE_BOOLEAN */
70
- double number; /*!< SELVA_FIELD_TYPE_NUMBER */
71
- int64_t timestamp; /*!< SELVA_FIELD_TYPE_TIMESTAMP, should fit time_t */
72
- struct selva_string *string; /*!< SELVA_FIELD_TYPE_STRING */
73
- int8_t int8; /* SELVA_FIELD_TYPE_INT8 */
74
- uint8_t uint8; /*!< SELVA_FIELD_TYPE_UINT8 */
75
- int16_t int16; /*!< SELVA_FIELD_TYPE_INT16 */
76
- uint16_t uint16; /*!< SELVA_FIELD_TYPE_UINT16 */
77
- int32_t int32; /*!< SELVA_FIELD_TYPE_INT32 */
78
- uint32_t uint32; /*!< SELVA_FIELD_TYPE_UINT32 */
79
- int64_t int64; /* SELVA_FIELD_TYPE_INT64 */
80
- uint64_t uint64; /*!< SELVA_FIELD_TYPE_UINT64 */
81
- uint8_t enu; /*!< SELVA_FIELD_TYPE_ENUM */
82
- #if 0
83
- struct SelvaTextField *text; /*!< SELVA_FIELD_TYPE_TEXT */
84
- struct SelvaNodeReference *reference; /*!< SELVA_FIELD_TYPE_REFERENCE */
85
- struct SelvaNodeReferences *references; /*!< SELVA_FIELD_TYPE_REFERENCES */
86
- struct SelvaNodeWeakReference weak_reference; /*!< SELVA_FIELD_TYPE_WEAK_REFERENCE */
87
- struct SelvaNodeWeakReferences weak_references; /*!< SELVA_FIELD_TYPE_WEAK_REFERENCES */
88
- struct SelvaMicroBuffer *smb; /*!< SELVA_FIELD_TYPE_MICRO_BUFFER */
89
- #endif
90
- };
91
- };
92
-
93
- struct SelvaFieldsPointer {
94
- uint8_t *ptr;
95
- size_t off;
96
- size_t len;
97
- };
98
-
99
- #if __has_c_attribute(unsequenced)
100
- [[unsequenced]]
101
- #else
102
- __purefn
103
- #endif
104
- size_t selva_fields_get_data_size(const struct SelvaFieldSchema *fs);
105
-
106
- #if __has_c_attribute(reproducible)
107
- [[reproducible]]
108
- #endif
109
- void *selva_fields_nfo2p(struct SelvaFields *fields, const struct SelvaFieldInfo *nfo);
110
-
111
- /**
112
- * Set field value.
113
- */
114
- SELVA_EXPORT
115
- int selva_fields_set(
116
- struct SelvaDb *db,
117
- struct SelvaNode *node,
118
- const struct SelvaFieldSchema *fs,
119
- const void *value, size_t len);
120
-
121
- /**
122
- * Set field value with CRC.
123
- */
124
- SELVA_EXPORT
125
- int selva_fields_set_wcrc(
126
- struct SelvaDb *db,
127
- struct SelvaNode *node,
128
- const struct SelvaFieldSchema *fs,
129
- const void *value, size_t len,
130
- uint32_t crc);
131
-
132
- SELVA_EXPORT
133
- int selva_fields_get_mutable_string(
134
- struct SelvaNode *node,
135
- const struct SelvaFieldSchema *fs,
136
- size_t len,
137
- struct selva_string **s)
138
- __attribute__((access(write_only, 4)));
139
-
140
- SELVA_EXPORT
141
- int selva_fields_reference_set(
142
- struct SelvaDb *db,
143
- struct SelvaNode * restrict src,
144
- const struct SelvaFieldSchema *fs_src,
145
- struct SelvaNode * restrict dst,
146
- struct SelvaNodeReference **ref_out)
147
- __attribute__((access(write_only, 5)));
148
-
149
- /**
150
- * @param index 0 = first; -1 = last.
151
- */
152
- SELVA_EXPORT
153
- int selva_fields_references_insert(
154
- struct SelvaDb *db,
155
- struct SelvaNode * restrict node,
156
- const struct SelvaFieldSchema *fs,
157
- ssize_t index,
158
- bool reorder,
159
- struct SelvaTypeEntry *te_dst,
160
- struct SelvaNode * restrict dst,
161
- struct SelvaNodeReference **ref_out)
162
- __attribute__((access(write_only, 8)));
163
-
164
- /**
165
- * Prealloc a references field buffer.
166
- * @returns nr_refs.
167
- */
168
- SELVA_EXPORT
169
- size_t selva_fields_prealloc_refs(struct SelvaNode *node, const struct SelvaFieldSchema *fs, size_t nr_refs_min);
170
-
171
- SELVA_EXPORT
172
- int selva_fields_references_insert_tail_wupsert(
173
- struct SelvaDb *db,
174
- struct SelvaNode * restrict node,
175
- const struct SelvaFieldSchema *fs,
176
- struct SelvaTypeEntry *te_dst,
177
- const node_id_t ids[],
178
- size_t nr_ids)
179
- __attribute__((access(read_only, 5, 6)));
180
-
181
- /**
182
- * Move reference from old to new index in a references field array.
183
- * If index_new > index_old then the ref will be after the reference that was in index_new before the operation;
184
- * If index_new < index_ld then the ref will be before the reference that was in the index_new before the operation.
185
- * index_new and index_old can be negative, which will start counting the references array from the last position.
186
- * It's not possible to create a gap of null references using this function.
187
- */
188
- SELVA_EXPORT
189
- int selva_fields_references_move(
190
- struct SelvaNode *node,
191
- const struct SelvaFieldSchema *fs,
192
- ssize_t index_old,
193
- ssize_t index_new);
194
-
195
- /**
196
- * Swap two references in a references field array.
197
- */
198
- SELVA_EXPORT
199
- int selva_fields_references_swap(
200
- struct SelvaNode *node,
201
- const struct SelvaFieldSchema *fs,
202
- size_t index_a,
203
- size_t index_b);
204
-
205
- SELVA_EXPORT
206
- int selva_fields_set_reference_meta(
207
- struct SelvaNode *node,
208
- struct SelvaNodeReference *ref,
209
- const struct EdgeFieldConstraint *efc,
210
- field_t field,
211
- const void *value, size_t len);
212
-
213
- SELVA_EXPORT
214
- int selva_fields_get_reference_meta_mutable_string(
215
- struct SelvaNode *node,
216
- struct SelvaNodeReference *ref,
217
- const struct EdgeFieldConstraint *efc,
218
- field_t field,
219
- size_t len,
220
- struct selva_string **s);
221
-
222
- /**
223
- * Set string field.
224
- *
225
- * str format:
226
- * 0 1 2 len
227
- * +------+------+--------+-----+
228
- * | LANG | COMP | DATA | CRC |
229
- * +------+------+--------+-----+
230
- */
231
- SELVA_EXPORT
232
- int selva_fields_set_string(struct SelvaNode *node, const struct SelvaFieldSchema *fs, struct SelvaFieldInfo *nfo, const char *str, size_t len);
233
-
234
- /**
235
- * Set text field translation.
236
- *
237
- * str format:
238
- * 0 1 2 len
239
- * +------+------+--------+-----+
240
- * | LANG | COMP | DATA | CRC |
241
- * +------+------+--------+-----+
242
- */
243
- SELVA_EXPORT
244
- int selva_fields_set_text(
245
- struct SelvaNode *node,
246
- const struct SelvaFieldSchema *fs,
247
- const char *str,
248
- size_t len);
249
-
250
- /**
251
- * Get text field translation.
252
- *
253
- * str format:
254
- * 0 1 2 len
255
- * +------+------+--------+-----+
256
- * | LANG | COMP | DATA | CRC |
257
- * +------+------+--------+-----+
258
- */
259
- SELVA_EXPORT
260
- int selva_fields_get_text(
261
- struct SelvaDb *db,
262
- struct SelvaNode * restrict node,
263
- const struct SelvaFieldSchema *fs,
264
- enum selva_lang_code lang,
265
- const char **str,
266
- size_t *len);
267
-
268
- SELVA_EXPORT
269
- struct SelvaNodeReference *selva_fields_get_reference(struct SelvaNode *node, field_t field);
270
-
271
- SELVA_EXPORT
272
- struct SelvaNodeReferences *selva_fields_get_references(struct SelvaNode *node, field_t field);
273
-
274
- SELVA_EXPORT
275
- struct SelvaNodeWeakReference selva_fields_get_weak_reference(struct SelvaFields *fields, field_t field);
276
-
277
- SELVA_EXPORT
278
- struct SelvaNodeWeakReferences selva_fields_get_weak_references(struct SelvaFields *fields, field_t field);
279
-
280
- SELVA_EXPORT
281
- struct SelvaNode *selva_fields_resolve_weak_reference(
282
- const struct SelvaDb *db,
283
- const struct SelvaFieldSchema *fs,
284
- const struct SelvaNodeWeakReference *weak_ref);
285
-
286
- SELVA_EXPORT
287
- struct SelvaFieldsPointer selva_fields_get_raw2(struct SelvaFields *fields, const struct SelvaFieldSchema *fs)
288
- __attribute__((nonnull));
289
-
290
- SELVA_EXPORT
291
- struct SelvaFieldsPointer selva_fields_get_raw(struct SelvaNode *node, const struct SelvaFieldSchema *fs);
292
-
293
- /**
294
- * Delete field.
295
- */
296
- SELVA_EXPORT
297
- int selva_fields_del(struct SelvaDb *db, struct SelvaNode *node, const struct SelvaFieldSchema *fs);
298
-
299
- /**
300
- * Delete an edge from a references field.
301
- */
302
- SELVA_EXPORT
303
- int selva_fields_del_ref(struct SelvaDb *db, struct SelvaNode *node, field_t field, node_id_t dst_node_id);
304
-
305
- SELVA_EXPORT
306
- void selva_fields_clear_references(struct SelvaDb *db, struct SelvaNode *node, const struct SelvaFieldSchema *fs);
307
-
308
- /**
309
- * Init fields of a node.
310
- */
311
- SELVA_EXPORT
312
- void selva_fields_init(const struct SelvaFieldsSchema *schema, struct SelvaFields *fields);
313
-
314
- /**
315
- * Destroy all fields of a node.
316
- * This will set nr_fields = 0, making setting new field values impossible
317
- * regardless wether the schema defines fields for this node.
318
- */
319
- SELVA_EXPORT
320
- void selva_fields_destroy(struct SelvaDb *db, struct SelvaNode *node);
321
-
322
- SELVA_EXPORT
323
- int selva_fields_get_string_crc(const struct SelvaNode *node, const struct SelvaFieldSchema *fs, uint32_t *crc);
324
-
325
- SELVA_EXPORT
326
- int selva_fields_get_string_crc2(const struct SelvaFields *fields, const struct SelvaFieldSchema *fs, uint32_t *crc);
327
-
328
- SELVA_EXPORT
329
- int selva_fields_get_text_crc(const struct SelvaNode *node, const struct SelvaFieldSchema *fs, enum selva_lang_code lang, uint32_t *crc);
330
-
331
- SELVA_EXPORT
332
- int selva_fields_get_text_crc2(const struct SelvaFields *fields, const struct SelvaFieldSchema *fs, enum selva_lang_code lang, uint32_t *crc);
333
-
334
- SELVA_EXPORT
335
- void selva_fields_hash_update(struct XXH3_state_s *hash_state, const struct SelvaFieldsSchema *schema, const struct SelvaFields *fields);
336
-
337
- SELVA_EXPORT
338
- selva_hash128_t selva_fields_hash(const struct SelvaFieldsSchema *schema, const struct SelvaFields *fields);