╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1423 // no longer owns │ │1424 if (!merged.removed and @hasDecl(T, "name_index_key")) { │ │1425 const name_index_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, T.name_index_key));│ │1426 - const name_index = try DB.HashMap(.read_write).init(name_index_cursor); │ │1427 - if (try name_index.getCursor(hash.hashInt(hash_kind, merged.event.name))) |owner_cursor| { │ │1426 + const name_index = try DB.SortedMap(.read_write).init(name_index_cursor); │ │1427 + if (try name_index.getCursor(merged.event.name)) |owner_cursor| { │ │1428 var owner_id: [event_id_size]u8 = undefined; │ │1429 _ = try owner_cursor.readBytes(&owner_id); │ │1430 if (!std.mem.eql(u8, &owner_id, &event_id)) continue; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────╮ │src/event/Repo.zig│ ╰──────────────────╯ ╭───────────────────────────────────────────────────────────╮ │77 pub const merge_policy: evt.MergePolicy = .target_wins;│ │78 pub const record_map_key = "event-id->repo"; │ │79 pub const all_id_set_key = "repo-id-set"; │ │80 -pub const active_id_set_key = "active-repo-id-set"; │ │80 pub const name_index_key = "name->repo-id"; │ │81 │ │82 pub fn validateName(name: []const u8) !void { │ ╰───────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │109 const event_id_to_repo_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "event-id->repo"));│ │110 const event_id_to_repo = try DB.HashMap(.read_write).init(event_id_to_repo_cursor); │ │111 │ │113 - const name_to_repo_id_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "name->repo-id")); │ │114 - const name_to_repo_id = try DB.HashMap(.read_write).init(name_to_repo_id_cursor); │ │112 + const name_to_repo_id_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, name_index_key)); │ │113 + const name_to_repo_id = try DB.SortedMap(.read_write).init(name_to_repo_id_cursor); │ │114 │ │115 var existing_record_maybe: ?Record = null; │ │116 const existing_cursor_maybe = try event_id_to_repo.getCursor(repo_key); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │134 │ │135 // drop the old active index; active values are re-added below │ │136 if (!existing_record.removed) { │ │138 - _ = try name_to_repo_id.remove(hash.hashInt(hash_kind, existing_record.event.name));│ │137 + _ = try name_to_repo_id.remove(existing_record.event.name); │ │138 } │ │139 } │ │140 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │152 try repo_id_set.put(&order_key); │ │153 } │ │154 │ │156 - // the user's repos, ordered by creation time, newest first │ │157 - const active = try DB.SortedSet(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, active_id_set_key)));│ │158 - if (record_to_write.removed) { │ │159 - _ = try active.remove(&order_key); │ │160 - } else { │ │161 - try active.put(&order_key); │ │162 - try name_to_repo_id.put(hash.hashInt(hash_kind, record_to_write.event.name), .{ .bytes = event_id }); │ │155 + if (!record_to_write.removed) { │ │156 + try name_to_repo_id.put(record_to_write.event.name, .{ .bytes = event_id }); │ │157 } │ │158 } │ │159 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │173 name: []const u8, │ │174 ) !?RepoWithId { │ │175 const name_to_repo_id_cursor = try user_moment.getCursor(hash.hashInt(hash_kind, name_index_key)) orelse return null;│ │182 - const name_to_repo_id = try DB.HashMap(.read_only).init(name_to_repo_id_cursor); │ │183 - const repo_id_cursor = try name_to_repo_id.getCursor(hash.hashInt(hash_kind, name)) orelse return null; │ │176 + const name_to_repo_id = try DB.SortedMap(.read_only).init(name_to_repo_id_cursor); │ │177 + const repo_id_cursor = try name_to_repo_id.getCursor(name) orelse return null; │ │178 var repo_id: [evt.event_id_size]u8 = undefined; │ │179 _ = try repo_id_cursor.readBytes(&repo_id); │ │180 const repo = (try readById(DB, hash_kind, user_moment, arena, &repo_id)) orelse return null; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────╮ │src/event/User.zig│ ╰──────────────────╯ ╭────────────────────────────────────────────────────────────────╮ │32 pub const merge_policy: evt.MergePolicy = .target_wins; │ │33 pub const record_map_key = "event-id->user"; │ │34 pub const all_id_set_key = "user-id-set"; │ │35 -pub const active_id_set_key = "active-user-id-set"; │ │35 pub const name_index_key = "name->user-id"; │ │36 │ │37 // resolves a commit's author email to its user at read time│ ╰────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │68 const event_id_to_user_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "event-id->user")); │ │69 const event_id_to_user = try DB.HashMap(.read_write).init(event_id_to_user_cursor); │ │70 │ │72 - const name_to_user_id_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "name->user-id")); │ │73 - const name_to_user_id = try DB.HashMap(.read_write).init(name_to_user_id_cursor); │ │71 + const name_to_user_id_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, name_index_key)); │ │72 + const name_to_user_id = try DB.SortedMap(.read_write).init(name_to_user_id_cursor); │ │73 │ │74 const email_to_user_id_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, email_to_user_id_key));│ │75 const email_to_user_id = try DB.HashMap(.read_write).init(email_to_user_id_cursor); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │91 │ │92 // drop the old active indexes; active values are re-added below │ │93 if (!existing_record.removed) { │ │95 - _ = try name_to_user_id.remove(hash.hashInt(hash_kind, existing_record.event.name)); │ │94 + _ = try name_to_user_id.remove(existing_record.event.name); │ │95 _ = try email_to_user_id.remove(hash.hashInt(hash_kind, existing_record.event.email));│ │96 } │ │97 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │110 try user_id_set.put(&order_key); │ │111 } │ │112 │ │114 - const active = try DB.SortedSet(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, active_id_set_key)));│ │115 - if (record_to_write.removed) { │ │116 - _ = try active.remove(&order_key); │ │117 - } else { │ │118 - try active.put(&order_key); │ │119 - try name_to_user_id.put(hash.hashInt(hash_kind, record_to_write.event.name), .{ .bytes = event_id }); │ │113 + if (!record_to_write.removed) { │ │114 + try name_to_user_id.put(record_to_write.event.name, .{ .bytes = event_id }); │ │115 try email_to_user_id.put(hash.hashInt(hash_kind, record_to_write.event.email), .{ .bytes = event_id }); │ │116 } │ │117 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯