╭ changed ─────────╮ │src/event/User.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │14 // what the db stores: the event's data plus the commit-derived fields │ │15 pub const Record = struct { │ │16 event: Self, │ │17 - deleted: bool = false, │ │17 + removed: bool = false, │ │18 created_ts: u64 = 0, // the commit timestamp of the event that first created this user│ │19 │ │20 // a user's key in the name index │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │90 record │ │91 else blk: { │ │92 var record = existing_record_maybe orelse return error.EventNotFound;│ │93 - record.deleted = true; │ │93 + record.removed = true; │ │94 break :blk record; │ │95 }; │ │96 │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │ 97 - if (!record_to_write.deleted) try validateName(record_to_write.event.name);│ │ 97 + if (!record_to_write.removed) try validateName(record_to_write.event.name);│ │ 98 │ │ 99 if (existing_record_maybe) |existing_record| { │ │100 // updates preserve the original creation timestamp │ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │101 record_to_write.created_ts = existing_record.created_ts; │ │102 │ │103 // drop the old active indexes; active values are re-added below │ │104 - if (!existing_record.deleted) { │ │104 + if (!existing_record.removed) { │ │105 _ = try name_to_user_id.remove(hash.hashInt(hash_kind, existing_record.event.name)); │ │106 _ = try email_to_user_id.remove(hash.hashInt(hash_kind, existing_record.event.email));│ │107 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │110 const user_cursor = try event_id_to_user.putCursor(user_key); │ │111 const user = try DB.HashMap(.read_write).init(user_cursor); │ │112 try evt.upsert(Record, DB, hash_kind, user, record_to_write); │ │113 - try evt.indexEvent(DB, hash_kind, haxy_moment, event_id, .user, record_to_write.created_ts); │ │113 + try evt.indexEvent(DB, hash_kind, haxy_moment, event_id, .user, record_to_write.created_ts, record_to_write.removed);│ │114 │ │115 const order_key = evt.orderKeyDesc(record_to_write.created_ts, event_id); │ │116 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │117 - // the id set retains tombstones so merges can carry deletions │ │117 + // the id set retains removed records so merges can carry removals │ │118 if (existing_cursor_maybe == null) { │ │119 const user_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, id_set_key));│ │120 const user_id_set = try DB.SortedSet(.read_write).init(user_id_set_cursor); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │121 try user_id_set.put(&order_key); │ │122 } │ │123 │ │124 - if (!record_to_write.deleted) { │ │124 + if (!record_to_write.removed) { │ │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 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │128 │ │129 - const became_deleted = record_to_write.deleted and if (existing_record_maybe) |existing| !existing.deleted else true;│ │130 - if (became_deleted) { │ │129 + const became_removed = record_to_write.removed and if (existing_record_maybe) |existing| !existing.removed else true;│ │130 + if (became_removed) { │ │131 // the user's repos go with them: the repo name index is keyed by owner │ │132 // id, so one left behind is listed but can never be resolved again │ │133 const user_id_to_repo_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-id->repo-id-set"));│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │135 if (try user_id_to_repo_id_set.getCursor(user_key)) |user_repos_cursor| { │ │136 const user_repos = try DB.SortedSet(.read_only).init(user_repos_cursor);│ │137 │ │138 - // collected up front, since deleting a repo removes it from this set │ │138 + // collected up front, since removing a repo removes it from this set │ │139 var repo_ids: std.ArrayList([evt.event_id_size]u8) = .empty; │ │140 var repo_iter = try user_repos.iteratorFromIndex(0); │ │141 while (try repo_iter.next()) |kv_pair_cursor| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯