╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ event.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2575 2576 // if this object id hasn't already been seen, add it to the walk queue 2577 if (null == try seen_object_ids.getCursor(parent_oid_int)) { 2578 try walk_queue.append(.{ .bytes = &parent_oid_bytes }); 2579 } 2580 2581 const children_cursor = try self.parent_to_children.putCursor(parent_oid_int); 2582 const children = try TempDB.HashSet(.read_write).init(children_cursor); 2583 try children.put(oid_int, .{ .bytes = &oid }); 2584 pending_parent_count += 1; 2585 } 2586 2587 if (pending_parent_count == 0) { 2588 try self.ready_queue.append(.{ .bytes = &oid }); 2589 } else { 2590 try self.child_to_pending_parents.put(oid_int, .{ .uint = pending_parent_count }); 2591 } 2592 } 2593 } 2594 2595 fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { 2596 const oid_int = hash.bytesToInt(repo_opts.hash, oid); 2597 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; 2598 const children = try TempDB.HashSet(.read_only).init(children_cursor); 2599 var children_iter = try children.iterator(); 2600 2601 while (try children_iter.next()) |*child_cursor| { 2602 const kv_pair = try child_cursor.readKeyValuePair(); 2603 const child_oid_int = kv_pair.hash; 2604 const pending_parent_cursor = try self.child_to_pending_parents.getCursor(child_oid_int) orelse return error.CursorNotFound; 2605 const pending_parent_count = try pending_parent_cursor.readUint(); 2606 2607 if (pending_parent_count <= 1) { 2608 _ = try self.child_to_pending_parents.remove(child_oid_int); 2609 const child_oid = hash.intToBytes(hash.HashInt(repo_opts.hash), child_oid_int); 2610 try self.ready_queue.append(.{ .bytes = &child_oid }); 2611 } else { 2612 try self.child_to_pending_parents.put(child_oid_int, .{ .uint = pending_parent_count - 1 }); 2613 } 2614 } 2615 } 2616 2617 fn readOidFromList(list: TempDB.ArrayList(.read_only), index: u64) ![hash.byteLen(repo_opts.hash)]u8 { 2618 const oid_cursor = try list.getCursor(index) orelse return error.CursorNotFound; 2619 var oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; 2620 _ = try oid_cursor.readBytes(&oid); 2621 return oid; 2622 } 2623 }; 2624 } 2625