@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,59 +0,0 @@
1
- /*
2
- * Base64 encoding/decoding (RFC1341)
3
- * Copyright (c) 2021-2025 SAULX
4
- * Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- #pragma once
8
-
9
- #include "selva/_export.h"
10
-
11
- SELVA_EXPORT
12
- size_t base64_encode_s(char *out, const char *str_in, size_t len, size_t line_max)
13
- __attribute__((access(write_only, 1), access(read_only, 2, 3)));
14
-
15
- /**
16
- * base64_encode - Base64 encode
17
- * Caller is responsible for freeing the returned buffer. Returned buffer is
18
- * nul terminated to make it easier to use as a C string. The nul terminator is
19
- * not included in out_len.
20
- * @parma str_in Data to be encoded
21
- * @param len Length of the data to be encoded
22
- * @param out_len Pointer to output length variable, or NULL if not used
23
- * @returns Allocated buffer of out_len bytes of encoded data,
24
- * or %NULL on failure
25
- */
26
- [[nodiscard]]
27
- SELVA_EXPORT
28
- char * base64_encode(const char *str_in, size_t len, size_t *out_len)
29
- __attribute__((access(read_only, 1, 2), access(read_only, 3)));
30
-
31
- /**
32
- * Base64 decode.
33
- * Caller is responsible for freeing the returned buffer.
34
- * @param str_in Data to be decoded
35
- * @param len Length of the data to be decoded
36
- * @param out_len Pointer to output length variable
37
- * @returns Allocated buffer of out_len bytes of decoded data, or NULL on failure
38
- */
39
- [[nodiscard]]
40
- SELVA_EXPORT
41
- char * base64_decode(const char *str_in, size_t len, size_t *out_len)
42
- __attribute__((access(read_only, 1, 2), access(write_only, 3)));
43
-
44
- /**
45
- * Calculate the required buffer size of a string of n bytes.
46
- * @param line_max is the max line length. 0 = no limit; 72 = typical.
47
- */
48
- static inline size_t base64_out_len(size_t n, size_t line_max) {
49
- size_t olen;
50
-
51
- /* This version would be with padding but we don't pad */
52
- #if 0
53
- olen = n * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
54
- #endif
55
- olen = ((4 * n / 3) + 3) & ~3;
56
- olen += line_max > 0 ? olen / line_max : 0; /* line feeds */
57
-
58
- return olen;
59
- }
@@ -1,59 +0,0 @@
1
- /*
2
- * Base64url encoding/decoding (RFC4648)
3
- * Copyright (c) 2021-2025 SAULX
4
- * Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- #pragma once
8
-
9
- #include "selva/_export.h"
10
-
11
- SELVA_EXPORT
12
- size_t base64url_encode_s(char *out, const char *str_in, size_t len, size_t line_max)
13
- __attribute__((access(write_only, 1), access(read_only, 2, 3)));
14
-
15
- /**
16
- * base64url_encode - Base64url encode
17
- * Caller is responsible for freeing the returned buffer. Returned buffer is
18
- * nul terminated to make it easier to use as a C string. The nul terminator is
19
- * not included in out_len.
20
- * @parma str_in Data to be encoded
21
- * @param len Length of the data to be encoded
22
- * @param out_len Pointer to output length variable, or NULL if not used
23
- * @returns Allocated buffer of out_len bytes of encoded data,
24
- * or %NULL on failure
25
- */
26
- [[nodiscard]]
27
- SELVA_EXPORT
28
- char * base64url_encode(const char *str_in, size_t len, size_t *out_len)
29
- __attribute__((access(read_only, 1, 2), access(read_only, 3)));
30
-
31
- /**
32
- * Base64url decode.
33
- * Caller is responsible for freeing the returned buffer.
34
- * @param str_in Data to be decoded
35
- * @param len Length of the data to be decoded
36
- * @param out_len Pointer to output length variable
37
- * @returns Allocated buffer of out_len bytes of decoded data, or NULL on failure
38
- */
39
- [[nodiscard]]
40
- SELVA_EXPORT
41
- char * base64url_decode(const char *str_in, size_t len, size_t *out_len)
42
- __attribute__((access(read_only, 1, 2), access(write_only, 3)));
43
-
44
- /**
45
- * Calculate the required buffer size of a string of n bytes.
46
- * @param line_max is the max line length. 0 = no limit; 72 = typical.
47
- */
48
- static inline size_t base64url_out_len(size_t n, size_t line_max) {
49
- size_t olen;
50
-
51
- /* This version would be with padding but we don't pad */
52
- #if 0
53
- olen = n * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
54
- #endif
55
- olen = ((4 * n / 3) + 3) & ~3;
56
- olen += line_max > 0 ? olen / line_max : 0; /* line feeds */
57
-
58
- return olen;
59
- }
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright (c) 2021, 2023, 2025 SAULX
3
- * SPDX-License-Identifier: BSD-2-Clause
4
- */
5
-
6
- #pragma once
7
-
8
- #include <stddef.h>
9
- #include <stdint.h>
10
- #include "selva/_export.h"
11
-
12
- #if __SIZEOF_INT128__ != 16
13
- #error The compiler and architecture must have Tetra-Integer support
14
- #endif
15
-
16
- typedef unsigned __int128 bitmap_t;
17
-
18
- /**
19
- * A flexible bitmap.
20
- */
21
- struct bitmap {
22
- size_t nbits;
23
- bitmap_t d[];
24
- };
25
-
26
- #define BITMAP_CEILING(x, y) \
27
- (((x) + (y) - (size_t)1) / (y))
28
-
29
- /*
30
- * We use this instead of max() to avoid GCC compound statements that don't work
31
- * outside of functions. C23 constexpr might make compound statements available
32
- * for initialization but compound statements are currently only supported in
33
- * GCC 13 and there is no support in Clang.
34
- */
35
- #define BITMAP_MAX(a, b) \
36
- ((a) > (b) ? (a) : (b))
37
-
38
- #define BITMAP_D_SIZE(nbits) \
39
- (BITMAP_CEILING(BITMAP_MAX((size_t)(nbits), (size_t)8) / (size_t)8, sizeof(bitmap_t)) * sizeof(bitmap_t))
40
-
41
- /**
42
- * Byte size of a bitmap struct passable to a malloc()-like function.
43
- * nbits must be a literal or variable.
44
- */
45
- #define BITMAP_ALLOC_SIZE(nbits) \
46
- (sizeof(struct bitmap) + BITMAP_D_SIZE(nbits))
47
-
48
- /**
49
- * Get the status of a bit in a bitmap pointed by bitmap.
50
- * @param bitmap is a pointer to a bitmap.
51
- * @param pos is the bit position to be checked.
52
- * @return Boolean value or -1.
53
- */
54
- SELVA_EXPORT
55
- int bitmap_get(const struct bitmap *bitmap, size_t pos)
56
- __attribute__((pure, access(read_only, 1)));
57
-
58
- /**
59
- * Set a bit in a bitmap pointed by bitmap.
60
- * @param bitmap is a pointer to a bitmap.
61
- * @param pos is the bit position to be set.
62
- * @return 0 or -1.
63
- */
64
- SELVA_EXPORT
65
- int bitmap_set(struct bitmap *bitmap, size_t pos)
66
- __attribute__((access(read_write, 1)));
67
-
68
- /**
69
- * Clear a bit in a bitmap pointed by bitmap.
70
- * @param bitmap is a pointer to a bitmap.
71
- * @param pos is the bit position to be cleared.
72
- * @return 0 or -1.
73
- */
74
- SELVA_EXPORT
75
- int bitmap_clear(struct bitmap *bitmap, size_t pos)
76
- __attribute__((access(read_write, 1)));
77
-
78
- /**
79
- * Erase the whole bitmap.
80
- * @param bitmap is a pointer to a bitmap.
81
- */
82
- SELVA_EXPORT
83
- void bitmap_erase(struct bitmap *bitmap)
84
- __attribute__((access(read_write, 1)));
85
-
86
- SELVA_EXPORT
87
- long long bitmap_popcount(const struct bitmap *bitmap)
88
- __attribute__((pure, access(read_only, 1)));
89
-
90
- /**
91
- * Find first set.
92
- */
93
- SELVA_EXPORT
94
- int bitmap_ffs(const struct bitmap *bitmap)
95
- __attribute__((pure, access(read_only, 1)));
@@ -1,17 +0,0 @@
1
- /*
2
- * Copyright (c) 2025 SAULX
3
- * Copyright (C) 2013, 2021 Mark Adler <madler@alumni.caltech.edu>
4
- * SPDX-License-Identifier: Zlib
5
- */
6
- #pragma once
7
-
8
- #include <stddef.h>
9
- #include <stdint.h>
10
- #include "selva/_export.h"
11
-
12
- /**
13
- * Compute CRC-32C.
14
- */
15
- SELVA_EXPORT
16
- uint32_t crc32c(uint32_t crc, void const *buf, size_t len)
17
- __attribute__((pure, access(read_only, 2, 3)));
@@ -1,135 +0,0 @@
1
- /**
2
- *******************************************************************************
3
- * @file ctime.h
4
- * @author Olli Vanhoja
5
- * @brief time types.
6
- * @section LICENSE
7
- * Copyright (c) 2022-2025 Saulx
8
- * Copyright (c) 2020 Olli Vanhoja <olli.vanhoja@alumni.helsinki.fi>
9
- * Copyright (c) 2014 - 2016 Olli Vanhoja <olli.vanhoja@cs.helsinki.fi>
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions are met:
14
- *
15
- * 1. Redistributions of source code must retain the above copyright notice,
16
- * this list of conditions and the following disclaimer.
17
- * 2. Redistributions in binary form must reproduce the above copyright notice,
18
- * this list of conditions and the following disclaimer in the documentation
19
- * and/or other materials provided with the distribution.
20
- *
21
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
- * POSSIBILITY OF SUCH DAMAGE.
32
- * SPDX-License-Identifier: BSD-2-Clause
33
- *******************************************************************************
34
- */
35
-
36
- #pragma once
37
-
38
- #include <stdint.h>
39
- #include <time.h>
40
- #include "selva/_export.h"
41
-
42
- /**
43
- * Conver an msec value to a timespec struct.
44
- * @param[out] ts is a pointer to the destination struct.
45
- * @param[in] nsec is the value in milliseconds.
46
- */
47
- SELVA_EXPORT
48
- struct timespec *msec2timespec(struct timespec * ts, int64_t msec);
49
-
50
- #define MSEC2TIMESPEC(msec) \
51
- ({ struct timespec _ts; (void)msec2timespec(&_ts, msec); _ts; })
52
-
53
- /**
54
- * Convert a nsec value to a timespec struct.
55
- * @param[out] ts is a pointer to the destination struct.
56
- * @param[in] nsec is the value in nanoseconds.
57
- */
58
- SELVA_EXPORT
59
- struct timespec *nsec2timespec(struct timespec * ts, int64_t nsec);
60
-
61
- #define NSEC2TIMESPEC(nsec) \
62
- ({ struct timespec _ts; (void)NSEC2TIMESPEC(&_ts, nsec); _ts; })
63
-
64
- /**
65
- * Compare two timespec structs.
66
- * @param[in] left is a pointer to the left value.
67
- * @param[in] right is a pointer to the right value.
68
- * @param[in] cmp is the operator (<, >, ==, <=, or >=).
69
- * @returns a boolean value.
70
- */
71
- #define timespec_cmp(left_tsp, right_tsp, cmp) ({ \
72
- (((left_tsp)->tv_sec == (right_tsp)->tv_sec) \
73
- ? ((left_tsp)->tv_nsec cmp (right_tsp)->tv_nsec) \
74
- : ((left_tsp)->tv_sec cmp (right_tsp)->tv_sec)); \
75
- })
76
-
77
- /**
78
- * Calculate the sum of two timespec structs.
79
- * @param[out] sum is a pointer to the destination struct.
80
- * @param[in] left is a pointer to the left value.
81
- * @param[in] right is a pointer to the right value.
82
- */
83
- SELVA_EXPORT
84
- void timespec_add(struct timespec * sum, const struct timespec * left,
85
- const struct timespec * right)
86
- __attribute__((access(write_only, 1), access(read_only, 2), access(read_only, 3)));
87
-
88
- /**
89
- * Calculate the difference of two timespec structs.
90
- * @param[out] sum is a pointer to the destination struct.
91
- * @param[in] left is a pointer to the left value.
92
- * @param[in] right is a pointer to the right value.
93
- */
94
- SELVA_EXPORT
95
- void timespec_sub(struct timespec * diff, const struct timespec * left,
96
- const struct timespec * right)
97
- __attribute__((access(write_only, 1), access(read_only, 2), access(read_only, 3)));
98
-
99
- /**
100
- * Calculate the product of two timespec structs.
101
- * @param[out] sum is a pointer to the destination struct.
102
- * @param[in] left is a pointer to the left value.
103
- * @param[in] right is a pointer to the right value.
104
- */
105
- SELVA_EXPORT
106
- void timespec_mul(struct timespec * prod, const struct timespec * left,
107
- const struct timespec * right)
108
- __attribute__((access(write_only, 1), access(read_only, 2), access(read_only, 3)));
109
-
110
- /**
111
- * Calculate the quotient of two timespec structs.
112
- * @param[out] sum is a pointer to the destination struct.
113
- * @param[in] left is a pointer to the left value.
114
- * @param[in] right is a pointer to the right value.
115
- */
116
- SELVA_EXPORT
117
- void timespec_div(struct timespec * quot, const struct timespec * left,
118
- const struct timespec * right)
119
- __attribute__((access(write_only, 1), access(read_only, 2), access(read_only, 3)));
120
-
121
- /**
122
- * Calculate the modulo of two timespec structs.
123
- * @param[out] sum is a pointer to the destination struct.
124
- * @param[in] left is a pointer to the left value.
125
- * @param[in] right is a pointer to the right value.
126
- */
127
- void timespec_mod(struct timespec * rem, const struct timespec * left,
128
- const struct timespec * right)
129
- __attribute__((access(write_only, 1), access(read_only, 2), access(read_only, 3)));
130
-
131
- static inline double timespec2ms(const struct timespec *ts)
132
- {
133
- return (double)ts->tv_sec * 1000.0 + (double)ts->tv_nsec / 1.0e6;
134
- }
135
-
@@ -1,284 +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
- #include "selva/types.h"
10
-
11
- /*
12
- * TODO Don't like this one but it compiles.
13
- * We should have something with selva_hash_state;
14
- */
15
- struct XXH3_state_s;
16
-
17
- /**
18
- * Create a new DB instance.
19
- */
20
- SELVA_EXPORT
21
- struct SelvaDb *selva_db_create(void);
22
-
23
- /**
24
- * Destroy a DB instance.
25
- */
26
- SELVA_EXPORT
27
- void selva_db_destroy(struct SelvaDb *db) __attribute__((nonnull));
28
-
29
- /**
30
- * Create a new node type with a schema.
31
- * @param type must not exist before.
32
- */
33
- SELVA_EXPORT
34
- int selva_db_schema_create(struct SelvaDb *db, node_type_t type, const char *schema_buf, size_t schema_len) __attribute__((nonnull));
35
-
36
- /**
37
- * Save the common/shared data of the database.
38
- */
39
- SELVA_EXPORT
40
- int selva_dump_save_common(struct SelvaDb *db, const char *filename) __attribute__((nonnull));
41
-
42
- /**
43
- * Save a range of nodes from te.
44
- */
45
- SELVA_EXPORT
46
- int selva_dump_save_range(struct SelvaDb *db, struct SelvaTypeEntry *te, const char *filename, node_id_t start, node_id_t end, selva_hash128_t *range_hash_out) __attribute__((nonnull));
47
-
48
- /**
49
- * **Usage:**
50
- * ```c
51
- * struct SelvaDb *db = selva_db_create();
52
- * selva_dump_load_common(db, filename_common);
53
- * selva_dump_load_range(db, filename_range_n);
54
- * ```
55
- */
56
- SELVA_EXPORT
57
- int selva_dump_load_common(struct SelvaDb *db, const char *filename) __attribute__((nonnull));
58
-
59
- SELVA_EXPORT
60
- int selva_dump_load_range(struct SelvaDb *db, const char *filename) __attribute__((nonnull));
61
-
62
- /**
63
- * Find a type by type id.
64
- */
65
- SELVA_EXPORT
66
- struct SelvaTypeEntry *selva_get_type_by_index(const struct SelvaDb *db, node_type_t type) __attribute__((nonnull));
67
-
68
- /**
69
- * Get the type for node.
70
- */
71
- SELVA_EXPORT
72
- struct SelvaTypeEntry *selva_get_type_by_node(const struct SelvaDb *db, struct SelvaNode *node) __attribute__((nonnull, pure));
73
-
74
- /**
75
- * Get the node schema for type.
76
- */
77
- SELVA_EXPORT
78
- const struct SelvaNodeSchema *selva_get_ns_by_te(const struct SelvaTypeEntry *te) __attribute__((nonnull, pure));
79
-
80
- SELVA_EXPORT
81
- const struct SelvaFieldSchema *get_fs_by_fields_schema_field(const struct SelvaFieldsSchema *fields_schema, field_t field) __attribute__((nonnull, pure));
82
-
83
- /**
84
- * Get the field schema for field.
85
- */
86
- SELVA_EXPORT
87
- const struct SelvaFieldSchema *selva_get_fs_by_ns_field(const struct SelvaNodeSchema *ns, field_t field) __attribute__((nonnull, pure));
88
-
89
- /**
90
- * Get the field schema for field.
91
- */
92
- SELVA_EXPORT
93
- const struct SelvaFieldSchema *selva_get_fs_by_node(struct SelvaDb *db, struct SelvaNode *node, field_t field) __attribute__((nonnull, pure));
94
-
95
- SELVA_EXPORT
96
- #if __has_c_attribute(reproducible)
97
- [[reproducible]]
98
- #endif
99
- enum SelvaFieldType selva_get_fs_type(const struct SelvaFieldSchema *fs);
100
-
101
- /**
102
- * Get the EdgeFieldConstraint from a ref field schema.
103
- * struct EdgeFieldConstraint *efc = selva_get_edge_field_constraint(src_fs);
104
- * struct SelvaTypeEntry *dst_type = selva_get_type_by_index(db, efc->dst_node_type);
105
- * struct SelvaFieldSchema *dst_fs = selva_get_fs_by_node(db, dst, efc->inverse_field);
106
- */
107
- SELVA_EXPORT
108
- const struct EdgeFieldConstraint *selva_get_edge_field_constraint(const struct SelvaFieldSchema *fs) __attribute__((nonnull));
109
-
110
- /**
111
- * Delete a node.
112
- */
113
- SELVA_EXPORT
114
- void selva_del_node(struct SelvaDb *db, struct SelvaTypeEntry *type, struct SelvaNode *node) __attribute__((nonnull));
115
-
116
- /**
117
- * Get a node by id.
118
- */
119
- SELVA_EXPORT
120
- struct SelvaNode *selva_find_node(struct SelvaTypeEntry *type, node_id_t node_id) __attribute__((nonnull));
121
-
122
- /**
123
- * Find the first node greater than or equal to the provided id, or NULL.
124
- */
125
- SELVA_EXPORT
126
- struct SelvaNode *selva_nfind_node(struct SelvaTypeEntry *type, node_id_t node_id) __attribute__((nonnull));
127
-
128
- /**
129
- * Get or create a node by id.
130
- */
131
- SELVA_EXPORT
132
- struct SelvaNode *selva_upsert_node(struct SelvaTypeEntry *type, node_id_t node_id) __attribute__((nonnull));
133
-
134
- /**
135
- * **Example**
136
- * ```c
137
- * for (struct SelvaNode *np = selva_min_node(type); np; np = selva_next_node(type, np))
138
- * ```
139
- */
140
- SELVA_EXPORT
141
- struct SelvaNode *selva_min_node(struct SelvaTypeEntry *type) __attribute__((nonnull));
142
-
143
- /**
144
- * **Example**
145
- * ```c
146
- * for (struct SelvaNode *np = selva_max_node(type); np; np = selva_prev_node(type, np))
147
- * ```
148
- */
149
- SELVA_EXPORT
150
- struct SelvaNode *selva_max_node(struct SelvaTypeEntry *type) __attribute__((nonnull));
151
-
152
- /**
153
- * Get previous node with a lower node id.
154
- */
155
- SELVA_EXPORT
156
- struct SelvaNode *selva_prev_node(struct SelvaTypeEntry *type, struct SelvaNode *node) __attribute__((nonnull));
157
-
158
- /**
159
- * Get next node with higher node id.
160
- */
161
- SELVA_EXPORT
162
- struct SelvaNode *selva_next_node(struct SelvaTypeEntry *type, struct SelvaNode *node) __attribute__((nonnull));
163
-
164
- /**
165
- * Create a new cursor pointing to node.
166
- * If the node is deleted later then the cursor is updated to point to the next
167
- * node using selva_next_node().
168
- */
169
- SELVA_EXPORT
170
- cursor_id_t selva_cursor_new(struct SelvaTypeEntry *type, struct SelvaNode *node) __attribute__((nonnull));
171
-
172
- /**
173
- * Get a pointer to the node from a cursor.
174
- */
175
- SELVA_EXPORT
176
- struct SelvaNode *selva_cursor_get(struct SelvaTypeEntry *type, cursor_id_t id) __attribute__((nonnull));
177
-
178
- /**
179
- * Update a cursor to point to a new node.
180
- */
181
- SELVA_EXPORT
182
- int selva_cursor_update(struct SelvaTypeEntry *type, cursor_id_t id, struct SelvaNode *node) __attribute__((nonnull));
183
-
184
- /**
185
- * Delete a cursor.
186
- */
187
- SELVA_EXPORT
188
- void selva_cursor_del(struct SelvaTypeEntry *type, cursor_id_t id) __attribute__((nonnull));
189
-
190
- /**
191
- * Total count of cursors of type.
192
- */
193
- SELVA_EXPORT
194
- size_t selva_cursor_count(const struct SelvaTypeEntry *type) __attribute__((nonnull));
195
-
196
- /**
197
- * Total count of nodes of type.
198
- */
199
- SELVA_EXPORT
200
- size_t selva_node_count(const struct SelvaTypeEntry *type) __attribute__((nonnull));
201
-
202
- /**
203
- * Get the node id of of node.
204
- */
205
- SELVA_EXPORT
206
- node_id_t selva_get_node_id(const struct SelvaNode *node) __attribute__((nonnull, pure));
207
-
208
- /**
209
- * \addtogroup node_hash
210
- * @{
211
- */
212
-
213
- /**
214
- * Calculate the node hash.
215
- * Update node hash by using a temp hash state allocated earlier.
216
- * @param tmp_hash_state is only used for computation and it's reset before use.
217
- */
218
- SELVA_EXPORT
219
- selva_hash128_t selva_node_hash_update(struct SelvaTypeEntry *type, struct SelvaNode *node, struct XXH3_state_s *tmp_hash_state);
220
-
221
- SELVA_EXPORT
222
- selva_hash128_t selva_node_hash_update2(struct SelvaTypeEntry *type, struct SelvaNode *node);
223
-
224
- SELVA_EXPORT
225
- selva_hash128_t selva_node_hash_range(struct SelvaTypeEntry *type, node_id_t start, node_id_t end) __attribute__((nonnull));
226
-
227
- /**
228
- * @}
229
- */
230
-
231
- /**
232
- * Get the number of aliases under given type.
233
- */
234
- SELVA_EXPORT
235
- size_t selva_alias_count(const struct SelvaAliases *aliases);
236
-
237
- /**
238
- * Set new alias.
239
- * @param name is copied.
240
- */
241
- SELVA_EXPORT
242
- void selva_set_alias(struct SelvaAliases *aliases, node_id_t dest, const char *name_str, size_t name_len);
243
-
244
- /**
245
- * Delete alias by name.
246
- */
247
- SELVA_EXPORT
248
- int selva_del_alias_by_name(struct SelvaAliases *aliases, const char *name_str, size_t name_len);
249
-
250
- /**
251
- * Delete all aliases pointing to dest.
252
- */
253
- SELVA_EXPORT
254
- void selva_del_alias_by_dest(struct SelvaAliases *aliases, node_id_t dest);
255
-
256
- /**
257
- * Get alias by name.
258
- */
259
- SELVA_EXPORT
260
- struct SelvaNode *selva_get_alias(struct SelvaTypeEntry *type, struct SelvaAliases *aliases, const char *name_str, size_t name_len);
261
-
262
- /**
263
- * Get alias by destination id.
264
- * This may not seem very useful but this is actually the way that allows you to
265
- * traverse all aliases to the given node_id by following the `next` pointer or
266
- * by calling selva_get_next_alias().
267
- */
268
- SELVA_EXPORT
269
- const struct SelvaAlias *selva_get_alias_by_dest(struct SelvaAliases *aliases, node_id_t dest);
270
-
271
- SELVA_EXPORT
272
- const struct SelvaAlias *selva_get_next_alias(const struct SelvaAlias *alias);
273
-
274
- SELVA_EXPORT
275
- const char *selva_get_alias_name(const struct SelvaAlias *alias, size_t *len) __attribute__((nonnull(1), pure));
276
-
277
- SELVA_EXPORT
278
- struct SelvaAliases *selva_get_aliases(struct SelvaTypeEntry *type, field_t field);
279
-
280
- /***
281
- * Remove all aliases to the given node_id.
282
- */
283
- SELVA_EXPORT
284
- void selva_remove_all_aliases(struct SelvaTypeEntry *type, node_id_t node_id);