╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1549 if (null != try consumed_object_ids.getCursor(parent_oid_int)) { 1550 continue; 1551 } 1552 1553 // if this object id hasn't already been seen, add it to the walk queue 1554 if (null == try seen_object_ids.getCursor(parent_oid_int)) { 1555 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 1556 } 1557 1558 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 1559 const children = try DB.HashSet(.read_write).init(children_cursor); 1560 try children.put(oid_int, .{ .bytes = &oid }); 1561 pending_parent_count += 1; 1562 } 1563 1564 if (pending_parent_count == 0) { 1565 try self.ready_queue.append(.{ .bytes = &oid }); 1566 } else { 1567 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 1568 } 1569 } 1570 } 1571 1572 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 1573 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 1574 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 1575 const children = try DB.HashSet(.read_only).init(children_cursor); 1576 var children_iter = try children.iterator(); 1577 1578 while (try children_iter.next()) |*child_cursor| { 1579 const kv_pair = try child_cursor.readKeyValuePair(); 1580 const child_oid_int = kv_pair.hash; 1581 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 1582 const pending_parent_count = try pending_parent_cursor.readUint(); 1583 1584 if (pending_parent_count <= 1) { 1585 _ = try self.child_to_pending_parents.remove(child_oid_int); 1586 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 1587 try self.ready_queue.append(.{ .bytes = &child_oid }); 1588 } else { 1589 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 1590 } 1591 } 1592 } 1593 1594 fn readOidFromList(list: DB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 1595 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 1596 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 1597 _ = try oid_cursor.readBytes(&oid); 1598 return oid; 1599 } 1600 }; 1601 } 1602