╭ changed ─────────╮ │src/event/Repo.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────╮ │37 // the moment keys `evt.merge` reads and writes for this kind│ │38 pub const merge_policy: evt.MergePolicy = .target_wins; │ │39 pub const record_map_key = "event-id->repo"; │ │40 -pub const id_set_key = "repo-id-set"; │ │40 +pub const all_id_set_key = "repo-id-set"; │ │41 +pub const active_id_set_key = "active-repo-id-set"; │ │42 pub const name_index_key = "name->repo-id"; │ │43 │ │44 pub fn validateName(name: []const u8) !void { │ ╰─────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │117 │ │118 // the id set retains removed records so merges can carry removals │ │119 if (existing_cursor_maybe == null) { │ │119 - const repo_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, id_set_key)); │ │120 + const repo_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, all_id_set_key));│ │121 const repo_id_set = try DB.SortedSet(.read_write).init(repo_id_set_cursor); │ │122 try repo_id_set.put(&order_key); │ │123 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │124 │ │124 - if (!record_to_write.removed) { │ │125 + const active = try DB.SortedSet(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, active_id_set_key)));│ │126 + if (record_to_write.removed) { │ │127 + _ = try active.remove(&order_key); │ │128 + } else { │ │129 + try active.put(&order_key); │ │130 const repo_path = try record_to_write.indexKey(arena.allocator()); │ │131 try name_to_repo_id.put(hash.hashInt(hash_kind, repo_path), .{ .bytes = event_id }); │ │132 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯