index: secondary index core — entries, search, planner, _id fast path

Adds src/index.zig with the full secondary-index machinery: entry
generation mirroring field_matches (array value + elements), BSON-order
sorted entries with binary search, compound prefix and range lookups,
unique/sparse options, the query planner (longest equality/$in run +
optional range, $in cartesian cap, sparse/null bail), and the _id_ fast
path guarded against serialization-ambiguous values (numbers, strings,
symbols, codes, opaque payloads).

query.collect_values is now pub so entry generation can mirror it exactly.
storage.zig gains record_type_index_create/drop; lib.zig exports index.
This commit is contained in:
2026-08-02 12:21:22 +03:00
parent 662df9b121
commit a38ddc2f50
10 changed files with 1824 additions and 782 deletions

View File

@@ -8,6 +8,7 @@ pub const storage = @import("storage.zig");
pub const db = @import("db.zig");
pub const query = @import("query.zig");
pub const update = @import("update.zig");
pub const index = @import("index.zig");
test {
_ = @import("bson.zig");
@@ -18,4 +19,5 @@ test {
_ = @import("db.zig");
_ = @import("query.zig");
_ = @import("update.zig");
_ = @import("index.zig");
}