╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1748 return std.mem.eql(u8, &comment.event.thread_id, &thread_id_hex); │ │1749 }, │ │1750 .attach => |id| { │ │1751 - const attachment = (try readRecordSubset(Attachment, struct { event: struct { parent_id: [event_id_size * 2]u8 } }, DB, repo_opts.hash, moment, &arena, id)) orelse return false;│ │1752 - return std.mem.eql(u8, &attachment.event.parent_id, &thread_id_hex); │ │1751 + const attachment = (try readRecordSubset(Attachment, struct { event: struct { target_id: [event_id_size * 2]u8 } }, DB, repo_opts.hash, moment, &arena, id)) orelse return false;│ │1752 + return std.mem.eql(u8, &attachment.event.target_id, &thread_id_hex); │ │1753 }, │ │1754 // only an active assignment can be removed │ │1755 .assign => |id| { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/event/Assignment.zig│ ╰────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │101 // the thread's set holds active assignments only, oldest first. the id │ │102 // fixes the thread, so an assignment never moves between sets. │ │103 const order_key = evt.orderKey(record.created_order, event_id); │ │104 - const thread_assignments = try DB.SortedSet(.read_write).init(try by_thread.putCursor(hash.hashInt(hash_kind, &record.event.thread_id)));│ │104 + const thread_id = try evt.parseEventId(&record.event.thread_id); │ │105 + const thread_assignments = try DB.SortedSet(.read_write).init(try by_thread.putCursor(hash.hashInt(hash_kind, &thread_id))); │ │106 if (record.removed) { │ │107 _ = try thread_assignments.remove(&order_key); │ │108 } else { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │110 } │ │111 │ │112 // only an issue is indexed by assignee │ │112 - const thread_id = try evt.parseEventId(&record.event.thread_id); │ │113 const issue = (try evt.readRecordSubset(evt.Issue, struct { created_order: u64, removed: bool }, DB, hash_kind, haxy_moment.readOnly(), arena, &thread_id)) orelse return;│ │114 try indexIssue(DB, hash_kind, haxy_moment, record.event.email, &evt.orderKeyDesc(issue.created_order, &thread_id), !record.removed and !issue.removed); │ │115 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────╮ │189 comptime hash_kind: hash.HashKind, │ │190 arena: *std.heap.ArenaAllocator, │ │191 haxy_moment: evt.EventDB(hash_kind).HashMap(.read_only),│ │192 - thread_id: []const u8, │ │192 + thread_id: *const [evt.event_id_size]u8, │ │193 ) ![]const []const u8 { │ │194 const DB = evt.EventDB(hash_kind); │ │195 var emails: std.ArrayList([]const u8) = .empty; │ ╰─────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/event/Attachment.zig│ ╰────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │ 4 const rp = xit.repo; │ │ 5 const hash = xit.hash; │ │ 6 │ │ 7 -parent_id: [evt.event_id_size * 2]u8, │ │ 7 +target_id: [evt.event_id_size * 2]u8, │ │ 8 │ │ 9 // what the db stores: the event's data plus the commit-derived fields. the file│ │10 // itself is the one entry in the event commit's tree, so its name and blob come│ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │26 pub const record_map_key = "event-id->attachment"; │ │27 pub const all_id_set_key = "attachment-id-set"; │ │28 │ │29 -// the index a parent event's view reads │ │30 -pub const parent_id_to_attachment_id_set_key = "parent-id->attachment-id-set";│ │29 +// the index a target event's view reads │ │30 +pub const target_id_to_attachment_id_set_key = "target-id->attachment-id-set";│ │31 │ │32 pub const max_size: usize = 10 * 1024 * 1024; │ │33 pub const name_max_len = 255; │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────╮ │42 return true; │ │43 } │ │44 │ │45 -fn parentExists( │ │45 +fn targetExists( │ │46 comptime DB: type, │ │47 comptime hash_kind: hash.HashKind,│ │48 haxy_moment: anytype, │ ╰──────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │49 - parent_id: *const [evt.event_id_size]u8, │ │49 + target_id: *const [evt.event_id_size]u8, │ │50 ) !bool { │ │51 const kinds_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, evt.event_index_key)) orelse return false;│ │52 const kinds = try DB.HashMap(.read_only).init(kinds_cursor); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │53 - return try kinds.getCursor(hash.hashInt(hash_kind, parent_id)) != null;│ │53 + return try kinds.getCursor(hash.hashInt(hash_kind, target_id)) != null;│ │54 } │ │55 │ │56 pub fn consume( │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │67 const event_id_to_attachment_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, record_map_key)); │ │68 const event_id_to_attachment = try DB.HashMap(.read_write).init(event_id_to_attachment_cursor); │ │69 │ │70 - const parent_id_to_attachment_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, parent_id_to_attachment_id_set_key));│ │71 - const parent_id_to_attachment_id_set = try DB.HashMap(.read_write).init(parent_id_to_attachment_id_set_cursor); │ │70 + const target_id_to_attachment_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, target_id_to_attachment_id_set_key));│ │71 + const target_id_to_attachment_id_set = try DB.HashMap(.read_write).init(target_id_to_attachment_id_set_cursor); │ │72 │ │73 var existing_record_maybe: ?Record = null; │ │74 const existing_cursor_maybe = try event_id_to_attachment.getCursor(attachment_key); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯