╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2498 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 2499 } 2500 2501 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 2502 const children = try TempDB.HashSet(.read_write).init(children_cursor); 2503 try children.put(oid_int, .{ .bytes = &oid }); 2504 pending_parent_count += 1; 2505 } 2506 2507 if (pending_parent_count == 0) { 2508 try self.ready_queue.append(.{ .bytes = &oid }); 2509 } else { 2510 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 2511 } 2512 } 2513 } 2514 2515 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 2516 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 2517 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 2518 const children = try TempDB.HashSet(.read_only).init(children_cursor); 2519 var children_iter = try children.iterator(); 2520 2521 while (try children_iter.next()) |*child_cursor| { 2522 const kv_pair = try child_cursor.readKeyValuePair(); 2523 const child_oid_int = kv_pair.hash; 2524 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 2525 const pending_parent_count = try pending_parent_cursor.readUint(); 2526 2527 if (pending_parent_count <= 1) { 2528 _ = try self.child_to_pending_parents.remove(child_oid_int); 2529 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 2530 try self.ready_queue.append(.{ .bytes = &child_oid }); 2531 } else { 2532 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 2533 } 2534 } 2535 } 2536 2537 fn readOidFromList(list: TempDB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 2538 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 2539 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 2540 _ = try oid_cursor.readBytes(&oid); 2541 return oid; 2542 } 2543 }; 2544 } 2545