╭ changed ─────────╮ │src/event/User.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->user"; │ │40 -pub const id_set_key = "user-id-set"; │ │40 +pub const all_id_set_key = "user-id-set"; │ │41 +pub const active_id_set_key = "active-user-id-set"; │ │42 pub const name_index_key = "name->user-id"; │ │43 │ │44 // resolves a commit's author email to its user at read time │ ╰─────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │112 │ │113 // the id set retains removed records so merges can carry removals │ │114 if (existing_cursor_maybe == null) { │ │114 - const user_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, id_set_key)); │ │115 + const user_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, all_id_set_key));│ │116 const user_id_set = try DB.SortedSet(.read_write).init(user_id_set_cursor); │ │117 try user_id_set.put(&order_key); │ │118 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │119 │ │119 - if (!record_to_write.removed) { │ │120 + const active = try DB.SortedSet(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, active_id_set_key)));│ │121 + if (record_to_write.removed) { │ │122 + _ = try active.remove(&order_key); │ │123 + } else { │ │124 + try active.put(&order_key); │ │125 try name_to_user_id.put(hash.hashInt(hash_kind, record_to_write.event.name), .{ .bytes = event_id }); │ │126 try email_to_user_id.put(hash.hashInt(hash_kind, record_to_write.event.email), .{ .bytes = event_id }); │ │127 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯