╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Patch.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
431 status: StatusKind, 432 ) !DB.SortedSet(.read_write) { 433 return DB.SortedSet(.read_write).init(try statuses.putCursor(@tagName(status))); 434 } 435 436 fn removeFromLabelSets( 437 comptime DB: type, 438 label_statuses: DB.SortedMap(.read_write), 439 labels: []const u8, 440 status: StatusKind, 441 order_key: []const u8, 442 ) !void { 443 var label_iter = labelIterator(labels); 444 while (label_iter.next()) |label| { 445 if (label.len == 0 or label.len > label_max_len) continue; 446 var key_buffer: LabelStatusKey = undefined; 447 const key = try labelStatusKey(&key_buffer, label, status); 448 const set = try DB.SortedSet(.read_write).init(try label_statuses.putCursor(key)); 449 _ = try set.remove(order_key); 450 if (0 == try set.count()) _ = try label_statuses.remove(key); 451 } 452 } 453 454 pub fn readById( 455 comptime DB: type, 456 comptime hash_kind: hash.HashKind, 457 haxy_moment: DB.HashMap(.read_only), 458 arena: *std.heap.ArenaAllocator, 459 id: *const [evt.event_id_size]u8, 460 ) !?Record { 461 const records_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, record_map_key)) orelse return null; 462 const records = try DB.HashMap(.read_only).init(records_cursor); 463 const record_cursor = try records.getCursor(hash.hashInt(hash_kind, id)) orelse return null; 464 return try evt.read(Record, DB, hash_kind, arena, try DB.HashMap(.read_only).init(record_cursor)); 465 } 466