╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2665 // if this object id hasn't already been seen, add it to the walk queue 2666 if (null == try seen_object_ids.getCursor(parent_oid_int)) { 2667 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 2668 } 2669 2670 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 2671 const children = try TempDB.HashSet(.read_write).init(children_cursor); 2672 try children.put(oid_int, .{ .bytes = &oid }); 2673 pending_parent_count += 1; 2674 } 2675 2676 if (pending_parent_count == 0) { 2677 try self.ready_queue.append(.{ .bytes = &oid }); 2678 } else { 2679 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 2680 } 2681 } 2682 } 2683 2684 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 2685 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 2686 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 2687 const children = try TempDB.HashSet(.read_only).init(children_cursor); 2688 var children_iter = try children.iterator(); 2689 2690 while (try children_iter.next()) |*child_cursor| { 2691 const kv_pair = try child_cursor.readKeyValuePair(); 2692 const child_oid_int = kv_pair.hash; 2693 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 2694 const pending_parent_count = try pending_parent_cursor.readUint(); 2695 2696 if (pending_parent_count <= 1) { 2697 _ = try self.child_to_pending_parents.remove(child_oid_int); 2698 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 2699 try self.ready_queue.append(.{ .bytes = &child_oid }); 2700 } else { 2701 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 2702 } 2703 } 2704 } 2705 2706 fn readOidFromList(list: TempDB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 2707 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 2708 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 2709 _ = try oid_cursor.readBytes(&oid); 2710 return oid; 2711 } 2712 }; 2713 } 2714