╭ changed ────────────╮ │src/event/Comment.zig│ ╰─────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │19 const Self = @This(); │ │20 │ │21 // the moment keys `evt.merge` reads and writes for this kind │ │22 +pub const merge_policy: evt.MergePolicy = .target_wins; │ │23 pub const record_map_key = "event-id->comment"; │ │24 pub const id_set_key = "comment-id-set"; │ │24 -pub const conflicts_key = "conflicted-comment-id->conflict"; │ │25 -pub const id_to_field_to_oid_key = "comment-id->field->oid"; │ │25 │ │26 // the indexes the thread reads │ │27 pub const thread_id_to_comment_id_set_key = "thread-id->comment-id-set";│ ╰────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │38 event_id: *const [evt.event_id_size]u8, │ │39 record_maybe: ?Record, │ │40 arena: *std.heap.ArenaAllocator, │ │42 - // the commit this event came from, recorded against every field it │ │43 - // changes. null from `merge`, which sets oids and conflicts itself.│ │44 - event_oid: ?[]const u8, │ │41 + _: ?[]const u8, │ │42 ) !void { │ │43 const comment_key = hash.hashInt(hash_kind, event_id); │ │44 │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │51 const parent_id_to_comment_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, parent_id_to_comment_id_set_key));│ │52 const parent_id_to_comment_id_set = try DB.HashMap(.read_write).init(parent_id_to_comment_id_set_cursor); │ │53 │ │57 - const conflicts_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, conflicts_key)); │ │58 - const conflicts = try DB.SortedMap(.read_write).init(conflicts_cursor); │ │59 - │ │60 - const comment_id_to_field_to_oid_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, id_to_field_to_oid_key)); │ │61 - const comment_id_to_field_to_oid = try DB.HashMap(.read_write).init(comment_id_to_field_to_oid_cursor); │ │62 - │ │54 var existing_record_maybe: ?Record = null; │ │55 const existing_cursor_maybe = try event_id_to_comment.getCursor(comment_key); │ │56 if (existing_cursor_maybe) |existing_cursor| { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 81 // a comment cannot move between threads or positions in the thread │ │ 82 if (!std.mem.eql(u8, &existing_record.event.thread_id, &record_to_write.event.thread_id)) return error.ThreadChanged; │ │ 83 if (!std.mem.eql(u8, &existing_record.event.parent_id, &record_to_write.event.parent_id)) return error.ParentChanged; │ │ 93 - │ │ 94 - // any event settles the conflict, since resolving in the ui may │ │ 95 - // keep our own values and so change nothing to detect │ │ 96 - if (event_oid != null or record_to_write.deleted) { │ │ 97 - _ = try conflicts.remove(&evt.orderKeyDesc(existing_record.created_ts, event_id)); │ │ 98 - } │ │ 84 } │ │ 85 │ │101 - try evt.writeOid(Self, DB, hash_kind, comment_id_to_field_to_oid, comment_key, if (existing_record_maybe) |existing| existing.event else null, record_to_write.event, event_oid);│ │102 - │ │ 86 const comment_cursor = try event_id_to_comment.putCursor(comment_key); │ │ 87 const comment = try DB.HashMap(.read_write).init(comment_cursor); │ │ 88 try evt.upsert(Record, DB, hash_kind, comment, record_to_write); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯