╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1709 } 1710 1711 // if this object id hasn't already been seen, add it to the walk queue 1712 if (null == try seen_object_ids.getCursor(parent_oid_int)) { 1713 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 1714 } 1715 1716 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 1717 const children = try DB.HashSet(.read_write).init(children_cursor); 1718 try children.put(oid_int, .{ .bytes = &oid }); 1719 pending_parent_count += 1; 1720 } 1721 1722 if (pending_parent_count == 0) { 1723 try self.ready_queue.append(.{ .bytes = &oid }); 1724 } else { 1725 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 1726 } 1727 } 1728 } 1729 1730 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 1731 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 1732 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 1733 const children = try DB.HashSet(.read_only).init(children_cursor); 1734 var children_iter = try children.iterator(); 1735 1736 while (try children_iter.next()) |*child_cursor| { 1737 const kv_pair = try child_cursor.readKeyValuePair(); 1738 const child_oid_int = kv_pair.hash; 1739 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 1740 const pending_parent_count = try pending_parent_cursor.readUint(); 1741 1742 if (pending_parent_count <= 1) { 1743 _ = try self.child_to_pending_parents.remove(child_oid_int); 1744 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 1745 try self.ready_queue.append(.{ .bytes = &child_oid }); 1746 } else { 1747 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 1748 } 1749 } 1750 } 1751 1752 fn readOidFromList(list: DB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 1753 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 1754 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 1755 _ = try oid_cursor.readBytes(&oid); 1756 return oid; 1757 } 1758 }; 1759 } 1760