╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Issue.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
323 return null 324 else 325 evt.currentMoment(repo_opts, repo)) catch return null; 326 const event_id_to_issue_cursor = (try moment.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue"))) orelse return null; 327 const event_id_to_issue = try DB.HashMap(.read_only).init(event_id_to_issue_cursor); 328 const issue_cursor = (try event_id_to_issue.getCursor(hash.hashInt(repo_opts.hash, id_bytes))) orelse return null; 329 const issue_map = try DB.HashMap(.read_only).init(issue_cursor); 330 return try evt.read(Record, DB, repo_opts.hash, arena, issue_map); 331 } 332 333 // remove an issue's order key from its tags' `status` sets, pruning entries 334 // whose set becomes empty 335 fn removeFromTagSets( 336 comptime DB: type, 337 tag_to_issues: DB.SortedMap(.read_write), 338 tags: []const u8, 339 status: Status, 340 order_key: []const u8, 341 ) !void { 342 var tag_iter = tagIterator(tags); 343 while (tag_iter.next()) |tag| { 344 // skipped the same way consume skipped it, so it was never indexed 345 if (tag.len == 0 or tag.len > tag_max_len) continue; 346 var key_buffer: TagStatusKey = undefined; 347 const key = try tagStatusKey(&key_buffer, tag, status); 348 const tag_set_cursor = try tag_to_issues.putCursor(key); 349 const tag_set = try DB.SortedSet(.read_write).init(tag_set_cursor); 350 _ = try tag_set.remove(order_key); 351 if (0 == try tag_set.count()) _ = try tag_to_issues.remove(key); 352 } 353 } 354