╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ───────────────╮ │src/event/Attachment.zig│ ╰────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │79 │ │80 var record_to_write = record_maybe orelse try evt.removedRecord(Record, DB, hash_kind, haxy_moment.readOnly(), existing_record_maybe);│ │81 │ │82 - const id_bytes = try evt.parseEventId(&record_to_write.event.parent_id); │ │83 - if (!try parentExists(DB, hash_kind, haxy_moment, &id_bytes)) return error.ParentNotFound; │ │82 + const target_id = try evt.parseEventId(&record_to_write.event.target_id); │ │83 + if (!try targetExists(DB, hash_kind, haxy_moment, &target_id)) return error.TargetNotFound; │ │84 if (!nameValid(record_to_write.name)) return error.InvalidAttachment; │ │85 │ │86 if (existing_record_maybe) |existing_record| { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │91 record_to_write.name = existing_record.name; │ │92 record_to_write.blob_oid = existing_record.blob_oid; │ │93 │ │94 - // an attachment cannot move to another parent │ │95 - if (!std.mem.eql(u8, &existing_record.event.parent_id, &record_to_write.event.parent_id)) return error.ParentChanged;│ │94 + // an attachment cannot move to another target │ │95 + if (!std.mem.eql(u8, &existing_record.event.target_id, &record_to_write.event.target_id)) return error.TargetChanged;│ │96 } │ │97 │ │98 const attachment_cursor = try event_id_to_attachment.putCursor(attachment_key); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │106 try attachment_id_set.put(&evt.orderKeyDesc(record_to_write.created_order, event_id)); │ │107 } │ │108 │ │109 - // removed attachments stay in the parent's set; the views skip them │ │110 - const parent_attachments_cursor = try parent_id_to_attachment_id_set.putCursor(hash.hashInt(hash_kind, &record_to_write.event.parent_id));│ │111 - const parent_attachments = try DB.SortedSet(.read_write).init(parent_attachments_cursor); │ │112 - try parent_attachments.put(&evt.orderKey(record_to_write.created_order, event_id)); │ │109 + // removed attachments stay in the target's set; the views skip them │ │110 + const target_attachments_cursor = try target_id_to_attachment_id_set.putCursor(hash.hashInt(hash_kind, &target_id)); │ │111 + const target_attachments = try DB.SortedSet(.read_write).init(target_attachments_cursor); │ │112 + try target_attachments.put(&evt.orderKey(record_to_write.created_order, event_id)); │ │113 } │ │114 │ │115 -// attach `blob` to a parent event and return the event id. `repo` must be │ │115 +// attach `blob` to a target event and return the event id. `repo` must be │ │116 // writable. │ │117 pub fn create( │ │118 host: evt.Host, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────╮ │121 io: std.Io, │ │122 allocator: std.mem.Allocator, │ │123 repo: *rp.Repo(repo_kind, repo_opts), │ │124 - parent_kind: evt.EventKind, │ │125 - parent_id: *const [evt.event_id_size * 2]u8,│ │124 + target_kind: evt.EventKind, │ │125 + target_id: *const [evt.event_id_size * 2]u8,│ │126 blob: evt.Blob, │ │127 author: evt.CommitAuthor, │ │128 ) ![evt.event_id_size * 2]u8 { │ ╰─────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │129 if (!nameValid(blob.name)) return error.InvalidFields; │ │130 if (blob.size == 0 or blob.size > max_size) return error.InvalidFields; │ │131 │ │132 - const parent_id_bytes = evt.parseEventId(parent_id) catch return error.InvalidFields; │ │133 - if (!try evt.threadHolds(repo_kind, repo_opts, io, allocator, repo, parent_kind, &parent_id_bytes, null)) return error.ParentNotFound;│ │132 + const target_id_bytes = evt.parseEventId(target_id) catch return error.InvalidFields; │ │133 + if (!try evt.threadHolds(repo_kind, repo_opts, io, allocator, repo, target_kind, &target_id_bytes, null)) return error.TargetNotFound;│ │134 │ │135 var id_bytes: [evt.event_id_size]u8 = undefined; │ │136 io.random(&id_bytes); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │140 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()),│ │141 .author = author, │ │142 .tree_entries = &.{.{ .blob = blob }}, │ │143 - .event = .{ .attach = .{ .parent_id = parent_id.* } }, │ │143 + .event = .{ .attach = .{ .target_id = target_id.* } }, │ │144 }}); │ │145 return event_id; │ │146 } │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────────╮ │src/event/Comment.zig│ ╰─────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │63 var record_to_write = record_maybe orelse try evt.removedRecord(Record, DB, hash_kind, haxy_moment.readOnly(), existing_record_maybe);│ │64 │ │65 const thread_id = try evt.parseEventId(&record_to_write.event.thread_id); │ │66 - _ = try evt.parseEventId(&record_to_write.event.parent_id); │ │66 + const parent_id = try evt.parseEventId(&record_to_write.event.parent_id); │ │67 │ │68 if (existing_record_maybe) |existing_record| { │ │69 // updates preserve the original creation order and author │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │90 │ │91 // removed comments stay in the thread so their replies remain connected │ │92 const thread_order_key = evt.orderKey(record_to_write.created_order, event_id); │ │93 - const thread_comments_cursor = try thread_id_to_comment_id_set.putCursor(hash.hashInt(hash_kind, &record_to_write.event.thread_id));│ │93 + const thread_comments_cursor = try thread_id_to_comment_id_set.putCursor(hash.hashInt(hash_kind, &thread_id)); │ │94 const thread_comments = try DB.SortedSet(.read_write).init(thread_comments_cursor); │ │95 try thread_comments.put(&thread_order_key); │ │96 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 97 - const replies_cursor = try parent_id_to_comment_id_set.putCursor(hash.hashInt(hash_kind, &record_to_write.event.parent_id));│ │ 97 + const replies_cursor = try parent_id_to_comment_id_set.putCursor(hash.hashInt(hash_kind, &parent_id)); │ │ 98 const replies = try DB.SortedSet(.read_write).init(replies_cursor); │ │ 99 try replies.put(&thread_order_key); │ │100 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────╮ │src/event/Issue.zig│ ╰───────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │162 } │ │163 │ │164 // the assignee sets hold the issue while it exists, whatever its status │ │165 - const id_hex = std.fmt.bytesToHex(event_id.*, .lower); │ │166 - for (try evt.Assignment.load(hash_kind, arena, haxy_moment.readOnly(), &id_hex)) |email| { │ │165 + for (try evt.Assignment.load(hash_kind, arena, haxy_moment.readOnly(), event_id)) |email| { │ │166 try evt.Assignment.indexIssue(DB, hash_kind, haxy_moment, email, &order_key, !record_to_write.removed);│ │167 } │ │168 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯