╭ changed ───────────────╮ │src/event/Discussion.zig│ ╰────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────╮ │ 7 │ │ 8 title: []const u8, │ │ 9 description: []const u8, │ │10 -tags: []const u8, // space-separated │ │10 +labels: []const u8, // space-separated│ │11 │ │12 pub const Record = struct { │ │13 event: Self, │ ╰──────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────╮ │19 │ │20 const Self = @This(); │ │21 │ │22 -pub const tag_max_len = 64; │ │22 +pub const label_max_len = 64; │ │23 │ │24 pub const merge_policy: evt.MergePolicy = .target_wins;│ │25 pub const record_map_key = "event-id->discussion"; │ ╰───────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │26 pub const all_id_set_key = "discussion-id-set"; │ │27 pub const active_id_set_key = "active-discussion-id-set"; │ │28 -pub const tag_to_id_set_key = "tag->discussion-id-set"; │ │28 +pub const label_to_id_set_key = "label->discussion-id-set"; │ │29 const activity_order_key = "discussion-id->activity-order"; │ │30 │ │31 -pub fn tagIterator(tags: []const u8) std.mem.SplitIterator(u8, .scalar) { │ │32 - return std.mem.splitScalar(u8, tags, ' '); │ │31 +pub fn labelIterator(labels: []const u8) std.mem.SplitIterator(u8, .scalar) {│ │32 + return std.mem.splitScalar(u8, labels, ' '); │ │33 } │ │34 │ │35 -pub fn fieldsValid(title: []const u8, tags: []const u8) bool { │ │35 +pub fn fieldsValid(title: []const u8, labels: []const u8) bool { │ │36 if (!evt.titleValid(title)) return false; │ │37 - var tag_iter = tagIterator(tags); │ │38 - while (tag_iter.next()) |tag| { │ │39 - if (tag.len > tag_max_len) return false; │ │37 + var label_iter = labelIterator(labels); │ │38 + while (label_iter.next()) |label| { │ │39 + if (label.len > label_max_len) return false; │ │40 } │ │41 return true; │ │42 } │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │53 const discussion_key = hash.hashInt(hash_kind, event_id); │ │54 const records = try DB.HashMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, record_map_key))); │ │55 const active = try DB.SortedSet(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, active_id_set_key))); │ │56 - const tags = try DB.SortedMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, tag_to_id_set_key))); │ │56 + const labels = try DB.SortedMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, label_to_id_set_key)));│ │57 var existing_record_maybe: ?Record = null; │ │58 const existing_cursor_maybe = try records.getCursor(discussion_key); │ │59 if (existing_cursor_maybe) |existing_cursor| { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │75 if (!existing.removed) { │ │76 const old_key = evt.orderKeyDesc(activity_order, event_id); │ │77 _ = try active.remove(&old_key); │ │78 - try removeFromTagSets(DB, tags, existing.event.tags, &old_key); │ │78 + try removeFromLabelSets(DB, labels, existing.event.labels, &old_key);│ │79 } │ │80 } │ │81 │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │ 98 │ │ 99 if (!record_to_write.removed) { │ │100 try active.put(&order_key); │ │101 - try addToTagSets(DB, tags, record_to_write.event.tags, &order_key); │ │101 + try addToLabelSets(DB, labels, record_to_write.event.labels, &order_key);│ │102 } │ │103 } │ │104 │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │119 if (order <= current) return; │ │120 │ │121 const active = try DB.SortedSet(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, active_id_set_key))); │ │122 - const tags = try DB.SortedMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, tag_to_id_set_key))); │ │122 + const labels = try DB.SortedMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, label_to_id_set_key)));│ │123 if (!record.removed) { │ │124 const old_key = evt.orderKeyDesc(current, event_id); │ │125 _ = try active.remove(&old_key); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │126 - try removeFromTagSets(DB, tags, record.event.tags, &old_key); │ │126 + try removeFromLabelSets(DB, labels, record.event.labels, &old_key); │ │127 } │ │128 │ │129 const activity = try DB.HashMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, activity_order_key)));│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │131 if (!record.removed) { │ │132 const new_key = evt.orderKeyDesc(order, event_id); │ │133 try active.put(&new_key); │ │134 - try addToTagSets(DB, tags, record.event.tags, &new_key); │ │134 + try addToLabelSets(DB, labels, record.event.labels, &new_key);│ │135 } │ │136 } │ │137 │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────╮ │156 repo: *rp.Repo(repo_kind, repo_opts),│ │157 id: *const [evt.event_id_size]u8, │ │158 title: []const u8, │ │159 - tags: []const u8, │ │159 + labels: []const u8, │ │160 description: []const u8, │ │161 author: evt.CommitAuthor, │ │162 ) !void { │ ╰──────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯