@based/db 0.0.64 → 0.0.67

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 (144) hide show
  1. package/README.md +2 -2
  2. package/dist/lib/darwin_aarch64/include/selva/colvec.h +71 -0
  3. package/dist/lib/darwin_aarch64/include/selva/db.h +33 -4
  4. package/dist/lib/darwin_aarch64/include/selva/fields.h +37 -25
  5. package/dist/lib/darwin_aarch64/include/selva/hll.h +5 -3
  6. package/dist/lib/darwin_aarch64/include/selva/membar.h +23 -0
  7. package/dist/lib/darwin_aarch64/include/selva/types.h +8 -1
  8. package/dist/lib/darwin_aarch64/include/selva/worker_ctx.h +19 -3
  9. package/dist/lib/darwin_aarch64/libdeflate.dylib +0 -0
  10. package/dist/lib/darwin_aarch64/libjemalloc_selva.2.dylib +0 -0
  11. package/dist/lib/darwin_aarch64/libnode-v20.node +0 -0
  12. package/dist/lib/darwin_aarch64/libnode-v21.node +0 -0
  13. package/dist/lib/darwin_aarch64/libnode-v22.node +0 -0
  14. package/dist/lib/darwin_aarch64/libnode-v23.node +0 -0
  15. package/dist/lib/darwin_aarch64/libnode-v24.node +0 -0
  16. package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
  17. package/dist/lib/darwin_aarch64/libxxhash.dylib +0 -0
  18. package/dist/lib/linux_aarch64/include/selva/colvec.h +71 -0
  19. package/dist/lib/linux_aarch64/include/selva/db.h +33 -4
  20. package/dist/lib/linux_aarch64/include/selva/fields.h +37 -25
  21. package/dist/lib/linux_aarch64/include/selva/hll.h +5 -3
  22. package/dist/lib/linux_aarch64/include/selva/membar.h +23 -0
  23. package/dist/lib/linux_aarch64/include/selva/types.h +8 -1
  24. package/dist/lib/linux_aarch64/include/selva/worker_ctx.h +19 -3
  25. package/dist/lib/linux_aarch64/libjemalloc_selva.so.2 +0 -0
  26. package/dist/lib/linux_aarch64/libnode-v20.node +0 -0
  27. package/dist/lib/linux_aarch64/libnode-v21.node +0 -0
  28. package/dist/lib/linux_aarch64/libnode-v22.node +0 -0
  29. package/dist/lib/linux_aarch64/libnode-v23.node +0 -0
  30. package/dist/lib/linux_aarch64/libnode-v24.node +0 -0
  31. package/dist/lib/linux_aarch64/libselva.so +0 -0
  32. package/dist/lib/linux_x86_64/include/selva/colvec.h +71 -0
  33. package/dist/lib/linux_x86_64/include/selva/db.h +33 -4
  34. package/dist/lib/linux_x86_64/include/selva/fields.h +37 -25
  35. package/dist/lib/linux_x86_64/include/selva/hll.h +5 -3
  36. package/dist/lib/linux_x86_64/include/selva/membar.h +23 -0
  37. package/dist/lib/linux_x86_64/include/selva/types.h +8 -1
  38. package/dist/lib/linux_x86_64/include/selva/worker_ctx.h +19 -3
  39. package/dist/lib/linux_x86_64/libjemalloc_selva.so.2 +0 -0
  40. package/dist/lib/linux_x86_64/libnode-v20.node +0 -0
  41. package/dist/lib/linux_x86_64/libnode-v21.node +0 -0
  42. package/dist/lib/linux_x86_64/libnode-v22.node +0 -0
  43. package/dist/lib/linux_x86_64/libnode-v23.node +0 -0
  44. package/dist/lib/linux_x86_64/libnode-v24.node +0 -0
  45. package/dist/lib/linux_x86_64/libselva.so +0 -0
  46. package/dist/src/client/flushModify.d.ts +2 -1
  47. package/dist/src/client/flushModify.js +12 -4
  48. package/dist/src/client/modify/create.js +11 -0
  49. package/dist/src/client/modify/delete.js +3 -0
  50. package/dist/src/client/modify/fixed.js +1 -1
  51. package/dist/src/client/modify/modify.js +2 -2
  52. package/dist/src/client/modify/setCursor.d.ts +2 -1
  53. package/dist/src/client/query/BasedDbQuery.d.ts +10 -4
  54. package/dist/src/client/query/BasedDbQuery.js +114 -6
  55. package/dist/src/client/query/aggregates/aggregation.js +24 -11
  56. package/dist/src/client/query/aggregates/types.d.ts +22 -2
  57. package/dist/src/client/query/aggregates/types.js +34 -1
  58. package/dist/src/client/query/display.js +8 -2
  59. package/dist/src/client/query/filter/createVariableFilterBuffer.d.ts +2 -3
  60. package/dist/src/client/query/filter/createVariableFilterBuffer.js +20 -7
  61. package/dist/src/client/query/filter/filter.js +13 -3
  62. package/dist/src/client/query/filter/primitiveFilter.d.ts +1 -2
  63. package/dist/src/client/query/include/props.js +18 -2
  64. package/dist/src/client/query/include/toBuffer.js +11 -3
  65. package/dist/src/client/query/include/walk.js +5 -1
  66. package/dist/src/client/query/queryDef.js +4 -1
  67. package/dist/src/client/query/read/read.js +52 -22
  68. package/dist/src/client/query/registerQuery.js +1 -0
  69. package/dist/src/client/query/search/index.d.ts +1 -1
  70. package/dist/src/client/query/search/index.js +21 -7
  71. package/dist/src/client/query/sort.d.ts +1 -1
  72. package/dist/src/client/query/toByteCode/default.d.ts +1 -1
  73. package/dist/src/client/query/toByteCode/default.js +0 -2
  74. package/dist/src/client/query/toByteCode/toBuffer.js +0 -7
  75. package/dist/src/client/query/types.d.ts +16 -5
  76. package/dist/src/client/query/validation.d.ts +3 -0
  77. package/dist/src/client/query/validation.js +34 -2
  78. package/dist/src/client/xxHash64.d.ts +1 -1
  79. package/dist/src/index.d.ts +1 -2
  80. package/dist/src/index.js +0 -1
  81. package/dist/src/native.d.ts +7 -4
  82. package/dist/src/native.js +23 -13
  83. package/dist/src/server/IoWorker.d.ts +8 -0
  84. package/dist/src/server/IoWorker.js +39 -0
  85. package/dist/src/server/QueryWorker.d.ts +8 -0
  86. package/dist/src/server/QueryWorker.js +26 -0
  87. package/dist/src/server/blocks.d.ts +24 -0
  88. package/dist/src/server/blocks.js +112 -0
  89. package/dist/src/server/dbHash.d.ts +1 -1
  90. package/dist/src/server/index.d.ts +10 -16
  91. package/dist/src/server/index.js +39 -15
  92. package/dist/src/server/migrate/index.d.ts +5 -0
  93. package/dist/src/server/migrate/index.js +11 -7
  94. package/dist/src/server/migrate/worker.js +3 -0
  95. package/dist/src/server/save.d.ts +8 -6
  96. package/dist/src/server/save.js +34 -78
  97. package/dist/src/server/schema.js +6 -5
  98. package/dist/src/server/start.js +57 -60
  99. package/dist/src/server/tree.d.ts +24 -13
  100. package/dist/src/server/tree.js +95 -66
  101. package/dist/src/server/workers/DbWorker.d.ts +17 -0
  102. package/dist/src/server/{DbWorker.js → workers/DbWorker.js} +15 -17
  103. package/dist/src/server/workers/io_worker.js +39 -0
  104. package/dist/src/server/workers/io_worker_types.d.ts +12 -0
  105. package/dist/src/server/workers/io_worker_types.js +2 -0
  106. package/dist/src/server/workers/query_worker.d.ts +1 -0
  107. package/dist/src/server/workers/query_worker.js +4 -0
  108. package/dist/src/server/workers/worker.d.ts +1 -0
  109. package/dist/src/server/workers/worker.js +41 -0
  110. package/dist/src/shared/Emitter.d.ts +1 -0
  111. package/dist/src/types.d.ts +1 -1
  112. package/dist/src/types.js +1 -1
  113. package/package.json +3 -3
  114. package/dist/lib/darwin_aarch64/include/selva/find.h +0 -47
  115. package/dist/lib/darwin_aarch64/include/selva/history.h +0 -64
  116. package/dist/lib/darwin_aarch64/include/selva/queue_r.h +0 -190
  117. package/dist/lib/darwin_aarch64/include/selva/traverse.h +0 -65
  118. package/dist/lib/linux_aarch64/include/selva/find.h +0 -47
  119. package/dist/lib/linux_aarch64/include/selva/history.h +0 -64
  120. package/dist/lib/linux_aarch64/include/selva/queue_r.h +0 -190
  121. package/dist/lib/linux_aarch64/include/selva/traverse.h +0 -65
  122. package/dist/lib/linux_x86_64/include/selva/find.h +0 -47
  123. package/dist/lib/linux_x86_64/include/selva/history.h +0 -64
  124. package/dist/lib/linux_x86_64/include/selva/queue_r.h +0 -190
  125. package/dist/lib/linux_x86_64/include/selva/traverse.h +0 -65
  126. package/dist/src/client/query/serialize.d.ts +0 -4
  127. package/dist/src/client/query/serialize.js +0 -26
  128. package/dist/src/server/DbWorker.d.ts +0 -13
  129. package/dist/src/server/csmt/draw-dot.d.ts +0 -4
  130. package/dist/src/server/csmt/draw-dot.js +0 -38
  131. package/dist/src/server/csmt/index.d.ts +0 -4
  132. package/dist/src/server/csmt/index.js +0 -5
  133. package/dist/src/server/csmt/match.d.ts +0 -7
  134. package/dist/src/server/csmt/match.js +0 -10
  135. package/dist/src/server/csmt/memebership-proof.d.ts +0 -7
  136. package/dist/src/server/csmt/memebership-proof.js +0 -122
  137. package/dist/src/server/csmt/tree-utils.d.ts +0 -6
  138. package/dist/src/server/csmt/tree-utils.js +0 -33
  139. package/dist/src/server/csmt/tree.d.ts +0 -3
  140. package/dist/src/server/csmt/tree.js +0 -270
  141. package/dist/src/server/csmt/types.d.ts +0 -46
  142. package/dist/src/server/csmt/types.js +0 -2
  143. package/dist/src/server/worker.js +0 -33
  144. /package/dist/src/server/{worker.d.ts → workers/io_worker.d.ts} +0 -0
@@ -46,7 +46,7 @@ struct SelvaNodeReferences {
46
46
  };
47
47
 
48
48
  struct SelvaNodeWeakReference {
49
- /* THe type can be found from the schema. */
49
+ /* The type can be found from the schema. */
50
50
  #if 0
51
51
  node_type_t dst_type;
52
52
  #endif
@@ -99,11 +99,15 @@ __purefn
99
99
  #endif
100
100
  size_t selva_fields_get_data_size(const struct SelvaFieldSchema *fs);
101
101
 
102
+ SELVA_EXPORT
102
103
  #if __has_c_attribute(reproducible)
103
104
  [[reproducible]]
104
105
  #endif
105
106
  void *selva_fields_nfo2p(struct SelvaFields *fields, const struct SelvaFieldInfo *nfo);
106
107
 
108
+ SELVA_EXPORT
109
+ struct SelvaFields *selva_fields_node2fields(struct SelvaNode *node);
110
+
107
111
  void selva_fields_ensure_ref_meta(
108
112
  struct SelvaDb *db,
109
113
  struct SelvaNode *node,
@@ -118,19 +122,7 @@ SELVA_EXPORT
118
122
  int selva_fields_set(
119
123
  struct SelvaNode *node,
120
124
  const struct SelvaFieldSchema *fs,
121
- const void *value, size_t len);
122
-
123
- /**
124
- * Set field value by a `fields` pointer.
125
- * @param fields can be either `node->fields` or any other `fields` structure
126
- * associated with the given node (currently edge).
127
- */
128
- SELVA_EXPORT
129
- int fields_set2(
130
- struct SelvaNode *node,
131
- const struct SelvaFieldSchema *fs,
132
- struct SelvaFields *fields,
133
- const void *value, size_t len);
125
+ const void *value, size_t len) __attribute__((deprecated));
134
126
 
135
127
  SELVA_EXPORT
136
128
  int selva_fields_get_mutable_string(
@@ -163,10 +155,6 @@ struct selva_string *selva_fields_ensure_string2(
163
155
 
164
156
  /**
165
157
  * Set reference to fields.
166
- * @param dirty_nodes returns the nodes that were changed, apart from src and dst.
167
- * [n].id = 0 = nil;
168
- * [0] = the node src was pointing to previously (same type as dst);
169
- * [1] = the node dst was pointing to previously (same type as src).
170
158
  */
171
159
  SELVA_EXPORT
172
160
  int selva_fields_reference_set(
@@ -175,8 +163,9 @@ int selva_fields_reference_set(
175
163
  const struct SelvaFieldSchema *fs_src,
176
164
  struct SelvaNode * restrict dst,
177
165
  struct SelvaNodeReference **ref_out,
178
- node_id_t dirty_nodes[static 2])
179
- __attribute__((access(write_only, 5), access(write_only, 6)));
166
+ selva_dirty_node_cb_t dirty_cb,
167
+ void *dirty_ctx);
168
+ // __attribute__((access(write_only, 5), access(write_only, 6)));
180
169
 
181
170
  /**
182
171
  * @param index 0 = first; -1 = last.
@@ -241,7 +230,7 @@ int selva_fields_set_reference_meta(
241
230
  struct SelvaNode *node,
242
231
  struct SelvaNodeReference *ref,
243
232
  const struct EdgeFieldConstraint *efc,
244
- field_t field,
233
+ const struct SelvaFieldSchema *efs,
245
234
  const void *value, size_t len);
246
235
 
247
236
  SELVA_EXPORT
@@ -250,7 +239,7 @@ int selva_fields_get_reference_meta_mutable_string(
250
239
  struct SelvaNode *node,
251
240
  struct SelvaNodeReference *ref,
252
241
  const struct EdgeFieldConstraint *efc,
253
- field_t field,
242
+ const struct SelvaFieldSchema *efs,
254
243
  size_t len,
255
244
  struct selva_string **s);
256
245
 
@@ -267,7 +256,6 @@ SELVA_EXPORT
267
256
  int selva_fields_set_string(
268
257
  struct SelvaNode *node,
269
258
  const struct SelvaFieldSchema *fs,
270
- struct SelvaFieldInfo *nfo,
271
259
  const char *str,
272
260
  size_t len);
273
261
 
@@ -304,6 +292,24 @@ int selva_fields_get_text(
304
292
  const char **str,
305
293
  size_t *len);
306
294
 
295
+ SELVA_EXPORT
296
+ int selva_fields_set_micro_buffer(struct SelvaFields *fields, const struct SelvaFieldSchema *fs, const void *value, size_t len);
297
+
298
+ SELVA_EXPORT
299
+ int selva_fields_set_micro_buffer2(struct SelvaNode *node, const struct SelvaFieldSchema *fs, const void *value, size_t len);
300
+
301
+ SELVA_EXPORT
302
+ int selva_fields_set_weak_reference(struct SelvaNode *node, const struct SelvaFieldSchema *fs, node_id_t dst);
303
+
304
+ SELVA_EXPORT
305
+ int selva_fields_set_weak_reference2(struct SelvaFields *fields, const struct SelvaFieldSchema *fs, node_id_t dst);
306
+
307
+ SELVA_EXPORT
308
+ int selva_fields_set_weak_references2(struct SelvaFields *fields, const struct SelvaFieldSchema *fs, node_id_t dst[], size_t nr_dsts);
309
+
310
+ SELVA_EXPORT
311
+ int selva_fields_set_weak_references(struct SelvaNode *node, const struct SelvaFieldSchema *fs, node_id_t dst[], size_t nr_dsts);
312
+
307
313
  SELVA_EXPORT
308
314
  struct SelvaNodeReference *selva_fields_get_reference(struct SelvaDb *db, struct SelvaNode *node, const struct SelvaFieldSchema *fs)
309
315
  __attribute__((nonnull));
@@ -313,11 +319,11 @@ struct SelvaNodeReferences *selva_fields_get_references(struct SelvaDb *db, stru
313
319
  __attribute__((nonnull));
314
320
 
315
321
  SELVA_EXPORT
316
- struct SelvaNodeWeakReference selva_fields_get_weak_reference(struct SelvaDb *db, struct SelvaFields *fields, field_t field)
322
+ struct SelvaNodeWeakReference selva_fields_get_weak_reference(struct SelvaFields *fields, field_t field)
317
323
  __attribute__((nonnull));
318
324
 
319
325
  SELVA_EXPORT
320
- struct SelvaNodeWeakReferences selva_fields_get_weak_references(struct SelvaDb *db, struct SelvaFields *fields, field_t field)
326
+ struct SelvaNodeWeakReferences selva_fields_get_weak_references(struct SelvaFields *fields, field_t field)
321
327
  __attribute__((nonnull));
322
328
 
323
329
  SELVA_EXPORT
@@ -339,6 +345,9 @@ SELVA_EXPORT
339
345
  struct selva_string *selva_fields_get_selva_string(struct SelvaNode *node, const struct SelvaFieldSchema *fs)
340
346
  __attribute__((nonnull));
341
347
 
348
+ SELVA_EXPORT
349
+ struct SelvaFieldInfo *selva_field_get_nfo(struct SelvaFields *fields, const struct SelvaFieldSchema *fs);
350
+
342
351
  SELVA_EXPORT
343
352
  struct SelvaFieldsPointer selva_fields_get_raw2(struct SelvaFields *fields, const struct SelvaFieldSchema *fs)
344
353
  __attribute__((nonnull));
@@ -375,6 +384,9 @@ SELVA_EXPORT
375
384
  void selva_fields_init(const struct SelvaFieldsSchema *schema, struct SelvaFields *fields)
376
385
  __attribute__((nonnull));
377
386
 
387
+ void selva_fields_init_node(struct SelvaTypeEntry *te, struct SelvaNode *node)
388
+ __attribute__((nonnull));
389
+
378
390
  /**
379
391
  * Destroy all fields of a node.
380
392
  */
@@ -17,10 +17,12 @@ void hll_add(struct selva_string *hllss, uint64_t element);
17
17
  SELVA_EXPORT
18
18
  uint8_t *hll_count(struct selva_string *hllss);
19
19
  SELVA_EXPORT
20
- struct selva_string hll_array_union(struct selva_string *hll_array, size_t count);
20
+ void hll_array_union(struct selva_string *res, struct selva_string *hll_array, size_t count);
21
+ SELVA_EXPORT
22
+ void hll_union(char*, size_t, const char*, size_t);
21
23
 
22
24
  // size_t actual_cols[13] = { 79, 159, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200 };
23
- // float raw_estimate_data[13][200] =
25
+ // float raw_estimate_data[13][200] =
24
26
  // {
25
27
  // // precision 4
26
28
  // { 11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722,17.4636, 18.0396, 18.6766, 19.3566, 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766,24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, 30.2926, 31.0664, 31.9996,32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966,41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506,51.4996, 52.3824, 53.3078, 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482,61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, 67.1806, 68.0594, 68.8446, 69.7928,70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394, },
@@ -78,4 +80,4 @@ struct selva_string hll_array_union(struct selva_string *hll_array, size_t count
78
80
  // // precision 16
79
81
  // { 47270, 46423.3584, 45585.7074, 44757.152, 43938.8416, 43130.9514, 42330.03, 41540.407,40759.6348, 39988.206, 39226.5144, 38473.2096, 37729.795, 36997.268, 36272.6448, 35558.665,34853.0248, 34157.4472, 33470.5204, 32793.5742, 32127.0194, 31469.4182, 30817.6136,30178.6968, 29546.8908, 28922.8544, 28312.271, 27707.0924, 27114.0326, 26526.692, 25948.6336,25383.7826, 24823.5998, 24272.2974, 23732.2572, 23201.4976, 22674.2796, 22163.6336, 21656.515,21161.7362, 20669.9368, 20189.4424, 19717.3358, 19256.3744, 18795.9638, 18352.197, 17908.5738,17474.391, 17052.918, 16637.2236, 16228.4602, 15823.3474, 15428.6974, 15043.0284, 14667.6278,14297.4588, 13935.2882, 13578.5402, 13234.6032, 12882.1578, 12548.0728, 12219.231, 11898.0072,11587.2626, 11279.9072, 10973.5048, 10678.5186, 10392.4876, 10105.2556, 9825.766, 9562.5444,9294.2222, 9038.2352, 8784.848, 8533.2644, 8301.7776, 8058.30859999999, 7822.94579999999,7599.11319999999, 7366.90779999999, 7161.217, 6957.53080000001, 6736.212, 6548.21220000001,6343.06839999999, 6156.28719999999, 5975.15419999999, 5791.75719999999, 5621.32019999999,5451.66, 5287.61040000001, 5118.09479999999, 4957.288, 4798.4246, 4662.17559999999,4512.05900000001, 4364.68539999999, 4220.77720000001, 4082.67259999999, 3957.19519999999,3842.15779999999, 3699.3328, 3583.01180000001, 3473.8964, 3338.66639999999, 3233.55559999999,3117.799, 3008.111, 2909.69140000001, 2814.86499999999, 2719.46119999999, 2624.742,2532.46979999999, 2444.7886, 2370.1868, 2272.45259999999, 2196.19260000001, 2117.90419999999,2023.2972, 1969.76819999999, 1885.58979999999, 1833.2824, 1733.91200000001, 1682.54920000001,1604.57980000001, 1556.11240000001, 1491.3064, 1421.71960000001, 1371.22899999999, 1322.1324,1264.7892, 1196.23920000001, 1143.8474, 1088.67240000001, 1073.60380000001, 1023.11660000001,959.036400000012, 927.433199999999, 906.792799999996, 853.433599999989, 841.873800000001,791.1054, 756.899999999994, 704.343200000003, 672.495599999995, 622.790399999998,611.254799999995, 567.283200000005, 519.406599999988, 519.188400000014, 495.312800000014,451.350799999986, 443.973399999988, 431.882199999993, 392.027000000002, 380.924200000009,345.128999999986, 298.901400000002, 287.771999999997, 272.625, 247.253000000026,222.490600000019, 223.590000000026, 196.407599999977, 176.425999999978, 134.725199999986,132.4804, 110.445599999977, 86.7939999999944, 56.7038000000175, 64.915399999998,38.3726000000024, 37.1606000000029, 46.170999999973, 49.1716000000015, 15.3362000000197,6.71639999997569,-34.8185999999987,-39.4476000000141, 12.6830000000191,-12.3331999999937,-50.6565999999875,-59.9538000000175,-65.1054000000004,-70.7576000000117,-106.325200000021,-126.852200000023,-110.227599999984,-132.885999999999,-113.897200000007,-142.713800000027,-151.145399999979,-150.799200000009,-177.756200000003,-156.036399999983,-182.735199999996,-177.259399999981,-198.663600000029,-174.577600000019,-193.84580000001, },
80
82
  // };
81
- #endif
83
+ #endif
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2025 SAULX
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ #include "selva/_export.h"
6
+
7
+ /**
8
+ * Read memory barrier.
9
+ * Call this function before read in case another thread has potentially
10
+ * written to the memory addresses the current thread is going to access.
11
+ */
12
+ SELVA_EXPORT
13
+ __attribute__((no_reorder))
14
+ void membar_sync_read(void);
15
+
16
+ /**
17
+ * Write memory barrier.
18
+ * Call this function after write to memory when another thread is expected to
19
+ * read the written data.
20
+ */
21
+ SELVA_EXPORT
22
+ __attribute__((no_reorder))
23
+ void membar_sync_write(void);
@@ -32,6 +32,7 @@ enum SelvaFieldType {
32
32
  SELVA_FIELD_TYPE_WEAK_REFERENCES = 7,
33
33
  SELVA_FIELD_TYPE_ALIAS = 8,
34
34
  SELVA_FIELD_TYPE_ALIASES = 9,
35
+ SELVA_FIELD_TYPE_COLVEC = 10,
35
36
  } __packed;
36
37
 
37
38
  struct EdgeFieldConstraint {
@@ -71,6 +72,11 @@ struct SelvaFieldSchema {
71
72
  uint16_t len;
72
73
  } smb; /*!< SELVA_FIELD_TYPE_MICRO_BUFFER */
73
74
  size_t alias_index; /*!< Index in aliases for SELVA_FIELD_TYPE_ALIAS and SELVA_FIELD_TYPE_ALIASES. */
75
+ struct {
76
+ uint16_t vec_len; /*!< Length of a single vector. */
77
+ uint16_t comp_size; /*!< Component size in the vector. */
78
+ field_t index; /*!< Index in te->col_fields.colvec.v. */
79
+ } colvec;
74
80
  };
75
81
  } __designated_init;
76
82
 
@@ -82,11 +88,12 @@ struct SelvaFieldsSchema {
82
88
  size_t len;
83
89
  size_t fixed_data_size;
84
90
  } field_map_template;
85
- struct SelvaFieldSchema field_schemas[] __counted_by(nr_fields);
91
+ struct SelvaFieldSchema field_schemas[255];
86
92
  };
87
93
 
88
94
  struct SelvaNodeSchema {
89
95
  size_t nr_aliases; /*!< Number of alias fields in this type. */
96
+ size_t nr_colvecs; /*!< Number of columnar vector fields. */
90
97
  struct SelvaFieldsSchema fields_schema;
91
98
  /* Nothing must be put after this line. */
92
99
  };
@@ -1,13 +1,29 @@
1
1
  /*
2
- * Copyright (c) 2024 SAULX
2
+ * Copyright (c) 2024-2025 SAULX
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
  #pragma once
6
6
 
7
7
  #include "selva/_export.h"
8
+ #include "libdeflate.h"
8
9
 
9
10
  SELVA_EXPORT
10
- void worker_ctx_init();
11
+ void worker_ctx_init(void);
11
12
 
12
13
  SELVA_EXPORT
13
- void worker_ctx_deinit();
14
+ void worker_ctx_deinit(void);
15
+
16
+ SELVA_EXPORT
17
+ enum libdeflate_result worker_ctx_libdeflate_decompress(
18
+ const void *in, size_t in_nbytes,
19
+ void *out, size_t out_nbytes_avail,
20
+ size_t *actual_out_nbytes_ret);
21
+
22
+ SELVA_EXPORT
23
+ enum libdeflate_result worker_ctx_libdeflate_decompress_stream(
24
+ const char *in_buf, size_t in_len,
25
+ libdeflate_decompress_stream_cb_t cb, void *ctx,
26
+ int *result);
27
+
28
+ SELVA_EXPORT
29
+ bool worker_ctx_libdeflate_block_state_growbuf(void);
Binary file
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Copyright (c) 2025 SAULX
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ #pragma once
6
+
7
+ #include <stddef.h>
8
+ #include <stdint.h>
9
+ #include "selva/types.h"
10
+ #include "selva/selva_hash128.h"
11
+ #include "selva/_export.h"
12
+
13
+ struct SelvaColvec {
14
+ field_t field;
15
+ uint16_t vec_size;
16
+ size_t slab_size; /* Size of each slab in v. */
17
+
18
+ /**
19
+ * Array of pointers to vector slabs.
20
+ * te->blocks->len number of pointers to vector blocks each containing
21
+ * te->blocks->block_capacity vectors.
22
+ */
23
+ void **v;
24
+ };
25
+
26
+ /**
27
+ * Initialize colvec record keeping under te->col_fields.
28
+ */
29
+ void colvec_init_te(struct SelvaTypeEntry *te);
30
+
31
+ /**
32
+ * Deinitialize colvec record keeping and col slabs under te->col_fields.
33
+ */
34
+ void colvec_deinit_te(struct SelvaTypeEntry *te);
35
+
36
+ /**
37
+ * Initialize a slab at block_i if not already Initialized.
38
+ */
39
+ void *colvec_init_slab(struct SelvaColvec *colvec, block_id_t block_i);
40
+
41
+ /**
42
+ * Initialize all columnar fields of node.
43
+ * This function will also initialize the slab(s) if it's not allocated.
44
+ */
45
+ void colvec_init_node(struct SelvaTypeEntry *te, struct SelvaNode *node);
46
+
47
+ /**
48
+ * Compute the hash for a node_id in colvec.
49
+ */
50
+ void colvec_hash_update(struct SelvaTypeEntry *te, node_id_t node_id, struct SelvaColvec *colvec, selva_hash_state_t *hash_state);
51
+
52
+ /**
53
+ * Get the whole column for fs.
54
+ */
55
+ SELVA_EXPORT
56
+ struct SelvaColvec *colvec_get(struct SelvaTypeEntry *te, const struct SelvaFieldSchema *fs);
57
+
58
+ /**
59
+ * Get a single vector in a colvec field by node_id.
60
+ */
61
+ SELVA_EXPORT
62
+ void *colvec_get_vec(struct SelvaTypeEntry *te, node_id_t node_id, const struct SelvaFieldSchema *fs);
63
+
64
+ /**
65
+ * Set a single vector in a colvec field.
66
+ */
67
+ SELVA_EXPORT
68
+ void colvec_set_vec(struct SelvaTypeEntry *te, node_id_t node_id, const struct SelvaFieldSchema *fs, const void *vec);
69
+
70
+ SELVA_EXPORT
71
+ int colvec_foreach(struct SelvaTypeEntry *te, const struct SelvaFieldSchema *fs, node_id_t start, uint32_t len, void (*cb)(node_id_t node_id, void *vec, void *arg), void *arg);
@@ -42,24 +42,24 @@ SELVA_EXPORT
42
42
  int selva_dump_save_common(struct SelvaDb *db, const char *filename) __attribute__((nonnull));
43
43
 
44
44
  /**
45
- * Save a range of nodes from te.
45
+ * Save a nodes block starting from start.
46
46
  */
47
47
  SELVA_EXPORT
48
- 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));
48
+ int selva_dump_save_block(struct SelvaDb *db, struct SelvaTypeEntry *te, const char *filename, node_id_t start, selva_hash128_t *range_hash_out) __attribute__((nonnull));
49
49
 
50
50
  /**
51
51
  * **Usage:**
52
52
  * ```c
53
53
  * struct SelvaDb *db = selva_db_create();
54
54
  * selva_dump_load_common(db, filename_common);
55
- * selva_dump_load_range(db, filename_range_n);
55
+ * selva_dump_load_block(db, filename_range_n);
56
56
  * ```
57
57
  */
58
58
  SELVA_EXPORT
59
59
  int selva_dump_load_common(struct SelvaDb *db, const char *filename, char *errlog_buf, size_t errlog_size) __attribute__((nonnull));
60
60
 
61
61
  SELVA_EXPORT
62
- int selva_dump_load_range(struct SelvaDb *db, const char *filename, char *errlog_buf, size_t errlog_size) __attribute__((nonnull));
62
+ int selva_dump_load_block(struct SelvaDb *db, const char *filename, char *errlog_buf, size_t errlog_size) __attribute__((nonnull));
63
63
 
64
64
  /**
65
65
  * Find a type by type id.
@@ -83,6 +83,32 @@ inline block_id_t selva_get_block_capacity(const struct SelvaTypeEntry *te)
83
83
  ;
84
84
  #endif
85
85
 
86
+ inline block_id_t selva_node_id2block_i3(block_id_t block_capacity, node_id_t node_id)
87
+ {
88
+ assert(node_id > 0);
89
+ return ((node_id - 1) - ((node_id - 1) % block_capacity)) / block_capacity;
90
+ }
91
+
92
+ SELVA_EXPORT
93
+ inline block_id_t selva_node_id2block_i(const struct SelvaTypeBlocks *blocks, node_id_t node_id)
94
+ #ifndef __zig
95
+ {
96
+ return selva_node_id2block_i3(blocks->block_capacity, node_id);
97
+ }
98
+ #else
99
+ ;
100
+ #endif
101
+
102
+ SELVA_EXPORT
103
+ inline block_id_t selva_node_id2block_i2(const struct SelvaTypeEntry *te, node_id_t node_id)
104
+ #ifndef __zig
105
+ {
106
+ return selva_node_id2block_i(te->blocks, node_id);
107
+ }
108
+ #else
109
+ ;
110
+ #endif
111
+
86
112
  /**
87
113
  * Get the node schema for type.
88
114
  */
@@ -215,6 +241,9 @@ void selva_db_expire_tick(struct SelvaDb *db, selva_dirty_node_cb_t dirty_cb, vo
215
241
  SELVA_EXPORT
216
242
  void selva_del_node(struct SelvaDb *db, struct SelvaTypeEntry *type, struct SelvaNode *node, selva_dirty_node_cb_t dirty_cb, void *dirty_ctx) __attribute__((nonnull(1, 2, 3)));
217
243
 
244
+ SELVA_EXPORT
245
+ void selva_del_block(struct SelvaDb *db, struct SelvaTypeEntry *te, node_id_t start);
246
+
218
247
  /**
219
248
  * Get a node by id.
220
249
  */
@@ -46,7 +46,7 @@ struct SelvaNodeReferences {
46
46
  };
47
47
 
48
48
  struct SelvaNodeWeakReference {
49
- /* THe type can be found from the schema. */
49
+ /* The type can be found from the schema. */
50
50
  #if 0
51
51
  node_type_t dst_type;
52
52
  #endif
@@ -99,11 +99,15 @@ __purefn
99
99
  #endif
100
100
  size_t selva_fields_get_data_size(const struct SelvaFieldSchema *fs);
101
101
 
102
+ SELVA_EXPORT
102
103
  #if __has_c_attribute(reproducible)
103
104
  [[reproducible]]
104
105
  #endif
105
106
  void *selva_fields_nfo2p(struct SelvaFields *fields, const struct SelvaFieldInfo *nfo);
106
107
 
108
+ SELVA_EXPORT
109
+ struct SelvaFields *selva_fields_node2fields(struct SelvaNode *node);
110
+
107
111
  void selva_fields_ensure_ref_meta(
108
112
  struct SelvaDb *db,
109
113
  struct SelvaNode *node,
@@ -118,19 +122,7 @@ SELVA_EXPORT
118
122
  int selva_fields_set(
119
123
  struct SelvaNode *node,
120
124
  const struct SelvaFieldSchema *fs,
121
- const void *value, size_t len);
122
-
123
- /**
124
- * Set field value by a `fields` pointer.
125
- * @param fields can be either `node->fields` or any other `fields` structure
126
- * associated with the given node (currently edge).
127
- */
128
- SELVA_EXPORT
129
- int fields_set2(
130
- struct SelvaNode *node,
131
- const struct SelvaFieldSchema *fs,
132
- struct SelvaFields *fields,
133
- const void *value, size_t len);
125
+ const void *value, size_t len) __attribute__((deprecated));
134
126
 
135
127
  SELVA_EXPORT
136
128
  int selva_fields_get_mutable_string(
@@ -163,10 +155,6 @@ struct selva_string *selva_fields_ensure_string2(
163
155
 
164
156
  /**
165
157
  * Set reference to fields.
166
- * @param dirty_nodes returns the nodes that were changed, apart from src and dst.
167
- * [n].id = 0 = nil;
168
- * [0] = the node src was pointing to previously (same type as dst);
169
- * [1] = the node dst was pointing to previously (same type as src).
170
158
  */
171
159
  SELVA_EXPORT
172
160
  int selva_fields_reference_set(
@@ -175,8 +163,9 @@ int selva_fields_reference_set(
175
163
  const struct SelvaFieldSchema *fs_src,
176
164
  struct SelvaNode * restrict dst,
177
165
  struct SelvaNodeReference **ref_out,
178
- node_id_t dirty_nodes[static 2])
179
- __attribute__((access(write_only, 5), access(write_only, 6)));
166
+ selva_dirty_node_cb_t dirty_cb,
167
+ void *dirty_ctx);
168
+ // __attribute__((access(write_only, 5), access(write_only, 6)));
180
169
 
181
170
  /**
182
171
  * @param index 0 = first; -1 = last.
@@ -241,7 +230,7 @@ int selva_fields_set_reference_meta(
241
230
  struct SelvaNode *node,
242
231
  struct SelvaNodeReference *ref,
243
232
  const struct EdgeFieldConstraint *efc,
244
- field_t field,
233
+ const struct SelvaFieldSchema *efs,
245
234
  const void *value, size_t len);
246
235
 
247
236
  SELVA_EXPORT
@@ -250,7 +239,7 @@ int selva_fields_get_reference_meta_mutable_string(
250
239
  struct SelvaNode *node,
251
240
  struct SelvaNodeReference *ref,
252
241
  const struct EdgeFieldConstraint *efc,
253
- field_t field,
242
+ const struct SelvaFieldSchema *efs,
254
243
  size_t len,
255
244
  struct selva_string **s);
256
245
 
@@ -267,7 +256,6 @@ SELVA_EXPORT
267
256
  int selva_fields_set_string(
268
257
  struct SelvaNode *node,
269
258
  const struct SelvaFieldSchema *fs,
270
- struct SelvaFieldInfo *nfo,
271
259
  const char *str,
272
260
  size_t len);
273
261
 
@@ -304,6 +292,24 @@ int selva_fields_get_text(
304
292
  const char **str,
305
293
  size_t *len);
306
294
 
295
+ SELVA_EXPORT
296
+ int selva_fields_set_micro_buffer(struct SelvaFields *fields, const struct SelvaFieldSchema *fs, const void *value, size_t len);
297
+
298
+ SELVA_EXPORT
299
+ int selva_fields_set_micro_buffer2(struct SelvaNode *node, const struct SelvaFieldSchema *fs, const void *value, size_t len);
300
+
301
+ SELVA_EXPORT
302
+ int selva_fields_set_weak_reference(struct SelvaNode *node, const struct SelvaFieldSchema *fs, node_id_t dst);
303
+
304
+ SELVA_EXPORT
305
+ int selva_fields_set_weak_reference2(struct SelvaFields *fields, const struct SelvaFieldSchema *fs, node_id_t dst);
306
+
307
+ SELVA_EXPORT
308
+ int selva_fields_set_weak_references2(struct SelvaFields *fields, const struct SelvaFieldSchema *fs, node_id_t dst[], size_t nr_dsts);
309
+
310
+ SELVA_EXPORT
311
+ int selva_fields_set_weak_references(struct SelvaNode *node, const struct SelvaFieldSchema *fs, node_id_t dst[], size_t nr_dsts);
312
+
307
313
  SELVA_EXPORT
308
314
  struct SelvaNodeReference *selva_fields_get_reference(struct SelvaDb *db, struct SelvaNode *node, const struct SelvaFieldSchema *fs)
309
315
  __attribute__((nonnull));
@@ -313,11 +319,11 @@ struct SelvaNodeReferences *selva_fields_get_references(struct SelvaDb *db, stru
313
319
  __attribute__((nonnull));
314
320
 
315
321
  SELVA_EXPORT
316
- struct SelvaNodeWeakReference selva_fields_get_weak_reference(struct SelvaDb *db, struct SelvaFields *fields, field_t field)
322
+ struct SelvaNodeWeakReference selva_fields_get_weak_reference(struct SelvaFields *fields, field_t field)
317
323
  __attribute__((nonnull));
318
324
 
319
325
  SELVA_EXPORT
320
- struct SelvaNodeWeakReferences selva_fields_get_weak_references(struct SelvaDb *db, struct SelvaFields *fields, field_t field)
326
+ struct SelvaNodeWeakReferences selva_fields_get_weak_references(struct SelvaFields *fields, field_t field)
321
327
  __attribute__((nonnull));
322
328
 
323
329
  SELVA_EXPORT
@@ -339,6 +345,9 @@ SELVA_EXPORT
339
345
  struct selva_string *selva_fields_get_selva_string(struct SelvaNode *node, const struct SelvaFieldSchema *fs)
340
346
  __attribute__((nonnull));
341
347
 
348
+ SELVA_EXPORT
349
+ struct SelvaFieldInfo *selva_field_get_nfo(struct SelvaFields *fields, const struct SelvaFieldSchema *fs);
350
+
342
351
  SELVA_EXPORT
343
352
  struct SelvaFieldsPointer selva_fields_get_raw2(struct SelvaFields *fields, const struct SelvaFieldSchema *fs)
344
353
  __attribute__((nonnull));
@@ -375,6 +384,9 @@ SELVA_EXPORT
375
384
  void selva_fields_init(const struct SelvaFieldsSchema *schema, struct SelvaFields *fields)
376
385
  __attribute__((nonnull));
377
386
 
387
+ void selva_fields_init_node(struct SelvaTypeEntry *te, struct SelvaNode *node)
388
+ __attribute__((nonnull));
389
+
378
390
  /**
379
391
  * Destroy all fields of a node.
380
392
  */
@@ -17,10 +17,12 @@ void hll_add(struct selva_string *hllss, uint64_t element);
17
17
  SELVA_EXPORT
18
18
  uint8_t *hll_count(struct selva_string *hllss);
19
19
  SELVA_EXPORT
20
- struct selva_string hll_array_union(struct selva_string *hll_array, size_t count);
20
+ void hll_array_union(struct selva_string *res, struct selva_string *hll_array, size_t count);
21
+ SELVA_EXPORT
22
+ void hll_union(char*, size_t, const char*, size_t);
21
23
 
22
24
  // size_t actual_cols[13] = { 79, 159, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200 };
23
- // float raw_estimate_data[13][200] =
25
+ // float raw_estimate_data[13][200] =
24
26
  // {
25
27
  // // precision 4
26
28
  // { 11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722,17.4636, 18.0396, 18.6766, 19.3566, 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766,24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, 30.2926, 31.0664, 31.9996,32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966,41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506,51.4996, 52.3824, 53.3078, 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482,61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, 67.1806, 68.0594, 68.8446, 69.7928,70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394, },
@@ -78,4 +80,4 @@ struct selva_string hll_array_union(struct selva_string *hll_array, size_t count
78
80
  // // precision 16
79
81
  // { 47270, 46423.3584, 45585.7074, 44757.152, 43938.8416, 43130.9514, 42330.03, 41540.407,40759.6348, 39988.206, 39226.5144, 38473.2096, 37729.795, 36997.268, 36272.6448, 35558.665,34853.0248, 34157.4472, 33470.5204, 32793.5742, 32127.0194, 31469.4182, 30817.6136,30178.6968, 29546.8908, 28922.8544, 28312.271, 27707.0924, 27114.0326, 26526.692, 25948.6336,25383.7826, 24823.5998, 24272.2974, 23732.2572, 23201.4976, 22674.2796, 22163.6336, 21656.515,21161.7362, 20669.9368, 20189.4424, 19717.3358, 19256.3744, 18795.9638, 18352.197, 17908.5738,17474.391, 17052.918, 16637.2236, 16228.4602, 15823.3474, 15428.6974, 15043.0284, 14667.6278,14297.4588, 13935.2882, 13578.5402, 13234.6032, 12882.1578, 12548.0728, 12219.231, 11898.0072,11587.2626, 11279.9072, 10973.5048, 10678.5186, 10392.4876, 10105.2556, 9825.766, 9562.5444,9294.2222, 9038.2352, 8784.848, 8533.2644, 8301.7776, 8058.30859999999, 7822.94579999999,7599.11319999999, 7366.90779999999, 7161.217, 6957.53080000001, 6736.212, 6548.21220000001,6343.06839999999, 6156.28719999999, 5975.15419999999, 5791.75719999999, 5621.32019999999,5451.66, 5287.61040000001, 5118.09479999999, 4957.288, 4798.4246, 4662.17559999999,4512.05900000001, 4364.68539999999, 4220.77720000001, 4082.67259999999, 3957.19519999999,3842.15779999999, 3699.3328, 3583.01180000001, 3473.8964, 3338.66639999999, 3233.55559999999,3117.799, 3008.111, 2909.69140000001, 2814.86499999999, 2719.46119999999, 2624.742,2532.46979999999, 2444.7886, 2370.1868, 2272.45259999999, 2196.19260000001, 2117.90419999999,2023.2972, 1969.76819999999, 1885.58979999999, 1833.2824, 1733.91200000001, 1682.54920000001,1604.57980000001, 1556.11240000001, 1491.3064, 1421.71960000001, 1371.22899999999, 1322.1324,1264.7892, 1196.23920000001, 1143.8474, 1088.67240000001, 1073.60380000001, 1023.11660000001,959.036400000012, 927.433199999999, 906.792799999996, 853.433599999989, 841.873800000001,791.1054, 756.899999999994, 704.343200000003, 672.495599999995, 622.790399999998,611.254799999995, 567.283200000005, 519.406599999988, 519.188400000014, 495.312800000014,451.350799999986, 443.973399999988, 431.882199999993, 392.027000000002, 380.924200000009,345.128999999986, 298.901400000002, 287.771999999997, 272.625, 247.253000000026,222.490600000019, 223.590000000026, 196.407599999977, 176.425999999978, 134.725199999986,132.4804, 110.445599999977, 86.7939999999944, 56.7038000000175, 64.915399999998,38.3726000000024, 37.1606000000029, 46.170999999973, 49.1716000000015, 15.3362000000197,6.71639999997569,-34.8185999999987,-39.4476000000141, 12.6830000000191,-12.3331999999937,-50.6565999999875,-59.9538000000175,-65.1054000000004,-70.7576000000117,-106.325200000021,-126.852200000023,-110.227599999984,-132.885999999999,-113.897200000007,-142.713800000027,-151.145399999979,-150.799200000009,-177.756200000003,-156.036399999983,-182.735199999996,-177.259399999981,-198.663600000029,-174.577600000019,-193.84580000001, },
80
82
  // };
81
- #endif
83
+ #endif
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2025 SAULX
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ #include "selva/_export.h"
6
+
7
+ /**
8
+ * Read memory barrier.
9
+ * Call this function before read in case another thread has potentially
10
+ * written to the memory addresses the current thread is going to access.
11
+ */
12
+ SELVA_EXPORT
13
+ __attribute__((no_reorder))
14
+ void membar_sync_read(void);
15
+
16
+ /**
17
+ * Write memory barrier.
18
+ * Call this function after write to memory when another thread is expected to
19
+ * read the written data.
20
+ */
21
+ SELVA_EXPORT
22
+ __attribute__((no_reorder))
23
+ void membar_sync_write(void);
@@ -32,6 +32,7 @@ enum SelvaFieldType {
32
32
  SELVA_FIELD_TYPE_WEAK_REFERENCES = 7,
33
33
  SELVA_FIELD_TYPE_ALIAS = 8,
34
34
  SELVA_FIELD_TYPE_ALIASES = 9,
35
+ SELVA_FIELD_TYPE_COLVEC = 10,
35
36
  } __packed;
36
37
 
37
38
  struct EdgeFieldConstraint {
@@ -71,6 +72,11 @@ struct SelvaFieldSchema {
71
72
  uint16_t len;
72
73
  } smb; /*!< SELVA_FIELD_TYPE_MICRO_BUFFER */
73
74
  size_t alias_index; /*!< Index in aliases for SELVA_FIELD_TYPE_ALIAS and SELVA_FIELD_TYPE_ALIASES. */
75
+ struct {
76
+ uint16_t vec_len; /*!< Length of a single vector. */
77
+ uint16_t comp_size; /*!< Component size in the vector. */
78
+ field_t index; /*!< Index in te->col_fields.colvec.v. */
79
+ } colvec;
74
80
  };
75
81
  } __designated_init;
76
82
 
@@ -82,11 +88,12 @@ struct SelvaFieldsSchema {
82
88
  size_t len;
83
89
  size_t fixed_data_size;
84
90
  } field_map_template;
85
- struct SelvaFieldSchema field_schemas[] __counted_by(nr_fields);
91
+ struct SelvaFieldSchema field_schemas[255];
86
92
  };
87
93
 
88
94
  struct SelvaNodeSchema {
89
95
  size_t nr_aliases; /*!< Number of alias fields in this type. */
96
+ size_t nr_colvecs; /*!< Number of columnar vector fields. */
90
97
  struct SelvaFieldsSchema fields_schema;
91
98
  /* Nothing must be put after this line. */
92
99
  };