╭ changed ─────────╮ │src/event/User.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │83 │ │84 try name_to_user_id.put(hash.hashInt(hash_kind, event.name), .{ .bytes = event_id }); │ │85 │ │86 - // first time we've seen this user: add it to the ordered map the users │ │87 - // view paginates through │ │86 + // first time we've seen this user: add it to the ordered set the users │ │87 + // view paginates through. the key (orderKey) embeds the event id, so the │ │88 + // set needs no value. │ │89 if (existing_cursor_maybe == null) { │ │89 - const created_ts_to_user_id_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "created-ts->user-id"));│ │90 - const created_ts_to_user_id = try DB.SortedMap(.read_write).init(created_ts_to_user_id_cursor); │ │90 + const user_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-id-set")); │ │91 + const user_id_set = try DB.SortedSet(.read_write).init(user_id_set_cursor); │ │92 const order_key = evt.orderKey(event_to_write.created_ts, event_id); │ │92 - try created_ts_to_user_id.put(&order_key, .{ .bytes = event_id }); │ │93 + try user_id_set.put(&order_key); │ │94 } │ │95 } else { │ │96 // read the user's name so we can drop its name->id index entry │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 99 const existing_event = try evt.read(@This(), DB, hash_kind, arena, existing_user); │ │100 _ = try name_to_user_id.remove(hash.hashInt(hash_kind, existing_event.name)); │ │101 │ │101 - // drop it from the ordered map using its recorded creation timestamp │ │102 - const created_ts_to_user_id_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "created-ts->user-id"));│ │103 - const created_ts_to_user_id = try DB.SortedMap(.read_write).init(created_ts_to_user_id_cursor); │ │102 + // drop it from the ordered set using its recorded creation timestamp │ │103 + const user_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-id-set")); │ │104 + const user_id_set = try DB.SortedSet(.read_write).init(user_id_set_cursor); │ │105 const order_key = evt.orderKey(existing_event.created_ts, event_id); │ │105 - _ = try created_ts_to_user_id.remove(&order_key); │ │106 + _ = try user_id_set.remove(&order_key); │ │107 } │ │108 │ │109 if (!try event_id_to_user.remove(user_key)) return error.EventNotFound; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │110 │ │110 - const user_id_to_repos_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-id->repos")); │ │111 - const user_id_to_repos = try DB.HashMap(.read_write).init(user_id_to_repos_cursor); │ │112 - _ = try user_id_to_repos.remove(user_key); │ │111 + const user_id_to_repo_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-id->repo-id-set"));│ │112 + const user_id_to_repo_id_set = try DB.HashMap(.read_write).init(user_id_to_repo_id_set_cursor); │ │113 + _ = try user_id_to_repo_id_set.remove(user_key); │ │114 } │ │115 } │ │116 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯